Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-2100, GH-2097: Onboarding test 2 #603

Merged
merged 7 commits into from Sep 22, 2020

Remove promo variant test, repurpose ping param

  • Loading branch information
leuryr committed Sep 14, 2020
commit 3f05ae27c3985bf4435aaf77e0338b63f74fadc2
@@ -1110,33 +1110,21 @@ function getAntitrackingTestConfig() {
};
}

/**
* Set option for Hub promo A/B/C test based
* on the results returned from the abtest endpoint.
* @memberOf Background
*
* @return {Object} Hub promotion configuration parameters
*/
function setupHubPromoABTest() {
if (conf.hub_promo_variant !== 'not_yet_set') return;

if (abtest.hasTest('hub_plain')) {
conf.hub_promo_variant = 'plain';
} else if (abtest.hasTest('hub_midnight')) {
conf.hub_promo_variant = 'midnight';
} else {
conf.hub_promo_variant = 'upgrade';
}
}

/**
* Set option for Hub Layout A/B test based
* on the results returned from the abtest endpoint.
* @memberOf Background
*/
function setupHubLayoutABTest() {
if (
!abtest.hasBeenFetched
|| conf.hub_layout !== 'not_yet_set'
) { return; }

if (abtest.hasTest('hub_alternate')) {
conf.hub_layout = 'alternate';
} else {
conf.hub_layout = 'default';
}
}

@@ -1161,7 +1149,6 @@ function setupABTest() {
cliqz.prefs.set('attrackBloomFilter', false);
}

setupHubPromoABTest();
setupHubLayoutABTest();
}

@@ -1771,12 +1758,9 @@ function initializeGhosteryModules() {
// We need to do this after running scheduledTasks for the first time
// because of an A/B test that determines which promo variant is shown in the Hub on install
if (globals.JUST_INSTALLED) {
// const route = ((conf.hub_promo_variant === 'upgrade' || conf.hub_promo_variant === 'not_yet_set') && !IS_ANDROID) ? '' : '#home';
// const showPremiumPromoModal = (conf.hub_promo_variant === 'midnight' && !IS_ANDROID);
const showAlternateHub = conf.hub_layout === 'alternate';
const route = conf.hub_layout === 'alternate' ? '#home' : '';
This conversation was marked as resolved by wlycdgr

This comment has been minimized.

@wlycdgr

wlycdgr Sep 15, 2020
Member

You can use the showAlternateHub bool here, no?

This comment has been minimized.

@leuryr

leuryr Sep 16, 2020
Author Contributor

Yep, definitely! Cleans the code up a bit.

chrome.tabs.create({
// url: chrome.runtime.getURL(`./app/templates/hub.html?$justInstalled=true&pm=${showPremiumPromoModal}${route}`),
url: chrome.runtime.getURL(`./app/templates/hub.html?$justInstalled=true&ah=${showAlternateHub}${route}`),
active: true
});
@@ -27,6 +27,7 @@ const { BROWSER_INFO, CMP_BASE_URL, EXTENSION_VERSION } = globals;
class ABTest {
constructor() {
this.tests = {};
this.hasBeenFetched = false;
}

/**
@@ -63,6 +64,7 @@ class ABTest {
(tests, test) => Object.assign(tests, { [test.name]: test.data }),
{}
);
this.hasBeenFetched = true;
} else {
log('A/B Tests: no tests found.');
}
@@ -116,8 +116,7 @@ class ConfData {
_initProperty('enable_smart_block', true);
_initProperty('expand_all_trackers', true);
_initProperty('hide_alert_trusted', false);
_initProperty('hub_promo_variant', 'not_yet_set');
_initProperty('hub_layout', 'default');
_initProperty('hub_layout', 'not_yet_set');
_initProperty('ignore_first_party', true);
_initProperty('import_callout_dismissed', true);
_initProperty('insights_promo_modal_last_seen', 0);
@@ -369,8 +369,8 @@ class Metrics {
`&th=${encodeURIComponent(Metrics._getThemeValue().toString())}` +

// New parameters for Ghostery 8.5.2
// Hub Promo variant
`&hp=${encodeURIComponent(Metrics._getHubPromoVariant().toString())}` +
// Hub Layout View
`&hp=${encodeURIComponent(Metrics._getHubLayoutView().toString())}` +
// Subscription Interval
`&si=${encodeURIComponent(Metrics._getSubscriptionInterval().toString())}` +
// Product ID Parameter
@@ -534,20 +534,18 @@ class Metrics {
}

/**
* Get the Int associated with the Hub promo variant shown on install
* Get the Int associated with the Hub layout view shown on install
* @private
* @return {number} Int associated with the Hub promo variant
* @return {number} Int associated with the Hub layout view
*/
static _getHubPromoVariant() {
const { hub_promo_variant } = conf;

switch (hub_promo_variant) {
case 'upgrade':
return 1;
case 'plain':
return 2;
case 'midnight':
return 3;
static _getHubLayoutView() {
const { hub_layout } = conf;

switch (hub_layout) {
case 'default':
return 4;
case 'alternate':
return 5;
case 'not_yet_set':
default:
return 0;
ProTip! Use n and p to navigate between commits in a pull request.