Bug 1352330 - Credit Card Telemetry for number of fields detected/autofilled/modified. r=abr

Differential Revision: https://phabricator.services.mozilla.com/D85206
This commit is contained in:
Zibi Braniecki 2020-08-04 21:32:37 +00:00
parent cbea910374
commit b441e686f0
3 changed files with 49 additions and 4 deletions

View File

@ -553,11 +553,20 @@ var FormAutofillContent = {
}
records.creditCard.forEach(record => {
let totalCount = handler.form.elements.length;
let autofilledCount = Object.keys(record.record).length;
let unmodifiedCount = record.untouchedFields.length;
const extra = {
fields_not_auto: (totalCount - autofilledCount).toString(),
fields_auto: autofilledCount.toString(),
fields_modified: (autofilledCount - unmodifiedCount).toString(),
};
Services.telemetry.recordEvent(
"creditcard",
"submitted",
"cc_form",
record.flowId
record.flowId,
extra
);
});

View File

@ -142,7 +142,17 @@ add_task(async function test_submit_creditCard_new() {
let expected_content = [
["creditcard", "detected", "cc_form"],
["creditcard", "submitted", "cc_form"],
[
"creditcard",
"submitted",
"cc_form",
undefined,
{
fields_not_auto: "3",
fields_auto: "5",
fields_modified: "5",
},
],
];
await test_per_command(MAIN_BUTTON, undefined, 1);
await assertTelemetry(expected_content, [
@ -221,7 +231,17 @@ add_task(async function test_submit_creditCard_autofill() {
["creditcard", "detected", "cc_form"],
["creditcard", "popup_shown", "cc_form"],
["creditcard", "filled", "cc_form"],
["creditcard", "submitted", "cc_form"],
[
"creditcard",
"submitted",
"cc_form",
undefined,
{
fields_not_auto: "3",
fields_auto: "5",
fields_modified: "0",
},
],
],
[]
);
@ -297,7 +317,17 @@ add_task(async function test_submit_creditCard_update() {
["creditcard", "popup_shown", "cc_form"],
["creditcard", "filled", "cc_form"],
["creditcard", "filled_modified", "cc_form"],
["creditcard", "submitted", "cc_form"],
[
"creditcard",
"submitted",
"cc_form",
undefined,
{
fields_not_auto: "3",
fields_auto: "5",
fields_modified: "1",
},
],
];
await test_per_command(MAIN_BUTTON, undefined, 1);

View File

@ -412,6 +412,12 @@ creditcard:
cc_name: Whether the name was autofilled (autofilled / not_filled / user_filled / unavailable)
cc_number: Whether the credit card number field was autofilled (autofilled / not_filled / user_filled / unavailable)
cc_exp: Whether the expiration date was autofilled (autofilled / not_filled / user_filled / unavailable)
fields_not_auto: >-
Number of fields in a `submitted` event that were not autofilled.
Note that this number counts all fields in a form, even if some of those fields might have been identified as password and/or address fields.
Additionally, it may include input elements that are not rendered as user-modifiable, such as hidden fields as well as <button> elements.
fields_auto: Number of fields in the `submitted` event that were autofilled
fields_modified: Number of fields in a `submitted` event that were autofilled and later modified
extensions.data:
migrateResult: