Bug 1851820 - Send an event when Learn More is clicked r=aminomancer

Differential Revision: https://phabricator.services.mozilla.com/D187564
This commit is contained in:
Perry McManis 2023-09-06 17:53:58 +00:00
parent 4a854c7e5c
commit 3e99ac17ac
3 changed files with 58 additions and 0 deletions

View File

@ -272,6 +272,10 @@ class AboutWelcomeTelemetry {
// corresponds to "Not Now"
Glean.shopping.surfaceNotNowClicked.record();
break;
case "cta_paragraph":
// corresponds to "Learn More"
Glean.shopping.surfaceLearnMoreClicked.record();
break;
}
break;
case "IMPRESSION":

View File

@ -316,3 +316,22 @@ shopping:
- fx-desktop-shopping-eng@mozilla.com
send_in_pings:
- events
surface_learn_more_clicked:
type: event
description: |
The user clicked the 'Learn More' link in the Shopping onboarding
experience.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1851820
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1851820#c2
data_sensitivity:
- interaction
expires: 122
notification_emails:
- betling@mozilla.com
- fx-desktop-shopping-eng@mozilla.com
send_in_pings:
- events

View File

@ -337,6 +337,35 @@ async function legalParagraphClickLinks() {
}
);
await handleActionStubCalled;
handleActionStub.resetHistory();
handleActionStubCalled = new Promise(resolve =>
handleActionStub.callsFake(resolve)
);
await BrowserTestUtils.withNewTab(
{
url: "about:shoppingsidebar",
gBrowser,
},
async browser => {
await SpecialPowers.spawn(browser, [], async () => {
await ContentTaskUtils.waitForMutationCondition(
content.document,
{ childList: true, subtree: true },
() => content.document.querySelector(".cta-paragraph a")
);
let cta = content.document.querySelector(
"shopping-container .cta-paragraph a"
);
// Learn More link button.
cta.click();
});
}
);
await handleActionStubCalled;
sandbox.restore();
}
@ -367,6 +396,12 @@ add_task(async function test_linkParagraph() {
Assert.greater(tosEvents.length, 0);
Assert.equal(tosEvents[0].category, "shopping");
Assert.equal(tosEvents[0].name, "surface_show_terms_clicked");
let learnMoreEvents = Glean.shopping.surfaceLearnMoreClicked.testGetValue();
Assert.greater(learnMoreEvents.length, 0);
Assert.equal(learnMoreEvents[0].category, "shopping");
Assert.equal(learnMoreEvents[0].name, "surface_learn_more_clicked");
});
add_task(async function test_onboarding_auto_activate_opt_in() {