Bug 1887686 - Add shopping page property to SERP categorization event. r=jteow

Differential Revision: https://phabricator.services.mozilla.com/D205607
This commit is contained in:
Stephanie Cunnane
2024-03-25 21:31:28 +00:00
parent fa642985ac
commit 14eeeccf77
9 changed files with 61 additions and 0 deletions

View File

@@ -1795,6 +1795,7 @@ class ContentHandler {
partner_code: impressionInfo.partnerCode, partner_code: impressionInfo.partnerCode,
provider: impressionInfo.provider, provider: impressionInfo.provider,
tagged: impressionInfo.tagged, tagged: impressionInfo.tagged,
is_shopping_page: impressionInfo.isShoppingPage,
num_ads_clicked: telemetryState.adsClicked, num_ads_clicked: telemetryState.adsClicked,
num_ads_visible: telemetryState.adsVisible, num_ads_visible: telemetryState.adsVisible,
}); });

View File

@@ -339,6 +339,7 @@ serp:
bugs: bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1868476 - https://bugzilla.mozilla.org/show_bug.cgi?id=1868476
- https://bugzilla.mozilla.org/show_bug.cgi?id=1869064 - https://bugzilla.mozilla.org/show_bug.cgi?id=1869064
- https://bugzilla.mozilla.org/show_bug.cgi?id=1887686
data_reviews: data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1868476 - https://bugzilla.mozilla.org/show_bug.cgi?id=1868476
data_sensitivity: data_sensitivity:
@@ -418,6 +419,10 @@ serp:
Version number for the Remote Settings attachments used to generate Version number for the Remote Settings attachments used to generate
the domain-to-categories map used in the SERP categorization process. the domain-to-categories map used in the SERP categorization process.
type: quantity type: quantity
is_shopping_page:
description: >
Indicates if the page is a shopping page.
type: boolean
num_ads_visible: num_ads_visible:
description: > description: >
Number of ads visible on the page at the time of categorizing the Number of ads visible on the page at the time of categorizing the

View File

@@ -152,6 +152,7 @@ add_task(async function test_enable_experiment_when_pref_is_not_enabled() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}, },

View File

@@ -103,6 +103,7 @@ add_task(async function test_load_serp_and_categorize() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}, },
@@ -143,6 +144,7 @@ add_task(async function test_load_serp_and_categorize_and_click_organic() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}, },
@@ -181,6 +183,7 @@ add_task(async function test_load_serp_and_categorize_and_click_sponsored() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "1", num_ads_clicked: "1",
num_ads_visible: "2", num_ads_visible: "2",
}, },

View File

@@ -159,6 +159,7 @@ add_task(async function test_download_after_failure() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_visible: "2", num_ads_visible: "2",
num_ads_clicked: "0", num_ads_clicked: "0",
}, },

View File

@@ -113,6 +113,7 @@ add_task(async function test_categorize_page_with_different_region() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}, },

View File

@@ -19,6 +19,7 @@ const TEST_PROVIDER_INFO = [
queryParamNames: ["s"], queryParamNames: ["s"],
codeParamName: "abc", codeParamName: "abc",
taggedCodes: ["ff"], taggedCodes: ["ff"],
organicCodes: [],
adServerAttributes: ["mozAttr"], adServerAttributes: ["mozAttr"],
nonAdsLinkRegexps: [], nonAdsLinkRegexps: [],
extraAdServersRegexps: [ extraAdServersRegexps: [
@@ -56,6 +57,9 @@ const TEST_PROVIDER_INFO = [
default: true, default: true,
}, },
], ],
shoppingTab: {
regexp: "&page=shop",
},
}, },
]; ];
@@ -120,6 +124,7 @@ add_task(async function test_categorization_reporting() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}, },
@@ -225,8 +230,46 @@ add_task(async function test_reporting_limited_to_10_domains_of_each_kind() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "12", num_ads_visible: "12",
}, },
]); ]);
}); });
add_task(async function test_categorization_reporting_for_shopping_page() {
resetTelemetry();
let url = getSERPUrl("searchTelemetryDomainCategorizationReporting.html");
let shoppingUrl = new URL(url);
shoppingUrl.searchParams.set("page", "shop");
shoppingUrl = shoppingUrl.toString();
info("Load a sample shopping page SERP with organic and sponsored results.");
let promise = waitForPageWithCategorizedDomains();
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, shoppingUrl);
await promise;
await BrowserTestUtils.removeTab(tab);
assertCategorizationValues([
{
organic_category: "3",
organic_num_domains: "1",
organic_num_inconclusive: "0",
organic_num_unknown: "0",
sponsored_category: "4",
sponsored_num_domains: "2",
sponsored_num_inconclusive: "0",
sponsored_num_unknown: "0",
mappings_version: "1",
app_version: APP_MAJOR_VERSION,
channel: CHANNEL,
region: REGION,
partner_code: "ff",
provider: "example",
tagged: "true",
is_shopping_page: "true",
num_ads_clicked: "0",
num_ads_visible: "2",
},
]);
});

View File

@@ -126,6 +126,7 @@ add_task(async function test_categorize_serp_and_wait() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}, },
@@ -170,6 +171,7 @@ add_task(async function test_categorize_serp_open_multiple_tabs() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}); });
@@ -223,6 +225,7 @@ add_task(async function test_categorize_serp_close_tab_and_wait() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}, },
@@ -276,6 +279,7 @@ add_task(async function test_categorize_serp_open_ad_and_wait() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "1", num_ads_clicked: "1",
num_ads_visible: "2", num_ads_visible: "2",
}, },

View File

@@ -138,6 +138,7 @@ add_task(async function test_categorize_serp_and_sleep() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}, },
@@ -195,6 +196,7 @@ add_task(async function test_categorize_serp_and_sleep_not_long_enough() {
partner_code: "ff", partner_code: "ff",
provider: "example", provider: "example",
tagged: "true", tagged: "true",
is_shopping_page: "false",
num_ads_clicked: "0", num_ads_clicked: "0",
num_ads_visible: "2", num_ads_visible: "2",
}, },