forked from mirrors/gecko-dev
Bug 1897099 - Remove cc_form event telemetry r=credential-management-reviewers,jneuberger
This telemetry is replaced by `cc_form_v2` event telemetry Differential Revision: https://phabricator.services.mozilla.com/D210621
This commit is contained in:
parent
dce85e0636
commit
8df4378f60
3 changed files with 2 additions and 199 deletions
|
|
@ -6,10 +6,6 @@ const { TelemetryTestUtils } = ChromeUtils.importESModule(
|
||||||
|
|
||||||
const CC_NUM_USES_HISTOGRAM = "CREDITCARD_NUM_USES";
|
const CC_NUM_USES_HISTOGRAM = "CREDITCARD_NUM_USES";
|
||||||
|
|
||||||
function ccFormArgsv1(method, extra) {
|
|
||||||
return ["creditcard", method, "cc_form", undefined, extra];
|
|
||||||
}
|
|
||||||
|
|
||||||
function ccFormArgsv2(method, extra) {
|
function ccFormArgsv2(method, extra) {
|
||||||
return ["creditcard", method, "cc_form_v2", undefined, extra];
|
return ["creditcard", method, "cc_form_v2", undefined, extra];
|
||||||
}
|
}
|
||||||
|
|
@ -229,9 +225,7 @@ add_task(async function test_popup_opened() {
|
||||||
|
|
||||||
await assertTelemetry([
|
await assertTelemetry([
|
||||||
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
||||||
ccFormArgsv1("detected"),
|
|
||||||
ccFormArgsv2("popup_shown", { field_name: "cc-number" }),
|
ccFormArgsv2("popup_shown", { field_name: "cc-number" }),
|
||||||
ccFormArgsv1("popup_shown"),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
TelemetryTestUtils.assertScalar(
|
TelemetryTestUtils.assertScalar(
|
||||||
|
|
@ -297,9 +291,7 @@ add_task(async function test_popup_opened_form_without_autocomplete() {
|
||||||
"detected",
|
"detected",
|
||||||
buildccFormv2Extra({ cc_number: "1", cc_name: "1", cc_exp: "false" }, "0")
|
buildccFormv2Extra({ cc_number: "1", cc_name: "1", cc_exp: "false" }, "0")
|
||||||
),
|
),
|
||||||
ccFormArgsv1("detected"),
|
|
||||||
ccFormArgsv2("popup_shown", { field_name: "cc-number" }),
|
ccFormArgsv2("popup_shown", { field_name: "cc-number" }),
|
||||||
ccFormArgsv1("popup_shown"),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
TelemetryTestUtils.assertScalar(
|
TelemetryTestUtils.assertScalar(
|
||||||
|
|
@ -370,9 +362,7 @@ add_task(
|
||||||
|
|
||||||
await assertTelemetry([
|
await assertTelemetry([
|
||||||
ccFormArgsv2("detected", buildccFormv2Extra({ cc_number: "1" }, "false")),
|
ccFormArgsv2("detected", buildccFormv2Extra({ cc_number: "1" }, "false")),
|
||||||
ccFormArgsv1("detected"),
|
|
||||||
ccFormArgsv2("popup_shown", { field_name: "cc-number" }),
|
ccFormArgsv2("popup_shown", { field_name: "cc-number" }),
|
||||||
ccFormArgsv1("popup_shown"),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await assertGleanTelemetry([
|
await assertGleanTelemetry([
|
||||||
|
|
@ -412,9 +402,7 @@ add_task(
|
||||||
"false"
|
"false"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
ccFormArgsv1("detected"),
|
|
||||||
ccFormArgsv2("popup_shown", { field_name: "cc-name" }),
|
ccFormArgsv2("popup_shown", { field_name: "cc-name" }),
|
||||||
ccFormArgsv1("popup_shown"),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
TelemetryTestUtils.assertScalar(
|
TelemetryTestUtils.assertScalar(
|
||||||
|
|
@ -517,17 +505,10 @@ add_task(async function test_submit_creditCard_new() {
|
||||||
|
|
||||||
let expected_content = [
|
let expected_content = [
|
||||||
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
||||||
ccFormArgsv1("detected"),
|
|
||||||
ccFormArgsv2(
|
ccFormArgsv2(
|
||||||
"submitted",
|
"submitted",
|
||||||
buildccFormv2Extra({ cc_exp: "unavailable" }, "user_filled")
|
buildccFormv2Extra({ cc_exp: "unavailable" }, "user_filled")
|
||||||
),
|
),
|
||||||
ccFormArgsv1("submitted", {
|
|
||||||
// 5 fields plus submit button
|
|
||||||
fields_not_auto: "6",
|
|
||||||
fields_auto: "0",
|
|
||||||
fields_modified: "0",
|
|
||||||
}),
|
|
||||||
];
|
];
|
||||||
let expected_glean_events = [
|
let expected_glean_events = [
|
||||||
{
|
{
|
||||||
|
|
@ -622,23 +603,15 @@ add_task(async function test_submit_creditCard_autofill() {
|
||||||
await assertTelemetry(
|
await assertTelemetry(
|
||||||
[
|
[
|
||||||
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
||||||
ccFormArgsv1("detected"),
|
|
||||||
ccFormArgsv2("popup_shown", { field_name: "cc-name" }),
|
ccFormArgsv2("popup_shown", { field_name: "cc-name" }),
|
||||||
ccFormArgsv1("popup_shown"),
|
|
||||||
ccFormArgsv2(
|
ccFormArgsv2(
|
||||||
"filled",
|
"filled",
|
||||||
buildccFormv2Extra({ cc_exp: "unavailable" }, "filled")
|
buildccFormv2Extra({ cc_exp: "unavailable" }, "filled")
|
||||||
),
|
),
|
||||||
ccFormArgsv1("filled"),
|
|
||||||
ccFormArgsv2(
|
ccFormArgsv2(
|
||||||
"submitted",
|
"submitted",
|
||||||
buildccFormv2Extra({ cc_exp: "unavailable" }, "autofilled")
|
buildccFormv2Extra({ cc_exp: "unavailable" }, "autofilled")
|
||||||
),
|
),
|
||||||
ccFormArgsv1("submitted", {
|
|
||||||
fields_not_auto: "3",
|
|
||||||
fields_auto: "5",
|
|
||||||
fields_modified: "0",
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
@ -759,16 +732,12 @@ add_task(async function test_submit_creditCard_update() {
|
||||||
|
|
||||||
let expected_content = [
|
let expected_content = [
|
||||||
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
||||||
ccFormArgsv1("detected"),
|
|
||||||
ccFormArgsv2("popup_shown", { field_name: "cc-name" }),
|
ccFormArgsv2("popup_shown", { field_name: "cc-name" }),
|
||||||
ccFormArgsv1("popup_shown"),
|
|
||||||
ccFormArgsv2(
|
ccFormArgsv2(
|
||||||
"filled",
|
"filled",
|
||||||
buildccFormv2Extra({ cc_exp: "unavailable" }, "filled")
|
buildccFormv2Extra({ cc_exp: "unavailable" }, "filled")
|
||||||
),
|
),
|
||||||
ccFormArgsv1("filled"),
|
|
||||||
ccFormArgsv2("filled_modified", { field_name: "cc-exp-year" }),
|
ccFormArgsv2("filled_modified", { field_name: "cc-exp-year" }),
|
||||||
ccFormArgsv1("filled_modified", { field_name: "cc-exp-year" }),
|
|
||||||
ccFormArgsv2(
|
ccFormArgsv2(
|
||||||
"submitted",
|
"submitted",
|
||||||
buildccFormv2Extra(
|
buildccFormv2Extra(
|
||||||
|
|
@ -776,11 +745,6 @@ add_task(async function test_submit_creditCard_update() {
|
||||||
"autofilled"
|
"autofilled"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
ccFormArgsv1("submitted", {
|
|
||||||
fields_not_auto: "3",
|
|
||||||
fields_auto: "5",
|
|
||||||
fields_modified: "1",
|
|
||||||
}),
|
|
||||||
];
|
];
|
||||||
let expected_glean_events = [
|
let expected_glean_events = [
|
||||||
{
|
{
|
||||||
|
|
@ -1047,14 +1011,11 @@ add_task(async function test_clear_creditCard_autofill() {
|
||||||
|
|
||||||
let expected_content = [
|
let expected_content = [
|
||||||
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
ccFormArgsv2("detected", buildccFormv2Extra({ cc_exp: "false" }, "true")),
|
||||||
ccFormArgsv1("detected"),
|
|
||||||
ccFormArgsv2("popup_shown", { field_name: "cc-name" }),
|
ccFormArgsv2("popup_shown", { field_name: "cc-name" }),
|
||||||
ccFormArgsv1("popup_shown"),
|
|
||||||
ccFormArgsv2(
|
ccFormArgsv2(
|
||||||
"filled",
|
"filled",
|
||||||
buildccFormv2Extra({ cc_exp: "unavailable" }, "filled")
|
buildccFormv2Extra({ cc_exp: "unavailable" }, "filled")
|
||||||
),
|
),
|
||||||
ccFormArgsv1("filled"),
|
|
||||||
];
|
];
|
||||||
await assertTelemetry(expected_content, []);
|
await assertTelemetry(expected_content, []);
|
||||||
|
|
||||||
|
|
@ -1095,10 +1056,7 @@ add_task(async function test_clear_creditCard_autofill() {
|
||||||
// flushing Glean data before tab removal (see Bug 1843178)
|
// flushing Glean data before tab removal (see Bug 1843178)
|
||||||
await Services.fog.testFlushAllChildren();
|
await Services.fog.testFlushAllChildren();
|
||||||
|
|
||||||
expected_content = [
|
expected_content = [ccFormArgsv2("popup_shown", { field_name: "cc-number" })];
|
||||||
ccFormArgsv2("popup_shown", { field_name: "cc-number" }),
|
|
||||||
ccFormArgsv1("popup_shown"),
|
|
||||||
];
|
|
||||||
await assertTelemetry(expected_content, []);
|
await assertTelemetry(expected_content, []);
|
||||||
await assertGleanTelemetry([
|
await assertGleanTelemetry([
|
||||||
{
|
{
|
||||||
|
|
@ -1134,20 +1092,14 @@ add_task(async function test_clear_creditCard_autofill() {
|
||||||
|
|
||||||
expected_content = [
|
expected_content = [
|
||||||
ccFormArgsv2("filled_modified", { field_name: "cc-name" }),
|
ccFormArgsv2("filled_modified", { field_name: "cc-name" }),
|
||||||
ccFormArgsv1("filled_modified", { field_name: "cc-name" }),
|
|
||||||
ccFormArgsv2("filled_modified", { field_name: "cc-number" }),
|
ccFormArgsv2("filled_modified", { field_name: "cc-number" }),
|
||||||
ccFormArgsv1("filled_modified", { field_name: "cc-number" }),
|
|
||||||
ccFormArgsv2("filled_modified", { field_name: "cc-exp-month" }),
|
ccFormArgsv2("filled_modified", { field_name: "cc-exp-month" }),
|
||||||
ccFormArgsv1("filled_modified", { field_name: "cc-exp-month" }),
|
|
||||||
ccFormArgsv2("filled_modified", { field_name: "cc-exp-year" }),
|
ccFormArgsv2("filled_modified", { field_name: "cc-exp-year" }),
|
||||||
ccFormArgsv1("filled_modified", { field_name: "cc-exp-year" }),
|
|
||||||
ccFormArgsv2("filled_modified", { field_name: "cc-type" }),
|
ccFormArgsv2("filled_modified", { field_name: "cc-type" }),
|
||||||
ccFormArgsv1("filled_modified", { field_name: "cc-type" }),
|
|
||||||
ccFormArgsv2("cleared", { field_name: "cc-number" }),
|
ccFormArgsv2("cleared", { field_name: "cc-number" }),
|
||||||
// popup is shown again because when the field is cleared and is focused,
|
// popup is shown again because when the field is cleared and is focused,
|
||||||
// we automatically triggers the popup.
|
// we automatically triggers the popup.
|
||||||
ccFormArgsv2("popup_shown", { field_name: "cc-number" }),
|
ccFormArgsv2("popup_shown", { field_name: "cc-number" }),
|
||||||
ccFormArgsv1("popup_shown"),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
await assertTelemetry(expected_content, []);
|
await assertTelemetry(expected_content, []);
|
||||||
|
|
|
||||||
|
|
@ -374,128 +374,11 @@ class CreditCardTelemetry extends AutofillTelemetryBase {
|
||||||
"cc-exp-year": "cc_exp_year",
|
"cc-exp-year": "cc_exp_year",
|
||||||
};
|
};
|
||||||
|
|
||||||
recordLegacyFormEvent(method, flowId, extra = null) {
|
|
||||||
Services.telemetry.recordEvent(
|
|
||||||
this.EVENT_CATEGORY,
|
|
||||||
method,
|
|
||||||
"cc_form",
|
|
||||||
flowId,
|
|
||||||
extra
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
recordGleanFormEvent(eventName, flowId, extra) {
|
recordGleanFormEvent(eventName, flowId, extra) {
|
||||||
extra.flow_id = flowId;
|
extra.flow_id = flowId;
|
||||||
Glean.formautofillCreditcards[eventName].record(extra);
|
Glean.formautofillCreditcards[eventName].record(extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
recordFormDetected(section) {
|
|
||||||
super.recordFormDetected(section);
|
|
||||||
|
|
||||||
let identified = new Set();
|
|
||||||
section.fieldDetails.forEach(detail => {
|
|
||||||
identified.add(detail.fieldName);
|
|
||||||
});
|
|
||||||
let extra = {
|
|
||||||
cc_name_found: identified.has("cc-name") ? "true" : "false",
|
|
||||||
cc_number_found: identified.has("cc-number") ? "true" : "false",
|
|
||||||
cc_exp_found:
|
|
||||||
identified.has("cc-exp") ||
|
|
||||||
(identified.has("cc-exp-month") && identified.has("cc-exp-year"))
|
|
||||||
? "true"
|
|
||||||
: "false",
|
|
||||||
};
|
|
||||||
|
|
||||||
this.recordLegacyFormEvent("detected", section.flowId, extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
recordPopupShown(section, fieldName) {
|
|
||||||
super.recordPopupShown(section, fieldName);
|
|
||||||
|
|
||||||
this.recordLegacyFormEvent("popup_shown", section.flowId);
|
|
||||||
}
|
|
||||||
|
|
||||||
recordFormFilled(section, profile) {
|
|
||||||
super.recordFormFilled(section, profile);
|
|
||||||
// Calculate values for telemetry
|
|
||||||
let extra = {
|
|
||||||
cc_name: "unavailable",
|
|
||||||
cc_number: "unavailable",
|
|
||||||
cc_exp: "unavailable",
|
|
||||||
};
|
|
||||||
|
|
||||||
for (let fieldDetail of section.fieldDetails) {
|
|
||||||
let element = fieldDetail.element;
|
|
||||||
let state = profile[fieldDetail.fieldName] ? "filled" : "not_filled";
|
|
||||||
if (
|
|
||||||
section.handler.getFilledStateByElement(element) ==
|
|
||||||
FIELD_STATES.NORMAL &&
|
|
||||||
(HTMLSelectElement.isInstance(element) ||
|
|
||||||
(HTMLInputElement.isInstance(element) && element.value.length))
|
|
||||||
) {
|
|
||||||
state = "user_filled";
|
|
||||||
}
|
|
||||||
switch (fieldDetail.fieldName) {
|
|
||||||
case "cc-name":
|
|
||||||
extra.cc_name = state;
|
|
||||||
break;
|
|
||||||
case "cc-number":
|
|
||||||
extra.cc_number = state;
|
|
||||||
break;
|
|
||||||
case "cc-exp":
|
|
||||||
case "cc-exp-month":
|
|
||||||
case "cc-exp-year":
|
|
||||||
extra.cc_exp = state;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.recordLegacyFormEvent("filled", section.flowId, extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
recordFilledModified(section, fieldName) {
|
|
||||||
super.recordFilledModified(section, fieldName);
|
|
||||||
|
|
||||||
let extra = { field_name: fieldName };
|
|
||||||
this.recordLegacyFormEvent("filled_modified", section.flowId, extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a credit card form is submitted
|
|
||||||
*
|
|
||||||
* @param {object} section Section that produces this record
|
|
||||||
* @param {object} record Credit card record filled in the form.
|
|
||||||
* @param {Array<HTMLForm>} form Form that contains the section
|
|
||||||
*/
|
|
||||||
recordFormSubmitted(section, record, form) {
|
|
||||||
super.recordFormSubmitted(section, record, form);
|
|
||||||
|
|
||||||
// For legacy cc_form event telemetry
|
|
||||||
let extra = {
|
|
||||||
fields_not_auto: "0",
|
|
||||||
fields_auto: "0",
|
|
||||||
fields_modified: "0",
|
|
||||||
};
|
|
||||||
|
|
||||||
if (record.guid !== null) {
|
|
||||||
let totalCount = form.elements.length;
|
|
||||||
let autofilledCount = Object.keys(record.record).length;
|
|
||||||
let unmodifiedCount = record.untouchedFields.length;
|
|
||||||
|
|
||||||
extra.fields_not_auto = (totalCount - autofilledCount).toString();
|
|
||||||
extra.fields_auto = autofilledCount.toString();
|
|
||||||
extra.fields_modified = (autofilledCount - unmodifiedCount).toString();
|
|
||||||
} else {
|
|
||||||
// If the `guid` is null, we're filling a new form.
|
|
||||||
// In that case, all not-null fields are manually filled.
|
|
||||||
extra.fields_not_auto = Array.from(form.elements)
|
|
||||||
.filter(element => !!element.value?.trim().length)
|
|
||||||
.length.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.recordLegacyFormEvent("submitted", section.flowId, extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
recordNumberOfUse(records) {
|
recordNumberOfUse(records) {
|
||||||
super.recordNumberOfUse(records);
|
super.recordNumberOfUse(records);
|
||||||
|
|
||||||
|
|
@ -572,7 +455,7 @@ export class AutofillTelemetry {
|
||||||
* Utility functions for form event (defined in Events.yaml)
|
* Utility functions for form event (defined in Events.yaml)
|
||||||
*
|
*
|
||||||
* Category: address or creditcard
|
* Category: address or creditcard
|
||||||
* Event name: cc_form, cc_form_v2, or address_form
|
* Event name: cc_form_v2, or address_form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static recordFormInteractionEvent(
|
static recordFormInteractionEvent(
|
||||||
|
|
|
||||||
|
|
@ -536,38 +536,6 @@ creditcard:
|
||||||
- "firefox"
|
- "firefox"
|
||||||
record_in_processes: ["main"]
|
record_in_processes: ["main"]
|
||||||
release_channel_collection: opt-out
|
release_channel_collection: opt-out
|
||||||
cc_form:
|
|
||||||
description: >-
|
|
||||||
User interactions for credit card autofill forms
|
|
||||||
objects:
|
|
||||||
- "cc_form"
|
|
||||||
methods:
|
|
||||||
- "detected"
|
|
||||||
- "popup_shown"
|
|
||||||
- "filled"
|
|
||||||
- "filled_modified"
|
|
||||||
- "submitted"
|
|
||||||
bug_numbers: [1653073, 1653162, 1720608, 1767907]
|
|
||||||
notification_emails: ["autofill@lists.mozilla.org", "passwords-dev@mozilla.org"]
|
|
||||||
expiry_version: never
|
|
||||||
products:
|
|
||||||
- "firefox"
|
|
||||||
record_in_processes: ["content"]
|
|
||||||
release_channel_collection: opt-out
|
|
||||||
extra_keys:
|
|
||||||
cc_name_found: Whether the cardholder name field was identified
|
|
||||||
cc_number_found: Whether the credit card number field was identified
|
|
||||||
cc_exp_found: Whether the expiration date was identified
|
|
||||||
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)
|
|
||||||
field_name: Name of the field being affected by the method
|
|
||||||
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
|
|
||||||
cc_form_v2:
|
cc_form_v2:
|
||||||
description: >-
|
description: >-
|
||||||
User interactions for credit card autofill forms
|
User interactions for credit card autofill forms
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue