-
Notifications
You must be signed in to change notification settings - Fork 205
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
Breach Results FxA Experiment (Growth Exp 3) #1659
Conversation
869c1b5
to
d388fec
Compare
06e6bf6
to
8e30527
Compare
a0d2f3b
to
624f98a
Compare
let experimentBranch = null; | ||
let isUserInExperiment = null; | ||
let experimentBranchB = null; | ||
|
||
|
||
if (EXPERIMENTS_ENABLED) { | ||
const coinFlipNumber = Math.floor(Math.random() * 100); | ||
experimentBranch = getExperimentBranch(req, coinFlipNumber); | ||
// req.session.excludeFromExperiment is set to remember that the user has been excluded from the experiment. | ||
if (!experimentBranch) { req.session.excludeFromExperiment = true; } | ||
req.session.experimentBranch = experimentBranch; | ||
isUserInExperiment = (experimentBranch === "vb"); | ||
experimentBranchB = (experimentBranch === "vb" && isUserInExperiment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the experiment doesn't split until the scans page, this has been removed.
@@ -230,6 +232,20 @@ async function getDashboard(req, res) { | |||
const allBreaches = req.app.locals.breaches; | |||
const { verifiedEmails, unverifiedEmails } = await getAllEmailsAndBreaches(user, allBreaches); | |||
|
|||
let experimentBranch = null; | |||
let isUserInExperiment = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds the experiment branch/meta UTM info to the /user/dashboard
page.
// If we cannot parse req.headers["accept-language"], we should not | ||
// enroll users in the experiment. | ||
if (!req.headers || !req.headers["accept-language"]){ | ||
log.debug("No headers or accept-language information present."); | ||
return false; | ||
} | ||
|
||
// If the user doesn't have an English variant langauge selected as their primary language, | ||
// we do not enroll them in the experiment. | ||
const lang = req.headers["accept-language"].split(","); | ||
if (!lang[0].includes("en")) { | ||
log.debug("Preferred language is not English variant: ", lang[0]); | ||
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because all the assets in this experiment are already localized, this experiment does not have any language qualifies during cohort assignment.
controllers/user.js
Outdated
|
||
if (EXPERIMENTS_ENABLED) { | ||
const coinFlipNumber = Math.floor(Math.random() * 100); | ||
experimentBranch = getExperimentBranch(req, coinFlipNumber); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like if someone never does a scan, but gets straight to their dashboard, they'll be put into an experiment?
Spot-checked scan, sign-up, sign-in, and add additional emails. All work fine. Just the 1 question/comment about the experiment logic being in the dashboard, when the experiment only affects the scan results page. |
@groovecoder I updated the user controller per your request. Thanks! |
…ent options as it was breaking analytics reporting in Chrome environments.
…nality, except for when a user passes a URL param.
…ly set meta info on the page if the user has already been sorted into the experiment.
7eff601
to
bf8a6e3
Compare
Rebased. Merging after checks pass one final time. |
Meta Issue: #1652
Steps to Verify:
Control
name@example.com
Treatment
name@example.com