diff --git a/browser/components/newtab/aboutwelcome/lib/AboutWelcomeTelemetry.jsm b/browser/components/newtab/aboutwelcome/lib/AboutWelcomeTelemetry.jsm index d10166297115..2afcec79dca9 100644 --- a/browser/components/newtab/aboutwelcome/lib/AboutWelcomeTelemetry.jsm +++ b/browser/components/newtab/aboutwelcome/lib/AboutWelcomeTelemetry.jsm @@ -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": diff --git a/browser/components/shopping/metrics.yaml b/browser/components/shopping/metrics.yaml index dd8dc39c70a6..2f6ca985345c 100644 --- a/browser/components/shopping/metrics.yaml +++ b/browser/components/shopping/metrics.yaml @@ -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 + diff --git a/browser/components/shopping/tests/browser/browser_shopping_onboarding.js b/browser/components/shopping/tests/browser/browser_shopping_onboarding.js index ab56477f2121..df93af482922 100644 --- a/browser/components/shopping/tests/browser/browser_shopping_onboarding.js +++ b/browser/components/shopping/tests/browser/browser_shopping_onboarding.js @@ -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() {