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

setup_number ping parameter #669

Merged
merged 16 commits into from Jan 29, 2021
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Change setup_number to dawn_setup_number

  • Loading branch information
benstrumeyer committed Jan 28, 2021
commit 623fc0c45fe428f2f8f988a3b3568dba88121870
@@ -65,10 +65,10 @@ const Step1_CreateAccountView = (props) => {

const [view, setView] = useState(CREATE_ACCOUNT);

const handleSkipButton = (setup_number) => {
const handleSkipButton = (dawn_setup_number) => {
setSetupStep({
setup_step: LOGIN,
setup_number,
dawn_setup_number,
origin: ONBOARDING,
});
setToast({
@@ -82,7 +82,7 @@ const Step1_CreateAccountView = (props) => {

setSetupStep({
setup_step: LOGIN,
setup_number: CREATE_ACCOUNT_SUCCESSFUL,
dawn_setup_number: CREATE_ACCOUNT_SUCCESSFUL,
origin: ONBOARDING,
});

@@ -117,10 +117,9 @@ class BlockSettingsView extends Component {
break;
}
setBlockingPolicy({ blockingPolicy });

setSetupStep({
setup_step: CHOOSE_DEFAULT_SEARCH,
setup_number: this.buildSetupNumberString(),
dawn_setup_number: this.buildSetupNumberString(),
origin: ONBOARDING
});
history.push('/onboarding/3');
@@ -148,7 +148,7 @@ class ChooseDefaultSearchView extends Component {
setDefaultSearch(chosenSearchName);
setSetupStep({
setup_step: CHOOSE_PLAN,
setup_number: mapSearchToSetupNumber[chosenSearchName],
dawn_setup_number: mapSearchToSetupNumber[chosenSearchName],
origin: ONBOARDING
});
history.push(`/${ONBOARDING}/${CHOOSE_PLAN}`);
@@ -165,9 +165,9 @@ class ChoosePlanView extends React.Component {
return t('ghostery_dawn_onboarding_choose_an_option');
};

setSetupStepAndMoveToSuccessView = (setup_number) => {
setSetupStepAndMoveToSuccessView = (dawn_setup_number) => {
const { setSetupStep, history } = this.props;
setSetupStep({ setup_step: CHOOSE_PLAN, setup_number, origin: ONBOARDING });
setSetupStep({ setup_step: CHOOSE_PLAN, dawn_setup_number, origin: ONBOARDING });
history.push('/onboarding/5');
}

@@ -224,7 +224,7 @@ class ChoosePlanView extends React.Component {
</div>
</div>
{showCTAButton && (
<NavLink className="ChoosePlanView__searchCTAButton" to="/onboarding/5" onClick={() => setSetupStep({ setup_step: CHOOSE_PLAN, setup_number: PLUS_SUBSCRIBER_KEEP_SUBSCRIPTION, origin: ONBOARDING })}>
<NavLink className="ChoosePlanView__searchCTAButton" to="/onboarding/5" onClick={() => setSetupStep({ setup_step: CHOOSE_PLAN, dawn_setup_number: PLUS_SUBSCRIBER_KEEP_SUBSCRIPTION, origin: ONBOARDING })}>
<span>{t('ghostery_dawn_onboarding_keep')}</span>
</NavLink>
)}
@@ -380,7 +380,7 @@ class ChoosePlanView extends React.Component {
{(isBasic && (
<div className="ChoosePlanView__ctaButtonContainer">
{(selectedPlan === BASIC) && (
<NavLink className="ChoosePlanView__searchCTAButton" to="/onboarding/5" onClick={() => setSetupStep({ setup_step: CHOOSE_PLAN, setup_number: FREE_USER_NO_TRIAL, origin: ONBOARDING })}>
<NavLink className="ChoosePlanView__searchCTAButton" to="/onboarding/5" onClick={() => setSetupStep({ setup_step: CHOOSE_PLAN, dawn_setup_number: FREE_USER_NO_TRIAL, origin: ONBOARDING })}>
<span>{t('next_or_start_trial')}</span>
</NavLink>
)}
@@ -393,7 +393,7 @@ class ChoosePlanView extends React.Component {
</div>
))}
{isPremium && (
<NavLink className="ChoosePlanView__searchCTAButton" to="/onboarding/5" onClick={() => setSetupStep({ setup_step: CHOOSE_PLAN, setup_number: PREMIUM_SUBSCRIBER_KEEP_SUBSCRIPTION, origin: ONBOARDING })}>
<NavLink className="ChoosePlanView__searchCTAButton" to="/onboarding/5" onClick={() => setSetupStep({ setup_step: CHOOSE_PLAN, dawn_setup_number: PREMIUM_SUBSCRIBER_KEEP_SUBSCRIPTION, origin: ONBOARDING })}>
<span>{t('next')}</span>
</NavLink>
)}
@@ -524,7 +524,7 @@ function handleGhosteryHub(name, message, callback) {
const origin = message.origin || '';
if (origin === 'onboarding') {
conf.setup_step = message.setup_step;
conf.setup_number = message.setup_number;
conf.dawn_setup_number = message.dawn_setup_number;
metrics.ping('gb_onboarding');
}
callback({ setup_step });
@@ -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);
@@ -292,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
@@ -414,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.
*
ProTip! Use n and p to navigate between commits in a pull request.