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

View File

@ -1,22 +1,9 @@
const html = require('choo/html');
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) {
// function close() {
// document.querySelector('.banner').remove();
// }
function clicked(evt) {
emit('exit', evt);
function clicked() {
emit('experiment', { cd3: 'promo' });
}
const classes = state.promo === 'blue' ? 'banner banner-blue' : 'banner';
@ -37,10 +24,3 @@ module.exports = function(state, emit) {
</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"
id="unlock-reset-btn"
class="btn btn-hidden"
value="Reset Password"/>
value="${state.translate('changePasswordButton')}"/>
</form>
</div>`
]);