Bug 1749775 - Add user telemetry for 98 VPN promo, r=andreio,pdahiya

Differential Revision: https://phabricator.services.mozilla.com/D135874
This commit is contained in:
Dan Mosedale
2022-02-11 16:31:06 +00:00
parent 33d9dfd234
commit 5e02b224d2
6 changed files with 50 additions and 25 deletions

View File

@@ -125,6 +125,7 @@ async function renderPromo({
type: "BLOCK_MESSAGE_BY_ID",
data: { id: messageId },
});
window.PrivateBrowsingRecordClick("dismiss_button");
container.remove();
};
@@ -190,6 +191,8 @@ function recordOnceVisible(message) {
type: "IMPRESSION",
data: message,
});
// Similar telemetry, but for Nimbus experiments
window.PrivateBrowsingExposureTelemetry();
document.removeEventListener("visibilitychange", recordImpression);
}
};
@@ -199,6 +202,8 @@ function recordOnceVisible(message) {
type: "IMPRESSION",
data: message,
});
// Similar telemetry, but for Nimbus experiments
window.PrivateBrowsingExposureTelemetry();
} else {
document.addEventListener("visibilitychange", recordImpression);
}
@@ -236,8 +241,6 @@ async function setupFeatureConfig() {
}
document.addEventListener("DOMContentLoaded", function() {
setupFeatureConfig();
if (!RPMIsWindowPrivate()) {
document.documentElement.classList.remove("private");
document.documentElement.classList.add("normal");
@@ -249,6 +252,10 @@ document.addEventListener("DOMContentLoaded", function() {
return;
}
// We don't do this setup until now, because we don't want to record any impressions until we're
// sure we're actually running a private window, not just about:privatebrowsing in a normal window.
setupFeatureConfig();
// Set up the private search banner.
const privateSearchBanner = document.getElementById("search-banner");