Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const mockStartGoogleAuthFromLogin = jest.fn();
const mockStartAppleAuthFromLogin = jest.fn();
const mockStartGoogleAuthFromReg = jest.fn();
const mockStartAppleAuthFromReg = jest.fn();
const mockAlternativeAuthGoogleStart = jest.fn();
const mockAlternativeAuthAppleStart = jest.fn();
const mockGleanIsDone = jest.fn().mockResolvedValue(undefined);

jest.mock('../../lib/glean', () => {
Expand Down Expand Up @@ -45,6 +47,14 @@ jest.mock('../../lib/glean', () => {
mockStartAppleAuthFromReg();
},
},
login: {
alternativeAuthGoogleStart: () => {
mockAlternativeAuthGoogleStart();
},
alternativeAuthAppleStart: () => {
mockAlternativeAuthAppleStart();
},
},
},
};
});
Expand Down Expand Up @@ -247,5 +257,29 @@ describe('ThirdPartyAuthComponent', () => {
expect(mockStartAppleAuthFromReg).toHaveBeenCalled();
expect(mockGleanIsDone).toHaveBeenCalled();
});

it('emits glean metrics alternativeAuthGoogleStart for the signin-alternative-auth view', async () => {
renderWith({
enabled: true,
viewName: 'signin-alternative-auth',
});
const button = await screen.findByLabelText('Continue with Google');
button.click();
expect(mockAlternativeAuthGoogleStart).toHaveBeenCalled();
expect(mockStartGoogleAuthFromLogin).not.toHaveBeenCalled();
expect(mockGleanIsDone).toHaveBeenCalled();
});

it('emits glean metrics alternativeAuthAppleStart for the signin-alternative-auth view', async () => {
renderWith({
enabled: true,
viewName: 'signin-alternative-auth',
});
const button = await screen.findByLabelText('Continue with Apple');
button.click();
expect(mockAlternativeAuthAppleStart).toHaveBeenCalled();
expect(mockStartAppleAuthFromLogin).not.toHaveBeenCalled();
expect(mockGleanIsDone).toHaveBeenCalled();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@ const ThirdPartySignInButton = ({
case 'apple-signin':
GleanMetrics.thirdPartyAuth.startAppleAuthFromLogin();
break;
case 'google-signin-alternative-auth':
GleanMetrics.login.alternativeAuthGoogleStart();
break;
case 'apple-signin-alternative-auth':
GleanMetrics.login.alternativeAuthAppleStart();
break;
Comment on lines +157 to +162
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add these today. I did test them manually.

case 'google-signup':
GleanMetrics.thirdPartyAuth.startGoogleAuthFromReg();
break;
Expand Down
48 changes: 36 additions & 12 deletions packages/fxa-settings/src/lib/glean/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,42 @@ describe('lib/glean', () => {
);
});

it('submits a ping with the login_alternative_auth_view event name', async () => {
const spy = sandbox.spy(login.alternativeAuthView, 'record');
GleanMetrics.login.alternativeAuthView();
await GleanMetrics.isDone();
sinon.assert.calledOnce(setEventNameStub);
sinon.assert.calledWith(
setEventNameStub,
'login_alternative_auth_view'
);
sinon.assert.calledOnce(spy);
});

it('submits a ping with the login_alternative_auth_google_start event name', async () => {
const spy = sandbox.spy(login.alternativeAuthGoogleStart, 'record');
GleanMetrics.login.alternativeAuthGoogleStart();
await GleanMetrics.isDone();
sinon.assert.calledOnce(setEventNameStub);
sinon.assert.calledWith(
setEventNameStub,
'login_alternative_auth_google_start'
);
sinon.assert.calledOnce(spy);
});

it('submits a ping with the login_alternative_auth_apple_start event name', async () => {
const spy = sandbox.spy(login.alternativeAuthAppleStart, 'record');
GleanMetrics.login.alternativeAuthAppleStart();
await GleanMetrics.isDone();
sinon.assert.calledOnce(setEventNameStub);
sinon.assert.calledWith(
setEventNameStub,
'login_alternative_auth_apple_start'
);
sinon.assert.calledOnce(spy);
});

it('submits a ping with the login_passkey_submit event name', async () => {
GleanMetrics.login.passkeySubmit();
await GleanMetrics.isDone();
Expand Down Expand Up @@ -859,18 +895,6 @@ describe('lib/glean', () => {
sinon.assert.calledOnce(spy);
});

it('submits a ping with the login_third_party_auth_no_pw_view event name', async () => {
const spy = sandbox.spy(thirdPartyAuth.loginNoPwView, 'record');
GleanMetrics.thirdPartyAuth.loginNoPwView();
await GleanMetrics.isDone();
sinon.assert.calledOnce(setEventNameStub);
sinon.assert.calledWith(
setEventNameStub,
'third_party_auth_login_no_pw_view'
);
sinon.assert.calledOnce(spy);
});

it('submits a ping with the third_party_auth_google_login_start event name', async () => {
const spy = sandbox.spy(thirdPartyAuth.googleLoginStart, 'record');
GleanMetrics.thirdPartyAuth.startGoogleAuthFromLogin();
Expand Down
12 changes: 9 additions & 3 deletions packages/fxa-settings/src/lib/glean/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,15 @@ const recordEventMetric = (
case 'login_locked_account_banner_view':
login.lockedAccountBannerView.record();
break;
case 'login_alternative_auth_view':
login.alternativeAuthView.record();
break;
case 'login_alternative_auth_google_start':
login.alternativeAuthGoogleStart.record();
break;
case 'login_alternative_auth_apple_start':
login.alternativeAuthAppleStart.record();
break;
case 'login_passkey_submit':
login.passkeySubmit.record();
break;
Expand Down Expand Up @@ -467,9 +476,6 @@ const recordEventMetric = (
case 'third_party_auth_apple_reg_start':
thirdPartyAuth.appleRegStart.record();
break;
case 'third_party_auth_login_no_pw_view':
thirdPartyAuth.loginNoPwView.record();
break;
case 'third_party_auth_google_login_start':
thirdPartyAuth.googleLoginStart.record();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import { MozServices } from '../../../../lib/types';
jest.mock('../../../../lib/glean', () => ({
__esModule: true,
default: {
cachedLogin: { view: jest.fn() },
thirdPartyAuth: { loginNoPwView: jest.fn() },
login: { diffAccountLinkClick: jest.fn() },
login: {
alternativeAuthView: jest.fn(),
diffAccountLinkClick: jest.fn(),
},
},
}));

Expand Down Expand Up @@ -84,11 +85,8 @@ describe('SigninAlternativeAuthOptions', () => {
screen.getByRole('button', { name: /Continue with Apple/ });
});

it('emits cachedLogin.view and thirdPartyAuth.loginNoPwView on mount', () => {
it('emits login.alternativeAuthView on mount', () => {
renderSigninAlternativeAuthOptions();
expect(GleanMetrics.cachedLogin.view).toHaveBeenCalledWith({
event: { thirdPartyLinks: true },
});
expect(GleanMetrics.thirdPartyAuth.loginNoPwView).toHaveBeenCalledTimes(1);
expect(GleanMetrics.login.alternativeAuthView).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '../../../../models';
import { usePasskeySignIn } from '../../../../lib/passkeys/signin-flow';

export const viewName = 'signin';
export const viewName = 'signin-alternative-auth';

// Signin landing page for linked-passwordless users — their only paths
// forward are the alternative auth options (third-party providers or
Expand Down Expand Up @@ -83,14 +83,11 @@ const SigninAlternativeAuthOptions = ({
isSignedIntoFirefox && integration.isFirefoxDesktopClient();

useEffect(() => {
// NOTE: linked-passwordless users were historically tracked under
// cachedLogin.view because they share similarities, so that is
// preserved here.
GleanMetrics.cachedLogin.view({ event: { thirdPartyLinks: true } });
// Linked-passwordless is the only render path where third-party auth is
// the user's only option. Track this separately from the generic TPA
// view so we can size the impact of the linked-no-password cohort.
GleanMetrics.thirdPartyAuth.loginNoPwView();
// Linked-passwordless is the only render path where third-party auth /
// passkey are the user's only options. Tracked under `login.alternative_auth_*`
// so the view→click funnel for this cohort lives under one category and
// is distinct from generic signin/TPA events.
GleanMetrics.login.alternativeAuthView();
}, []);

return (
Expand Down
6 changes: 3 additions & 3 deletions packages/fxa-settings/src/pages/Signin/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jest.mock('../../lib/glean', () => ({
diffAccountLinkClick: jest.fn(),
engage: jest.fn(),
lockedAccountBannerView: jest.fn(),
alternativeAuthView: jest.fn(),
},
cachedLogin: {
forgotPassword: jest.fn(),
Expand All @@ -82,7 +83,6 @@ jest.mock('../../lib/glean', () => ({
success: jest.fn(),
},
thirdPartyAuth: {
loginNoPwView: jest.fn(),
startGoogleAuthFromLogin: jest.fn(),
startAppleAuthFromLogin: jest.fn(),
appleDeeplink: jest.fn(),
Expand Down Expand Up @@ -957,9 +957,9 @@ describe('Signin component', () => {
});
});

it('does not fire thirdPartyAuth.loginNoPwView (owned by SigninAlternativeAuthOptions)', () => {
it('does not fire login.alternativeAuthView (owned by SigninAlternativeAuthOptions)', () => {
render({ hasPassword: true, hasLinkedAccount: true });
expect(GleanMetrics.thirdPartyAuth.loginNoPwView).not.toHaveBeenCalled();
expect(GleanMetrics.login.alternativeAuthView).not.toHaveBeenCalled();
});
});

Expand Down
71 changes: 54 additions & 17 deletions packages/fxa-shared/metrics/glean/fxa-ui-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,60 @@ login:
expires: never
data_sensitivity:
- interaction
alternative_auth_view:
type: event
description: |
User viewed the alternative auth options on the linked-passwordless
signin view (third-party auth and/or passkey).
send_in_pings:
- events
notification_emails:
- vzare@mozilla.com
- fxa-staff@mozilla.com
bugs:
- https://mozilla-hub.atlassian.net/browse/FXA-13719
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1830504
- https://bugzilla.mozilla.org/show_bug.cgi?id=1844121
expires: never
data_sensitivity:
- interaction
alternative_auth_google_start:
type: event
description: |
User clicked "Continue with Google" from the alternative auth options
view (linked account passwordless signin).
send_in_pings:
- events
notification_emails:
- vzare@mozilla.com
- fxa-staff@mozilla.com
bugs:
- https://mozilla-hub.atlassian.net/browse/FXA-13719
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1830504
- https://bugzilla.mozilla.org/show_bug.cgi?id=1844121
expires: never
data_sensitivity:
- interaction
alternative_auth_apple_start:
type: event
description: |
User clicked "Continue with Apple" from the alternative auth options
view (linked account passwordless signin).
send_in_pings:
- events
notification_emails:
- vzare@mozilla.com
- fxa-staff@mozilla.com
bugs:
- https://mozilla-hub.atlassian.net/browse/FXA-13719
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1830504
- https://bugzilla.mozilla.org/show_bug.cgi?id=1844121
expires: never
data_sensitivity:
- interaction
passkey_submit:
type: event
description: |
Expand Down Expand Up @@ -2476,23 +2530,6 @@ cad:
data_sensitivity:
- interaction
third_party_auth:
login_no_pw_view:
type: event
description: |
User viewed the third party login page without password set.
send_in_pings:
- events
notification_emails:
- vzare@mozilla.com
- fxa-staff@mozilla.com
bugs:
- https://mozilla-hub.atlassian.net/browse/FXA-7265
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1830504
- https://bugzilla.mozilla.org/show_bug.cgi?id=1844121
expires: never
data_sensitivity:
- interaction
apple_reg_start:
type: event
description: |
Expand Down
2 changes: 1 addition & 1 deletion packages/fxa-shared/metrics/glean/web/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v19.0.0. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v19.2.0. DO NOT EDIT. DO NOT COMMIT.

import StringMetricType from '@mozilla/glean/private/metrics/string';

Expand Down
2 changes: 1 addition & 1 deletion packages/fxa-shared/metrics/glean/web/accountBanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v19.0.0. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v19.2.0. DO NOT EDIT. DO NOT COMMIT.

import EventMetricType from '@mozilla/glean/private/metrics/event';

Expand Down
2 changes: 1 addition & 1 deletion packages/fxa-shared/metrics/glean/web/accountPref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v19.0.0. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v19.2.0. DO NOT EDIT. DO NOT COMMIT.

import EventMetricType from '@mozilla/glean/private/metrics/event';

Expand Down
2 changes: 1 addition & 1 deletion packages/fxa-shared/metrics/glean/web/cachedLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v19.0.0. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v19.2.0. DO NOT EDIT. DO NOT COMMIT.

import EventMetricType from '@mozilla/glean/private/metrics/event';

Expand Down
2 changes: 1 addition & 1 deletion packages/fxa-shared/metrics/glean/web/cad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v19.0.0. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v19.2.0. DO NOT EDIT. DO NOT COMMIT.

import EventMetricType from '@mozilla/glean/private/metrics/event';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v19.0.0. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v19.2.0. DO NOT EDIT. DO NOT COMMIT.

import EventMetricType from '@mozilla/glean/private/metrics/event';

Expand Down
2 changes: 1 addition & 1 deletion packages/fxa-shared/metrics/glean/web/cadFirefox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v19.0.0. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v19.2.0. DO NOT EDIT. DO NOT COMMIT.

import EventMetricType from '@mozilla/glean/private/metrics/event';

Expand Down
2 changes: 1 addition & 1 deletion packages/fxa-shared/metrics/glean/web/cadMobilePair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// AUTOGENERATED BY glean_parser v19.0.0. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v19.2.0. DO NOT EDIT. DO NOT COMMIT.

import EventMetricType from '@mozilla/glean/private/metrics/event';

Expand Down
Loading
Loading