Bug 1855812 - Implement telemetry event for shopping ad clicks. r=perry.mcmanis

Differential Revision: https://phabricator.services.mozilla.com/D190958
This commit is contained in:
Jared Hirsch 2023-10-18 15:48:34 +00:00
Родитель 3772854173
Коммит 8f2c031477
3 изменённых файлов: 29 добавлений и 0 удалений

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

@ -124,6 +124,7 @@ export class ShoppingSidebarChild extends RemotePageChild {
case "AdClicked":
aid = event.detail.aid;
this.#product.sendAttributionEvent("click", aid);
Glean.shopping.surfaceAdsClicked.record();
break;
case "AdImpression":
aid = event.detail.aid;

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

@ -505,3 +505,20 @@ shopping:
description: >
Message id for the version of the feature callout shown.
type: string
surface_ads_clicked:
type: event
description: |
An ad shown in the sidebar was clicked.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1855812
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1855812
data_sensitivity:
- interaction
expires: 122
notification_emails:
- betling@mozilla.com
- fx-desktop-shopping-eng@mozilla.com
send_in_pings:
- events

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

@ -8,6 +8,9 @@ const { sinon } = ChromeUtils.importESModule(
);
add_task(async function test_ad_attribution() {
await Services.fog.testFlushAllChildren();
Services.fog.testResetFOG();
await SpecialPowers.pushPrefEnv({
set: [
["toolkit.shopping.ohttpRelayURL", ""],
@ -208,7 +211,15 @@ add_task(async function test_ad_attribution() {
await clickedEvent;
Assert.ok(true, "Got ad clicked event");
// Test the click was recorded by telemetry
await Services.fog.testFlushAllChildren();
var adsClickedEvents = Glean.shopping.surfaceAdsClicked.testGetValue();
Assert.equal(adsClickedEvents.length, 1, "should have recorded a click");
Assert.equal(adsClickedEvents[0].category, "shopping");
Assert.equal(adsClickedEvents[0].name, "surface_ads_clicked");
gBrowser.removeTab(adTab);
Services.fog.testResetFOG();
});
await SpecialPowers.popPrefEnv();