feat(metrics): add "Add 2FA" button clean metrics

This commit is contained in:
Vijay Budhram 2024-07-12 13:40:37 -04:00
Родитель ff47414f01
Коммит 705c8e3ac1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9778545895B2532B
29 изменённых файлов: 129 добавлений и 25 удалений

Просмотреть файл

@ -14,6 +14,7 @@ import {
LocalizedDateOptions,
} from 'fxa-react/lib/utils';
import { Link } from '@reach/router';
import GleanMetrics from '../../../lib/glean';
const PwdDate = ({ passwordCreated }: { passwordCreated: number }) => {
const pwdDateText = Intl.DateTimeFormat('default', {
@ -71,6 +72,9 @@ export const Security = forwardRef<HTMLDivElement>((_, ref) => {
: '/settings/create_password'
}
prefixDataTestId="password"
ctaOnClickAction={() => {
GleanMetrics.accountPref.changePasswordSubmit();
}}
>
{hasPassword ? (
<PwdDate {...{ passwordCreated }} />

Просмотреть файл

@ -12,6 +12,7 @@ import { useAccount, useAlertBar } from '../../../models';
import { ButtonIconReload } from '../ButtonIcon';
import { HomePath } from '../../../constants';
import { Localized, useLocalization } from '@fluent/react';
import GleanMetrics from '../../../lib/glean';
const route = `${HomePath}/two_step_authentication`;
const replaceCodesRoute = `${route}/replace_codes`;
@ -110,6 +111,9 @@ export const UnitRowTwoStepAuth = () => {
/>
</Localized>
}
ctaOnClickAction={() => {
GleanMetrics.accountPref.twoStepAuthSubmit();
}}
>
<Localized id="tfa-row-content-explain">
<p className="text-sm mt-3">

Просмотреть файл

@ -577,6 +577,30 @@ describe('lib/glean', () => {
);
sinon.assert.calledOnce(spy);
});
it('submits a ping with the account_pref_two_step_auth_submit event name', async () => {
GleanMetrics.accountPref.twoStepAuthSubmit();
const spy = sandbox.spy(accountPref.twoStepAuthSubmit, 'record');
await GleanMetrics.isDone();
sinon.assert.calledOnce(setEventNameStub);
sinon.assert.calledWith(
setEventNameStub,
'account_pref_two_step_auth_submit'
);
sinon.assert.called(spy);
});
it('submits a ping with the account_pref_change_password_submit event name', async () => {
GleanMetrics.accountPref.changePasswordSubmit();
const spy = sandbox.spy(accountPref.changePasswordSubmit, 'record');
await GleanMetrics.isDone();
sinon.assert.calledOnce(setEventNameStub);
sinon.assert.calledWith(
setEventNameStub,
'account_pref_change_password_submit'
);
sinon.assert.called(spy);
});
});
describe('deleteAccount', () => {

Просмотреть файл

@ -376,6 +376,12 @@ const recordEventMetric = (
case 'delete_account_password_submit':
deleteAccount.passwordSubmit.record();
break;
case 'account_pref_two_step_auth_submit':
accountPref.twoStepAuthSubmit.record();
break;
case 'account_pref_change_password_submit':
accountPref.changePasswordSubmit.record();
break;
}
};

Просмотреть файл

@ -1842,6 +1842,40 @@ account_pref:
expires: never
data_sensitivity:
- interaction
two_step_auth_submit:
type: event
description: |
Click on "Add" button on account settings page for adding 2FA to account
send_in_pings:
- events
notification_emails:
- vzare@mozilla.com
- fxa-staff@mozilla.com
bugs:
- https://mozilla-hub.atlassian.net/browse/FXA-10039
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
change_password_submit:
type: event
description: |
Click on "Change" on account settings page to change password for account
send_in_pings:
- events
notification_emails:
- vzare@mozilla.com
- fxa-staff@mozilla.com
bugs:
- https://mozilla-hub.atlassian.net/browse/FXA-10039
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
delete_account:
settings_submit:
type: event

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import StringMetricType from '@mozilla/glean/private/metrics/string';

Просмотреть файл

@ -2,10 +2,26 @@
* 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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';
/**
* Click on "Change" on account settings page to change password for account
*
* Generated from `account_pref.change_password_submit`.
*/
export const changePasswordSubmit = new EventMetricType(
{
category: 'account_pref',
name: 'change_password_submit',
sendInPings: ['events'],
lifetime: 'ping',
disabled: false,
},
[]
);
/**
* Click on "Create" or "Change" button on account settings page to add a recovery
* key to the account
@ -23,6 +39,22 @@ export const recoveryKeySubmit = new EventMetricType(
[]
);
/**
* Click on "Add" button on account settings page for adding 2FA to account
*
* Generated from `account_pref.two_step_auth_submit`.
*/
export const twoStepAuthSubmit = new EventMetricType(
{
category: 'account_pref',
name: 'two_step_auth_submit',
sendInPings: ['events'],
lifetime: 'ping',
disabled: false,
},
[]
);
/**
* View of the account settings page
*

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import StringMetricType from '@mozilla/glean/private/metrics/string';

Просмотреть файл

@ -2,8 +2,6 @@
* 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/. */
import { recoveryKeySubmit } from './accountPref';
export type GleanMetricsConfig = {
enabled: boolean;
applicationId: string;
@ -149,6 +147,8 @@ export const eventsMap = {
accountPref: {
view: 'account_pref_view',
recoveryKeySubmit: 'account_pref_recovery_key_submit',
twoStepAuthSubmit: 'account_pref_two_step_auth_submit',
changePasswordSubmit: 'account_pref_change_password_submit',
},
deleteAccount: {

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import PingType from '@mozilla/glean/private/ping';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import StringMetricType from '@mozilla/glean/private/metrics/string';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import StringMetricType from '@mozilla/glean/private/metrics/string';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import LabeledMetricType from '@mozilla/glean/private/metrics/labeled';
import BooleanMetricType from '@mozilla/glean/private/metrics/boolean';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import LabeledMetricType from '@mozilla/glean/private/metrics/labeled';
import BooleanMetricType from '@mozilla/glean/private/metrics/boolean';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import EventMetricType from '@mozilla/glean/private/metrics/event';

Просмотреть файл

@ -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 v14.1.2. DO NOT EDIT. DO NOT COMMIT.
// AUTOGENERATED BY glean_parser v14.2.0. DO NOT EDIT. DO NOT COMMIT.
import StringMetricType from '@mozilla/glean/private/metrics/string';