diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 51fc98d76..765174e11 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2436,7 +2436,7 @@ "ghostery_dawn_onboarding_select_option": { "message": "Select option" }, - "ghostery_dawn_onboarding_you_have_selected_an_alternate_serach_engine": { + "ghostery_dawn_onboarding_you_have_selected_an_alternate_search_engine": { "message": "You have selected an alternate search engine:" }, "ghostery_dawn_onboarding_create_account_for_trial": { diff --git a/app/dawn-hub/Views/OnboardingView/OnboardingConstants.js b/app/dawn-hub/Views/OnboardingView/OnboardingConstants.js index 522154ce7..71eb1e4cb 100644 --- a/app/dawn-hub/Views/OnboardingView/OnboardingConstants.js +++ b/app/dawn-hub/Views/OnboardingView/OnboardingConstants.js @@ -19,3 +19,19 @@ export const BLOCK_SETTINGS = '2'; export const CHOOSE_DEFAULT_SEARCH = '3'; export const CHOOSE_PLAN = '4'; export const SUCCESS = '5'; + +// Setup Step Constants + +// Step 1 +export const SIGN_IN_SUCCESSFUL = '1'; +export const CREATE_ACCOUNT_SUCCESSFUL = '2'; +export const SKIP_ACCOUNT_CREATION = '3'; + +// Step 4 +export const FREE_USER_NO_TRIAL = '1'; +export const FREE_USER_PLUS_TRIAL = '2'; +export const FREE_USER_PLUS_SUBSCRIPTION = '3'; +export const FREE_USER_PREMIUM_SUBSCRIPTION = '4'; +export const PLUS_SUBSCRIBER_KEEP_SUBSCRIPTION = '5'; +export const PLUS_SUBSCRIBER_PREMIUM_SUBSCRIPTION = '6'; +export const PREMIUM_SUBSCRIBER_KEEP_SUBSCRIPTION = '7'; diff --git a/app/dawn-hub/Views/OnboardingViews/Step1_CreateAccountView/Step1_CreateAccountView.jsx b/app/dawn-hub/Views/OnboardingViews/Step1_CreateAccountView/Step1_CreateAccountView.jsx index 690decabb..2d8374ef9 100644 --- a/app/dawn-hub/Views/OnboardingViews/Step1_CreateAccountView/Step1_CreateAccountView.jsx +++ b/app/dawn-hub/Views/OnboardingViews/Step1_CreateAccountView/Step1_CreateAccountView.jsx @@ -17,7 +17,13 @@ import PropTypes from 'prop-types'; import Step1_LogInForm from '../Step1_LogInForm'; import Step1_CreateAccountForm from '../Step1_CreateAccountForm'; import globals from '../../../../../src/classes/Globals'; -import { LOGIN, ONBOARDING } from '../../OnboardingView/OnboardingConstants'; +import { + LOGIN, + ONBOARDING, + SIGN_IN_SUCCESSFUL, + CREATE_ACCOUNT_SUCCESSFUL, + SKIP_ACCOUNT_CREATION +} from '../../OnboardingView/OnboardingConstants'; const SIGN_IN = 'SIGN_IN'; const CREATE_ACCOUNT = 'CREATE_ACCOUNT'; @@ -59,8 +65,12 @@ const Step1_CreateAccountView = (props) => { const [view, setView] = useState(CREATE_ACCOUNT); - const handleSkipButton = () => { - setSetupStep({ setup_step: LOGIN, origin: ONBOARDING }); + const handleSkipButton = (dawn_setup_number) => { + setSetupStep({ + setup_step: LOGIN, + dawn_setup_number, + origin: ONBOARDING, + }); setToast({ toastMessage: '', toastClass: '' @@ -70,6 +80,12 @@ const Step1_CreateAccountView = (props) => { const handleNextOnSelectPlanStep = () => { const { prev } = props; + setSetupStep({ + setup_step: LOGIN, + dawn_setup_number: CREATE_ACCOUNT_SUCCESSFUL, + origin: ONBOARDING, + }); + setToast({ toastMessage: '', toastClass: '' @@ -82,7 +98,7 @@ const Step1_CreateAccountView = (props) => {
- handleSkipButton()}> + handleSkipButton(SKIP_ACCOUNT_CREATION)}> {t('ghostery_dawn_onboarding_skip')}
@@ -99,7 +115,7 @@ const Step1_CreateAccountView = (props) => {
{email}
{step === LOGIN && ( - handleSkipButton()}> + handleSkipButton(SIGN_IN_SUCCESSFUL)}> {t('next')} )} diff --git a/app/dawn-hub/Views/OnboardingViews/Step2_BlockSettingsView/BlockSettingsView.jsx b/app/dawn-hub/Views/OnboardingViews/Step2_BlockSettingsView/BlockSettingsView.jsx index 080bb1591..b5a9c498d 100644 --- a/app/dawn-hub/Views/OnboardingViews/Step2_BlockSettingsView/BlockSettingsView.jsx +++ b/app/dawn-hub/Views/OnboardingViews/Step2_BlockSettingsView/BlockSettingsView.jsx @@ -42,7 +42,7 @@ class BlockSettingsView extends Component { this.setState({ recommendedChoices: true, blockAds: true, - kindsOfTrackers: 1, + kindsOfTrackers: 2, antiTracking: true, smartBrowsing: true }); @@ -61,6 +61,23 @@ class BlockSettingsView extends Component { this.setState({ [category]: answer }); } + // Refer to https://ghostery.atlassian.net/wiki/spaces/BI/pages/488079383/Ghostery+Browser+-+Onboarding+Pings for setup_number string formatting + buildSetupNumberString = () => { + const { + blockAds, + kindsOfTrackers, + antiTracking, + smartBrowsing + } = this.state; + + const partOne = (blockAds) ? '1' : '2'; + const partTwo = kindsOfTrackers.toString(); + const partThree = (antiTracking) ? '1' : '2'; + const partFour = (smartBrowsing) ? '1' : '2'; + + return `${partOne}${partTwo}${partThree}${partFour}`; + } + handleSubmit = () => { const { blockAds, kindsOfTrackers, antiTracking, smartBrowsing @@ -87,21 +104,24 @@ class BlockSettingsView extends Component { let blockingPolicy; switch (kindsOfTrackers) { - case 0: + case 1: blockingPolicy = 'BLOCKING_POLICY_EVERYTHING'; break; - case 1: + case 2: blockingPolicy = 'BLOCKING_POLICY_RECOMMENDED'; break; - case 2: + case 3: blockingPolicy = 'BLOCKING_POLICY_NOTHING'; break; default: break; } setBlockingPolicy({ blockingPolicy }); - - setSetupStep({ setup_step: CHOOSE_DEFAULT_SEARCH, origin: ONBOARDING }); + setSetupStep({ + setup_step: CHOOSE_DEFAULT_SEARCH, + dawn_setup_number: this.buildSetupNumberString(), + origin: ONBOARDING + }); history.push('/onboarding/3'); } else { setToast({ @@ -160,9 +180,9 @@ class BlockSettingsView extends Component {
- {this.renderAnswerBlock((kindsOfTrackers === 0), 'kindsOfTrackers', 0, t('ghostery_dawn_onboarding_kinds_of_trackers_all'))} - {this.renderAnswerBlock((kindsOfTrackers === 1), 'kindsOfTrackers', 1, t('ghostery_dawn_onboarding_kinds_of_trackers_ad_and_analytics'))} - {this.renderAnswerBlock((kindsOfTrackers === 2), 'kindsOfTrackers', 2, t('ghostery_dawn_onboarding_kinds_of_trackers_none'))} + {this.renderAnswerBlock((kindsOfTrackers === 1), 'kindsOfTrackers', 1, t('ghostery_dawn_onboarding_kinds_of_trackers_all'))} + {this.renderAnswerBlock((kindsOfTrackers === 2), 'kindsOfTrackers', 2, t('ghostery_dawn_onboarding_kinds_of_trackers_ad_and_analytics'))} + {this.renderAnswerBlock((kindsOfTrackers === 3), 'kindsOfTrackers', 3, t('ghostery_dawn_onboarding_kinds_of_trackers_none'))}
  • {t('ghostery_dawn_onboarding_question_anti_tracking')} diff --git a/app/dawn-hub/Views/OnboardingViews/Step3_ChooseDefaultSearchView/ChooseDefaultSearchConstants.js b/app/dawn-hub/Views/OnboardingViews/Step3_ChooseDefaultSearchView/ChooseDefaultSearchConstants.js index e1cbe5caf..29a6ad199 100644 --- a/app/dawn-hub/Views/OnboardingViews/Step3_ChooseDefaultSearchView/ChooseDefaultSearchConstants.js +++ b/app/dawn-hub/Views/OnboardingViews/Step3_ChooseDefaultSearchView/ChooseDefaultSearchConstants.js @@ -15,5 +15,15 @@ export const SET_DEFAULT_SEARCH = 'SET_DEFAULT_SEARCH'; export const SEARCH_GHOSTERY = 'Ghostery'; export const SEARCH_BING = 'Bing'; export const SEARCH_YAHOO = 'Yahoo'; -export const SEARCH_STARTPAGE = 'Startpage'; +export const SEARCH_STARTPAGE = 'StartPage'; +export const SEARCH_DUCKDUCK_GO = 'DuckDuckGo'; +export const SEARCH_ECOSIA = 'Ecosia Search'; +export const SEARCH_EKORU = 'ekoru'; +export const SEARCH_GIBIRU = 'Gibiru.com'; +export const SEARCH_GOOGLE = 'Google'; +export const SEARCH_ONESEARCH = 'OneSearch'; +export const SEARCH_PRIVADO = 'Privado'; +export const SEARCH_QWANT = 'Qwant'; +export const SEARCH_ENCRYPT = 'TODO: Add Search Encrypt browser.search.get() string'; +export const SEARCH_TAILCAT = 'Tailcat'; export const SEARCH_OTHER = t('ghostery_dawn_onboarding_other'); diff --git a/app/dawn-hub/Views/OnboardingViews/Step3_ChooseDefaultSearchView/ChooseDefaultSearchView.jsx b/app/dawn-hub/Views/OnboardingViews/Step3_ChooseDefaultSearchView/ChooseDefaultSearchView.jsx index c3146ab3e..d03be3975 100644 --- a/app/dawn-hub/Views/OnboardingViews/Step3_ChooseDefaultSearchView/ChooseDefaultSearchView.jsx +++ b/app/dawn-hub/Views/OnboardingViews/Step3_ChooseDefaultSearchView/ChooseDefaultSearchView.jsx @@ -18,13 +18,40 @@ import RadioButton from '../../../../shared-components/RadioButton'; import { ONBOARDING, CHOOSE_PLAN } from '../../OnboardingView/OnboardingConstants'; import { SEARCH_GHOSTERY, + SEARCH_BING, SEARCH_YAHOO, SEARCH_STARTPAGE, - SEARCH_BING, + SEARCH_DUCKDUCK_GO, + SEARCH_ECOSIA, + SEARCH_EKORU, + SEARCH_GIBIRU, + SEARCH_GOOGLE, + SEARCH_ONESEARCH, + SEARCH_PRIVADO, + SEARCH_QWANT, + SEARCH_ENCRYPT, + SEARCH_TAILCAT, SEARCH_OTHER } from './ChooseDefaultSearchConstants'; import { Modal } from '../../../../shared-components'; +const searchSetupNumbers = [ + { name: SEARCH_GHOSTERY, dawn_setup_number: 1 }, + { name: SEARCH_BING, dawn_setup_number: 2 }, + { name: SEARCH_YAHOO, dawn_setup_number: 3 }, + { name: SEARCH_STARTPAGE, dawn_setup_number: 4 }, + { name: SEARCH_GOOGLE, dawn_setup_number: 5 }, + { name: SEARCH_DUCKDUCK_GO, dawn_setup_number: 6 }, + { name: SEARCH_ECOSIA, dawn_setup_number: 7 }, + { name: SEARCH_EKORU, dawn_setup_number: 8 }, + { name: SEARCH_GIBIRU, dawn_setup_number: 9 }, + { name: SEARCH_ONESEARCH, dawn_setup_number: 10 }, + { name: SEARCH_PRIVADO, dawn_setup_number: 11 }, + { name: SEARCH_QWANT, dawn_setup_number: 12 }, + { name: SEARCH_ENCRYPT, dawn_setup_number: 13 }, + { name: SEARCH_TAILCAT, dawn_setup_number: 14 }, +]; + class ChooseDefaultSearchView extends Component { constructor(props) { super(props); @@ -42,6 +69,16 @@ class ChooseDefaultSearchView extends Component { this.fetchSearchEnginesAsync = this.fetchSearchEnginesAsync.bind(this); } + componentDidMount() { + document.addEventListener('click', this.handleClickAway); + + this.fetchSearchEnginesAsync(); + } + + componentWillUnmount() { + document.removeEventListener('click', this.handleClickAway); + } + async fetchSearchEnginesAsync() { // eslint-disable-next-line no-undef if (typeof browser === 'undefined' || typeof browser.search === 'undefined') { // we are not in Dawn @@ -67,16 +104,6 @@ class ChooseDefaultSearchView extends Component { })); } - componentDidMount() { - document.addEventListener('click', this.handleClickAway); - - this.fetchSearchEnginesAsync(); - } - - componentWillUnmount() { - document.removeEventListener('click', this.handleClickAway); - } - updateSelection = () => this.setState(prevState => ( { chosenSearch: prevState.searchBeingConsidered, @@ -129,7 +156,12 @@ class ChooseDefaultSearchView extends Component { } setDefaultSearch(chosenSearchName); - setSetupStep({ setup_step: CHOOSE_PLAN, origin: ONBOARDING }); + + setSetupStep({ + setup_step: CHOOSE_PLAN, + dawn_setup_number: searchSetupNumbers.find(elem => elem.name === chosenSearchName).dawn_setup_number, + origin: ONBOARDING + }); history.push(`/${ONBOARDING}/${CHOOSE_PLAN}`); } @@ -254,7 +286,7 @@ class ChooseDefaultSearchView extends Component { {(searchBeingConsidered === SEARCH_OTHER) && ( { - `${t('ghostery_dawn_onboarding_you_have_selected_an_alternate_serach_engine')} \n + `${t('ghostery_dawn_onboarding_you_have_selected_an_alternate_search_engine')} \n ${otherSearchSelected}` } diff --git a/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/ChoosePlanView.jsx b/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/ChoosePlanView.jsx index 6cdcf2fe0..ef30f888c 100644 --- a/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/ChoosePlanView.jsx +++ b/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/ChoosePlanView.jsx @@ -18,7 +18,17 @@ import PropTypes from 'prop-types'; import RadioButton from '../../../../shared-components/RadioButton'; import globals from '../../../../../src/classes/Globals'; import { BASIC, PLUS, PREMIUM } from '../../../../hub/Views/UpgradePlanView/UpgradePlanViewConstants'; -import { CHOOSE_PLAN, ONBOARDING } from '../../OnboardingView/OnboardingConstants'; +import { + CHOOSE_PLAN, + ONBOARDING, + FREE_USER_NO_TRIAL, + FREE_USER_PLUS_TRIAL, + FREE_USER_PLUS_SUBSCRIPTION, + FREE_USER_PREMIUM_SUBSCRIPTION, + PLUS_SUBSCRIBER_KEEP_SUBSCRIPTION, + PLUS_SUBSCRIBER_PREMIUM_SUBSCRIPTION, + PREMIUM_SUBSCRIBER_KEEP_SUBSCRIPTION +} from '../../OnboardingView/OnboardingConstants'; import { SEARCH_GHOSTERY } from '../Step3_ChooseDefaultSearchView/ChooseDefaultSearchConstants'; const plusCheckoutLink = `${globals.CHECKOUT_BASE_URL}/en/plus`; @@ -77,72 +87,6 @@ const basicCard = (checked, handleClick) => { ); }; -const premiumCard = (checked, handleClick, showCTAButton = false) => { - const cardClassNames = ClassNames('ChoosePlanView__card premium', { - checked - }); - return ( - -
    -
    -
    - -
    -
    -
    -
    -
    -

    Ghostery Premium

    -
    - -

    $11.99

    -

    {t('per_month')}

    -
    -
    -

    {t('hub_upgrade_maximum_protection')}

    -
    -
    - - {t('ghostery_dawn_onboarding_private_search')} -
    -
    - - {t('ghostery_dawn_onboarding_tracker_protection')} -
    -
    - - {t('ghostery_dawn_onboarding_speedy_page_loads')} -
    -
    - - {t('ghostery_dawn_onboarding_intelligence_technology')} -
    -
    - - {t('ghostery_dawn_onboarding_ad_free')} -
    -
    - - {t('ghostery_dawn_onboarding_supports_ghosterys_mission')} -
    -
    - - VPN -
    -
    - - {t('ghostery_dawn_onboarding_unlimited_bandwidth')} -
    -
    -
    -
    - {showCTAButton && ( - {t('ghostery_dawn_onboarding_upgrade')} - )} - - ); -}; - class ChoosePlanView extends React.Component { constructor(props) { super(props); @@ -221,6 +165,13 @@ class ChoosePlanView extends React.Component { return t('ghostery_dawn_onboarding_choose_an_option'); }; + setSetupStepAndMoveToSuccessView = (dawn_setup_number) => { + const { actions, history } = this.props; + const { setSetupStep } = actions; + setSetupStep({ setup_step: CHOOSE_PLAN, dawn_setup_number, origin: ONBOARDING }); + history.push('/onboarding/5'); + } + plusCard = (checked, handleClick, showCTAButton = false) => { const { actions } = this.props; const { setSetupStep } = actions; @@ -274,7 +225,7 @@ class ChoosePlanView extends React.Component {
    {showCTAButton && ( - setSetupStep({ setup_step: CHOOSE_PLAN, origin: ONBOARDING })}> + setSetupStep({ setup_step: CHOOSE_PLAN, dawn_setup_number: PLUS_SUBSCRIBER_KEEP_SUBSCRIPTION, origin: ONBOARDING })}> {t('ghostery_dawn_onboarding_keep')} )} @@ -282,12 +233,78 @@ class ChoosePlanView extends React.Component { ); }; + premiumCard = (checked, handleClick, showCTAButton = false) => { + const cardClassNames = ClassNames('ChoosePlanView__card premium', { + checked + }); + return ( + +
    +
    +
    + +
    +
    +
    +
    +
    +

    Ghostery Premium

    +
    + +

    $11.99

    +

    {t('per_month')}

    +
    +
    +

    {t('hub_upgrade_maximum_protection')}

    +
    +
    + + {t('ghostery_dawn_onboarding_private_search')} +
    +
    + + {t('ghostery_dawn_onboarding_tracker_protection')} +
    +
    + + {t('ghostery_dawn_onboarding_speedy_page_loads')} +
    +
    + + {t('ghostery_dawn_onboarding_intelligence_technology')} +
    +
    + + {t('ghostery_dawn_onboarding_ad_free')} +
    +
    + + {t('ghostery_dawn_onboarding_supports_ghosterys_mission')} +
    +
    + + VPN +
    +
    + + {t('ghostery_dawn_onboarding_unlimited_bandwidth')} +
    +
    +
    +
    + {showCTAButton && ( + this.setSetupStepAndMoveToSuccessView(PLUS_SUBSCRIBER_PREMIUM_SUBSCRIPTION)}>{t('ghostery_dawn_onboarding_upgrade')} + )} + + ); + }; + render() { const { actions, defaultSearch, loggedIn, - next, + history, user, } = this.props; const { setSetupStep } = actions; @@ -325,11 +342,12 @@ class ChoosePlanView extends React.Component { and move them to Step 5 if signed in 2. DONE If user is signed out, clicking this should take them to Step 4b */} + {/* May have to change the below links depending on GH-2248 */} {loggedIn && ( - {t('ghostery_dawn_onboarding_start_trial')} + this.setSetupStepAndMoveToSuccessView(FREE_USER_PLUS_TRIAL)}>{t('ghostery_dawn_onboarding_start_trial')} )} {!loggedIn && ( -
    next()}>{t('ghostery_dawn_onboarding_start_trial')}
    +
    this.setSetupStepAndMoveToSuccessView(FREE_USER_PLUS_TRIAL)}>{t('ghostery_dawn_onboarding_start_trial')}
    )}
    {t('ghostery_dawn_onboarding_see_all_plans')}
    @@ -344,7 +362,7 @@ class ChoosePlanView extends React.Component {
    {t('ghostery_dawn_onboarding_or')}
    - {premiumCard(this.isPremiumPlanChecked(), this.selectPremiumPlan, isPlus)} + {this.premiumCard(this.isPremiumPlanChecked(), this.selectPremiumPlan, isPlus)}
    ) : ( @@ -357,26 +375,26 @@ class ChoosePlanView extends React.Component { {this.plusCard(this.isPlusPlanChecked(), this.selectPlusPlan)} )} - {premiumCard(this.isPremiumPlanChecked(), this.selectPremiumPlan)} + {this.premiumCard(this.isPremiumPlanChecked(), this.selectPremiumPlan)}
    )} {(isBasic && (
    {(selectedPlan === BASIC) && ( - setSetupStep({ setup_step: CHOOSE_PLAN, origin: ONBOARDING })}> + setSetupStep({ setup_step: CHOOSE_PLAN, dawn_setup_number: FREE_USER_NO_TRIAL, origin: ONBOARDING })}> {t('next_or_start_trial')} )} {selectedPlan === PLUS && ( - {t('next_or_start_trial')} + this.setSetupStepAndMoveToSuccessView(FREE_USER_PLUS_SUBSCRIPTION)} href={plusCheckoutLink} target="_blank" rel="noreferrer">{t('next_or_start_trial')} )} {selectedPlan === PREMIUM && ( - {t('next_or_start_trial')} + this.setSetupStepAndMoveToSuccessView(FREE_USER_PREMIUM_SUBSCRIPTION)} href={premiumCheckoutLink} target="_blank" rel="noreferrer">{t('next_or_start_trial')} )}
    ))} {isPremium && ( - setSetupStep({ setup_step: CHOOSE_PLAN, origin: ONBOARDING })}> + setSetupStep({ setup_step: CHOOSE_PLAN, dawn_setup_number: PREMIUM_SUBSCRIBER_KEEP_SUBSCRIPTION, origin: ONBOARDING })}> {t('next')} )} diff --git a/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/index.jsx b/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/index.jsx index 535df2203..aae3575df 100644 --- a/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/index.jsx +++ b/app/dawn-hub/Views/OnboardingViews/Step4_ChoosePlanView/index.jsx @@ -11,6 +11,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0 */ +import { withRouter } from 'react-router-dom'; import { buildReduxHOC } from '../../../../shared-hub/utils'; import ChoosePlanView from './ChoosePlanView'; import { setSetupStep } from '../../../../shared-hub/actions/SetupLifecycleActions'; @@ -19,4 +20,4 @@ const actionCreators = { setSetupStep, }; -export default buildReduxHOC(['account', 'defaultSearch'], actionCreators, ChoosePlanView); +export default withRouter(buildReduxHOC(['account', 'defaultSearch'], actionCreators, ChoosePlanView)); diff --git a/app/ghostery-browser-hub/Views/OnboardingView/OnboardingConstants.js b/app/ghostery-browser-hub/Views/OnboardingView/OnboardingConstants.js new file mode 100644 index 000000000..bc88ffb5c --- /dev/null +++ b/app/ghostery-browser-hub/Views/OnboardingView/OnboardingConstants.js @@ -0,0 +1,16 @@ +/** +Constants for Ghostery Browser Intro Hub Onboarding +These constants map the onboarding step numbers to more memorable names + */ + +export const ONBOARDING = 'onboarding'; +export const WELCOME = '0'; +export const LOGIN = '1'; +export const BLOCK_SETTINGS = '2'; +export const CHOOSE_DEFAULT_SEARCH = '3'; +export const CHOOSE_PLAN = '4'; +export const SUCCESS = '5'; + +export const SIGN_IN_SUCCESSFUL = '1'; +export const CREATE_ACCOUNT_SUCCESSFUL = '2'; +export const SKIP_ACCOUNT_CREATION = '3'; diff --git a/src/background.js b/src/background.js index eef3f5aec..f49416e1d 100644 --- a/src/background.js +++ b/src/background.js @@ -524,6 +524,7 @@ function handleGhosteryHub(name, message, callback) { const origin = message.origin || ''; if (origin === 'onboarding') { conf.setup_step = message.setup_step; + conf.dawn_setup_number = message.dawn_setup_number; metrics.ping('gb_onboarding'); } callback({ setup_step }); diff --git a/src/classes/ConfData.js b/src/classes/ConfData.js index 1136261e3..c12bc6bd7 100644 --- a/src/classes/ConfData.js +++ b/src/classes/ConfData.js @@ -146,6 +146,7 @@ class ConfData { _initProperty('setup_step', 7); _initProperty('setup_show_warning_override', true); _initProperty('setup_number', 0); + _initProperty('dawn_setup_number', '0'); _initProperty('setup_block', 1); _initProperty('setup_complete', false); _initProperty('tutorial_complete', false); diff --git a/src/classes/Metrics.js b/src/classes/Metrics.js index 69cf8ab9d..2f2598f55 100644 --- a/src/classes/Metrics.js +++ b/src/classes/Metrics.js @@ -257,7 +257,8 @@ class Metrics { this._buildQueryPair('id', conf.install_date) + // Showing campaign messages (former show_cmp) this._buildQueryPair('sc', conf.show_cmp ? '1' : '0') + - // Subscription Typerics._getSubscriptionType().toString()) + + // Subscription Type + this._buildQueryPair('st', Metrics._getSubscriptionType().toString()) + // New parameters for Ghostery 8.5.2 // Subscription Interval @@ -291,8 +292,8 @@ class Metrics { this._buildQueryPair('at', conf.enable_anti_tracking ? '1' : '0') + // The deepest setup page reached by user during setup this._buildQueryPair('ss', Metrics._getSetupStep(type).toString()) + - // The number of times the user has gone through setup - this._buildQueryPair('sl', conf.setup_number.toString()) + + // The number of times the user has gone through setup in the regular hub, or the answer selection on each page of the dawn-hub + this._buildQueryPair('sl', Metrics._getSetupNumber(type).toString()) + // Type of blocking selected during setup this._buildQueryPair('sb', conf.setup_block.toString()) + // Recency, days since last active daily ping @@ -413,6 +414,18 @@ class Metrics { return -1; } + /** + * Get the Setup Number + * + * @private + * + * @return {number} The number of times the user has gone through setup in the regular hub, or the answer selection on each page of the dawn-hub + */ + static _getSetupNumber(type) { + const { setup_number, dawn_setup_number } = conf; + return (type === 'gb_onboarding') ? dawn_setup_number : setup_number; + } + /** * Calculate days since the last daily active ping. *