reinstate the 'exited' metric. fixes #653

This commit is contained in:
Danny Coates 2018-01-19 15:07:05 -08:00
parent 39bfe6d2cb
commit f7dc86ab2b
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
3 changed files with 10 additions and 27 deletions

View File

@ -20,7 +20,7 @@ let experiment = null;
export default function initialize(state, emitter) { export default function initialize(state, emitter) {
appState = state; appState = state;
emitter.on('DOMContentLoaded', () => { emitter.on('DOMContentLoaded', () => {
// addExitHandlers(); addExitHandlers();
experiment = storage.enrolled[0]; experiment = storage.enrolled[0];
sendEvent(category(), 'visit', { sendEvent(category(), 'visit', {
cm5: storage.totalUploads, cm5: storage.totalUploads,
@ -29,9 +29,8 @@ export default function initialize(state, emitter) {
}); });
//TODO restart handlers... somewhere //TODO restart handlers... somewhere
}); });
emitter.on('exit', evt => { emitter.on('exit', exitEvent);
exitEvent(evt); emitter.on('experiment', experimentEvent);
});
} }
function category() { function category() {
@ -259,6 +258,10 @@ function exitEvent(target) {
}); });
} }
function experimentEvent(params) {
return sendEvent(category(), 'experiment', params);
}
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
function addExitHandlers() { function addExitHandlers() {
const links = Array.from(document.querySelectorAll('a')); const links = Array.from(document.querySelectorAll('a'));

View File

@ -1,22 +1,9 @@
const html = require('choo/html'); const html = require('choo/html');
const assets = require('../../common/assets'); const assets = require('../../common/assets');
// function replaceLinks(str, urls) {
// let i = -1;
// const s = str.replace(/<a>([^<]+)<\/a>/g, (m, v) => {
// i++;
// return `<a class="link" href="${urls[i]}">${v}</a>`;
// });
// return [`<span>${s}</span>`];
// }
module.exports = function(state, emit) { module.exports = function(state, emit) {
// function close() { function clicked() {
// document.querySelector('.banner').remove(); emit('experiment', { cd3: 'promo' });
// }
function clicked(evt) {
emit('exit', evt);
} }
const classes = state.promo === 'blue' ? 'banner banner-blue' : 'banner'; const classes = state.promo === 'blue' ? 'banner banner-blue' : 'banner';
@ -37,10 +24,3 @@ module.exports = function(state, emit) {
</div> </div>
</div>`; </div>`;
}; };
/*
<img
src="${assets.get('close-16.svg')}"
class="icon-delete"
onclick=${close}>
*/

View File

@ -21,7 +21,7 @@ function passwordComplete(state, password) {
<input type="submit" <input type="submit"
id="unlock-reset-btn" id="unlock-reset-btn"
class="btn btn-hidden" class="btn btn-hidden"
value="Reset Password"/> value="${state.translate('changePasswordButton')}"/>
</form> </form>
</div>` </div>`
]); ]);