Added experiment for firefox download promo

This commit is contained in:
Danny Coates 2017-11-07 15:54:42 -08:00
parent d0d41b743a
commit e7fdf76120
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
20 changed files with 222 additions and 106 deletions

View file

@ -20,7 +20,7 @@ let experiment = null;
export default function initialize(state, emitter) {
appState = state;
emitter.on('DOMContentLoaded', () => {
addExitHandlers();
// addExitHandlers();
experiment = storage.enrolled[0];
sendEvent(category(), 'visit', {
cm5: storage.totalUploads,
@ -29,6 +29,9 @@ export default function initialize(state, emitter) {
});
//TODO restart handlers... somewhere
});
emitter.on('exit', evt => {
exitEvent(evt);
});
}
function category() {
@ -81,6 +84,8 @@ function urlToMetric(url) {
case 'https://testpilot.firefox.com/':
case 'https://testpilot.firefox.com/experiments/send':
return 'testpilot';
case 'https://www.mozilla.org/firefox/new/?utm_campaign=send-acquisition&utm_medium=referral&utm_source=send.firefox.com':
return 'promo';
default:
return 'other';
}
@ -244,6 +249,7 @@ function exitEvent(target) {
});
}
// eslint-disable-next-line no-unused-vars
function addExitHandlers() {
const links = Array.from(document.querySelectorAll('a'));
links.forEach(l => {