Bug 1492174 - Update CFR Messages to reflect planned cohorts r=ursula
authork88hudson <k88hudson@gmail.com>
Thu, 20 Sep 2018 21:09:17 +0000
changeset 437502 fba337077a687723353e3b5bdae58a5f1996d516
parent 437501 e7665879a630451639a42a2d75383b24928b90a2
child 437503 7106b3f8d717899c5a29903a089ecd46f14b2253
push id69701
push userkhudson@mozilla.com
push dateThu, 20 Sep 2018 21:10:21 +0000
treeherderautoland@fba337077a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersursula
bugs1492174
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1492174 - Update CFR Messages to reflect planned cohorts r=ursula Differential Revision: https://phabricator.services.mozilla.com/D6414
browser/components/newtab/lib/ActivityStream.jsm
browser/components/newtab/lib/CFRMessageProvider.jsm
--- a/browser/components/newtab/lib/ActivityStream.jsm
+++ b/browser/components/newtab/lib/ActivityStream.jsm
@@ -36,16 +36,17 @@ const DEFAULT_SITES = new Map([
   ["DE", "https://www.youtube.com/,https://www.facebook.com/,https://www.amazon.de/,https://www.ebay.de/,https://www.wikipedia.org/,https://www.reddit.com/"],
   ["PL", "https://www.youtube.com/,https://www.facebook.com/,https://allegro.pl/,https://www.wikipedia.org/,https://www.olx.pl/,https://www.wykop.pl/"],
   ["RU", "https://vk.com/,https://www.youtube.com/,https://ok.ru/,https://www.avito.ru/,https://www.aliexpress.com/,https://www.wikipedia.org/"],
   ["GB", "https://www.youtube.com/,https://www.facebook.com/,https://www.reddit.com/,https://www.amazon.co.uk/,https://www.bbc.co.uk/,https://www.ebay.co.uk/"],
   ["FR", "https://www.youtube.com/,https://www.facebook.com/,https://www.wikipedia.org/,https://www.amazon.fr/,https://www.leboncoin.fr/,https://twitter.com/"],
 ]);
 const GEO_PREF = "browser.search.region";
 const SPOCS_GEOS = ["US"];
+const IS_NIGHTLY_OR_UNBRANDED_BUILD = ["nightly", "default"].includes(AppConstants.MOZ_UPDATE_CHANNEL);
 
 const ONE_HOUR_IN_MS = 60 * 60 * 1000;
 
 // Determine if spocs should be shown for a geo/locale
 function showSpocs({geo}) {
   return SPOCS_GEOS.includes(geo);
 }
 
@@ -217,18 +218,18 @@ const PREFS_CONFIG = new Map([
       type: "remote",
       url: "https://snippets.cdn.mozilla.net/%STARTPAGE_VERSION%/%NAME%/%VERSION%/%APPBUILDID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/",
       updateCycleInMs: ONE_HOUR_IN_MS * 4,
       enabled: false,
     }, {
       id: "cfr",
       type: "local",
       localProvider: "CFRMessageProvider",
-      enabled: AppConstants.MOZ_UPDATE_CHANNEL !== "release",
-      cohort: 0,
+      enabled: IS_NIGHTLY_OR_UNBRANDED_BUILD,
+      cohort: IS_NIGHTLY_OR_UNBRANDED_BUILD ? "nightly" : "",
     }]),
   }],
 ]);
 
 // Array of each feed's FEEDS_CONFIG factory and values to add to PREFS_CONFIG
 const FEEDS_DATA = [
   {
     name: "aboutpreferences",
--- a/browser/components/newtab/lib/CFRMessageProvider.jsm
+++ b/browser/components/newtab/lib/CFRMessageProvider.jsm
@@ -77,16 +77,17 @@ const CFR_MESSAGES = [
         secondary: {
           label: {string_id: "cfr-doorhanger-extension-cancel-button"},
           action: {type: "CANCEL"},
         },
       },
     },
     frequency: {lifetime: 1},
     targeting: `
+      (providerCohorts.cfr in ["one_per_day_amazon", "three_per_day_amazon"]) &&
       (${JSON.stringify(AMAZON_ASSISTANT_PARAMS.existing_addons)} intersect addonsInfo.addons|keys)|length == 0 &&
       (${JSON.stringify(AMAZON_ASSISTANT_PARAMS.open_urls)} intersect topFrecentSites[.frecency >= ${AMAZON_ASSISTANT_PARAMS.min_frecency}]|mapToProperty('host'))|length > 0`,
     trigger: {id: "openURL", params: AMAZON_ASSISTANT_PARAMS.open_urls},
   },
   {
     id: "FACEBOOK_CONTAINER_1",
     template: "cfr_doorhanger",
     content: {
@@ -117,16 +118,17 @@ const CFR_MESSAGES = [
         secondary: {
           label: {string_id: "cfr-doorhanger-extension-cancel-button"},
           action: {type: "CANCEL"},
         },
       },
     },
     frequency: {lifetime: 1},
     targeting: `
+      (providerCohorts.cfr in ["one_per_day", "three_per_day", "nightly"]) &&
       (${JSON.stringify(FACEBOOK_CONTAINER_PARAMS.existing_addons)} intersect addonsInfo.addons|keys)|length == 0 &&
       (${JSON.stringify(FACEBOOK_CONTAINER_PARAMS.open_urls)} intersect topFrecentSites[.frecency >= ${FACEBOOK_CONTAINER_PARAMS.min_frecency}]|mapToProperty('host'))|length > 0`,
     trigger: {id: "openURL", params: FACEBOOK_CONTAINER_PARAMS.open_urls},
   },
   {
     id: "GOOGLE_TRANSLATE_1",
     template: "cfr_doorhanger",
     content: {
@@ -157,16 +159,17 @@ const CFR_MESSAGES = [
         secondary: {
           label: {string_id: "cfr-doorhanger-extension-cancel-button"},
           action: {type: "CANCEL"},
         },
       },
     },
     frequency: {lifetime: 1},
     targeting: `
+      (providerCohorts.cfr in ["one_per_day", "three_per_day", "nightly"]) &&
       (${JSON.stringify(GOOGLE_TRANSLATE_PARAMS.existing_addons)} intersect addonsInfo.addons|keys)|length == 0 &&
       (${JSON.stringify(GOOGLE_TRANSLATE_PARAMS.open_urls)} intersect topFrecentSites[.frecency >= ${GOOGLE_TRANSLATE_PARAMS.min_frecency}]|mapToProperty('host'))|length > 0`,
     trigger: {id: "openURL", params: GOOGLE_TRANSLATE_PARAMS.open_urls},
   },
   {
     id: "YOUTUBE_ENHANCE_1",
     template: "cfr_doorhanger",
     content: {
@@ -197,16 +200,17 @@ const CFR_MESSAGES = [
         secondary: {
           label: {string_id: "cfr-doorhanger-extension-cancel-button"},
           action: {type: "CANCEL"},
         },
       },
     },
     frequency: {lifetime: 1},
     targeting: `
+      (providerCohorts.cfr in ["one_per_day", "three_per_day", "nightly"]) &&
       (${JSON.stringify(YOUTUBE_ENHANCE_PARAMS.existing_addons)} intersect addonsInfo.addons|keys)|length == 0 &&
       (${JSON.stringify(YOUTUBE_ENHANCE_PARAMS.open_urls)} intersect topFrecentSites[.frecency >= ${YOUTUBE_ENHANCE_PARAMS.min_frecency}]|mapToProperty('host'))|length > 0`,
     trigger: {id: "openURL", params: YOUTUBE_ENHANCE_PARAMS.open_urls},
   },
   {
     id: "WIKIPEDIA_CONTEXT_MENU_SEARCH_1",
     template: "cfr_doorhanger",
     content: {
@@ -237,16 +241,17 @@ const CFR_MESSAGES = [
         secondary: {
           label: {string_id: "cfr-doorhanger-extension-cancel-button"},
           action: {type: "CANCEL"},
         },
       },
     },
     frequency: {lifetime: 1},
     targeting: `
+      (providerCohorts.cfr in ["one_per_day", "three_per_day", "nightly"]) &&
       (${JSON.stringify(WIKIPEDIA_CONTEXT_MENU_SEARCH_PARAMS.existing_addons)} intersect addonsInfo.addons|keys)|length == 0 &&
       (${JSON.stringify(WIKIPEDIA_CONTEXT_MENU_SEARCH_PARAMS.open_urls)} intersect topFrecentSites[.frecency >= ${WIKIPEDIA_CONTEXT_MENU_SEARCH_PARAMS.min_frecency}]|mapToProperty('host'))|length > 0`,
     trigger: {id: "openURL", params: WIKIPEDIA_CONTEXT_MENU_SEARCH_PARAMS.open_urls},
   },
   {
     id: "REDDIT_ENHANCEMENT_1",
     template: "cfr_doorhanger",
     content: {
@@ -277,16 +282,17 @@ const CFR_MESSAGES = [
         secondary: {
           label: {string_id: "cfr-doorhanger-extension-cancel-button"},
           action: {type: "CANCEL"},
         },
       },
     },
     frequency: {lifetime: 1},
     targeting: `
+      (providerCohorts.cfr in ["one_per_day", "three_per_day", "nightly"]) &&
       (${JSON.stringify(REDDIT_ENHANCEMENT_PARAMS.existing_addons)} intersect addonsInfo.addons|keys)|length == 0 &&
       (${JSON.stringify(REDDIT_ENHANCEMENT_PARAMS.open_urls)} intersect topFrecentSites[.frecency >= ${REDDIT_ENHANCEMENT_PARAMS.min_frecency}]|mapToProperty('host'))|length > 0`,
     trigger: {id: "openURL", params: REDDIT_ENHANCEMENT_PARAMS.open_urls},
   },
 ];
 
 const CFRMessageProvider = {
   getMessages() {