Skip to content

Commit

Permalink
Merge pull request #1748 from mozilla/1747-remove-homepage-fxa-experi…
Browse files Browse the repository at this point in the history
…ment

Remove I10N Homepage FxA Experiment
  • Loading branch information
groovecoder authored Jun 22, 2020
2 parents 992dc79 + 98195c5 commit c42bee0
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 128 deletions.
10 changes: 1 addition & 9 deletions controllers/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const AppConstants = require("../app-constants");
const DB = require("../db/DB");
const HIBP = require("../hibp");
const { scanResult } = require("../scan-results");
const { generatePageToken, getExperimentBranch, getExperimentFlags } = require("./utils");
const { generatePageToken, getExperimentFlags } = require("./utils");

const EXPERIMENTS_ENABLED = (AppConstants.EXPERIMENT_ACTIVE === "1");

Expand Down Expand Up @@ -32,14 +32,6 @@ async function home(req, res) {

const experimentFlags = getExperimentFlags(req, EXPERIMENTS_ENABLED);

// Growth Experiment
if (EXPERIMENTS_ENABLED) {
getExperimentBranch(req, false, ["de", "fr"], {
"va": 25,
"vb": 25,
});
}

if (req.query.breach) {
featuredBreach = _getFeaturedBreach(req.app.locals.breaches, req.query.breach);

Expand Down
20 changes: 0 additions & 20 deletions controllers/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ const sha1 = require("../sha1-utils");

const log = mozlog("controllers.oauth");

// Growth Experiment
const utmArray = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];

function getUTMNames() {
return utmArray;
}

function init(req, res, next, client = FxAOAuthClient) {
// Set a random state string in a cookie so that we can verify
// the user when they're redirected back to us after auth.
Expand All @@ -35,10 +28,6 @@ function init(req, res, next, client = FxAOAuthClient) {
url.searchParams.append("action", "email");

for (const param of fxaParams.searchParams.keys()) {
// Growth Experiment
if (utmArray.includes(param)) {
req.session.utmContents[param] = fxaParams.searchParams.get(param);
}
url.searchParams.append(param, fxaParams.searchParams.get(param));
}

Expand Down Expand Up @@ -68,15 +57,6 @@ async function confirmed(req, res, next, client = FxAOAuthClient) {

const returnURL = new URL("/user/dashboard", AppConstants.SERVER_URL);

// Growth Experiment
if (req.session.utmContents) {
getUTMNames().forEach(param => {
if (req.session.utmContents[param]) {
returnURL.searchParams.append(param, req.session.utmContents[param]);
}
});
}

// Check if user is signing up or signing in,
// then add new users to db and send email.
if (!existingUser || existingUser.fxa_refresh_token === null) {
Expand Down
13 changes: 0 additions & 13 deletions controllers/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ async function getDashboard(req, res) {
const allBreaches = req.app.locals.breaches;
const { verifiedEmails, unverifiedEmails } = await getAllEmailsAndBreaches(user, allBreaches);

// Growth Experiment
const experimentFlags = getExperimentFlags(req, EXPERIMENTS_ENABLED);

let lastAddedEmail = null;
Expand Down Expand Up @@ -562,18 +561,6 @@ async function getBreachStats(req, res) {


function logout(req, res) {
// Growth Experiment
if (EXPERIMENTS_ENABLED && req.session.experimentFlags) {
// Persist experimentBranch across session reset
const sessionExperimentFlags = req.session.experimentFlags;
req.session.reset();
req.session.experimentFlags = sessionExperimentFlags;

// Return
res.redirect("/");
return;
}

req.session.reset();
res.redirect("/");
}
Expand Down
24 changes: 0 additions & 24 deletions public/js/fxa-analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,6 @@ function setGAListeners(){
});
});

// Growth Experiment
if (document.body.dataset.experiment) {
document.querySelectorAll(".ga-growth-ping").forEach((el) => {
el.addEventListener("click", async(e) => {
// Overwrite current event category for active OAuth buttons
if (el.dataset.eventCategory !== "fxa-oauth") {
el.dataset.eventCategory = "fxa-oauth";
}
await sendPing(el, "Click", el.dataset.eventLabel, {transport: "beacon"});
});
});
}

}

window.sessionStorage.setItem("gaInit", true);
Expand Down Expand Up @@ -214,17 +201,6 @@ function setGAListeners(){
ga("set", "anonymizeIp", true);
ga("set", "dimension6", `${document.body.dataset.signedInUser}`);

// Growth Experiment
if (document.body.dataset.experiment) {
// If an experiment is active, set the "Growth Experiment Version"
// Custom Dimension to whichever branch is active.
ga("set", "dimension7", `${document.body.dataset.experiment}`);
ga("set", "dimension8", `${document.body.dataset.experiment}`);
ga("set", "dimension9", `${document.body.dataset.utm_campaign}`);
ga("set", "campaignName", `${document.body.dataset.utm_campaign}`);
ga("set", "campaignKeyword", `${document.body.dataset.utm_term}`);
}

ga("send", "pageview", {
hitCallback: function() {
removeUtmsFromUrl();
Expand Down
58 changes: 2 additions & 56 deletions public/js/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
/* global sendRecommendationPings */
/* global ga */

const utmParams = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content" ];

if (typeof TextEncoder === "undefined") {
const cryptoScript = document.createElement("script");
const scripts = document.getElementsByTagName("script")[0];
Expand Down Expand Up @@ -64,35 +62,6 @@ function doOauth(el, {emailWatch = false} = {}) {
}
});

// Growth Experiment: OAuth Entry Point IDs are unique to the experiment.
const oAuthEntryPointIds = [
"fx-monitor-check-for-breaches-blue-btn",
"fx-monitor-find-out-blue-btn",
"fx-monitor-alert-me-blue-btn-top",
"fx-monitor-alert-me-blue-btn-bottom",
];

if (oAuthEntryPointIds.includes(el.dataset.entrypoint)) {
// Growth Experiment: Reset UTMs from in-line body tag data elements.
utmParams.forEach(key => {
if (document.body.dataset[key]) {
url.searchParams.delete(key);
url.searchParams.append(key, document.body.dataset[key]);
}
});

if (typeof(ga) !== "undefined" && document.body.dataset.experiment) {
ga("send", {
hitType: "event",
eventCategory: document.body.dataset.utm_campaign,
eventAction: document.body.dataset.experiment,
eventLabel: el.dataset.entrypoint,
transport: "beacon",
});
}

}

if (!sessionStorage) {
window.location.assign(url);
return;
Expand Down Expand Up @@ -172,26 +141,6 @@ function handleFormSubmits(formEvent) {

const formClassList = thisForm.classList;

// Growth Experiment
if (formClassList.contains("skip")) {
return;
}

// Growth Experiment
if (document.body.dataset.experiment) {
const scanFormActionURL = new URL(thisForm.action);

utmParams.forEach(key => {
if (document.body.dataset[key]) {
scanFormActionURL.searchParams.append(key, document.body.dataset[key]);
}
});

const revisedActionURL = scanFormActionURL.pathname + scanFormActionURL.search;

thisForm.action = revisedActionURL.toString();
}

if (thisForm.email && !isValidEmail(email)) {
sendPing(thisForm, "Failure");
formClassList.add("invalid");
Expand Down Expand Up @@ -489,11 +438,8 @@ function resizeDashboardMargin() {
const acceptedFirstLanguageIsEnglish = acceptedLanguages[0].includes("en");

if (!acceptedFirstLanguageIsEnglish && document.getElementById("fxaCheckbox")) {
// Growth Experiment -This overrides the language filter if they've been sorted into the treatment cohort.
if (document.body.dataset.experiment !== "vb" || !document.body.dataset.experiment) {
document.getElementById("fxaCheckbox").style.display = "none";
return;
}
document.getElementById("fxaCheckbox").style.display = "none";
return;
}

const createFxaCheckbox = document.getElementById("createFxaCheckbox");
Expand Down
2 changes: 0 additions & 2 deletions scan-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const { URL } = require("url");
const HIBP = require("./hibp");
const sha1 = require("./sha1-utils");

// Growth Experiment
const AppConstants = require("./app-constants");
const EXPERIMENTS_ENABLED = (AppConstants.EXPERIMENT_ACTIVE === "1");
const { getExperimentFlags } = require("./controllers/utils");
Expand All @@ -15,7 +14,6 @@ const scanResult = async(req, selfScan=false) => {
const allBreaches = req.app.locals.breaches;
let scannedEmail = null;

// Growth Experiment
const experimentFlags = getExperimentFlags(req, EXPERIMENTS_ENABLED);

const title = req.fluentFormat("scan-title");
Expand Down
2 changes: 1 addition & 1 deletion views/layouts/default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<link rel="icon" href="/img/favicons/favicon-128.png" sizes="128x128" />
<link rel="icon" href="/img/favicons/favicon-256.png" sizes="256x256" />
</head>
<body {{> analytics/default_dataset }} data-bento-app-id="fx-monitor" {{#if experimentFlags.experimentBranch }} {{> analytics/experiment }} {{/if}}>
<body {{> analytics/default_dataset }} data-bento-app-id="fx-monitor">
{{> header/header }}
{{{ body }}}
{{> footer }}
Expand Down
3 changes: 0 additions & 3 deletions views/partials/analytics/experiment.hbs

This file was deleted.

0 comments on commit c42bee0

Please sign in to comment.