Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

fix(metrics): force utm_source=email when signing in from CAD #6342

Merged
merged 1 commit into from Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/scripts/lib/constants.js
Expand Up @@ -127,6 +127,8 @@ module.exports = {
return map;
}, {}),

OTHER_EMAIL_DOMAIN: 'other'
OTHER_EMAIL_DOMAIN: 'other',

UTM_SOURCE_EMAIL: 'email'
};
/*eslint-enable sorting/sort-object-props*/
20 changes: 18 additions & 2 deletions app/scripts/views/connect_another_device.js
Expand Up @@ -16,7 +16,11 @@ define(function (require, exports, module) {
const ExperimentMixin = require('./mixins/experiment-mixin');
const FlowEventsMixin = require('./mixins/flow-events-mixin');
const FormView = require('./form');
const { MARKETING_ID_AUTUMN_2016, SYNC_SERVICE } = require('../lib/constants');
const {
MARKETING_ID_AUTUMN_2016,
SYNC_SERVICE,
UTM_SOURCE_EMAIL
} = require('../lib/constants');
const MarketingMixin = require('./mixins/marketing-mixin');
const MarketingSnippet = require('./marketing_snippet');
const SyncAuthMixin = require('./mixins/sync-auth-mixin');
Expand Down Expand Up @@ -231,7 +235,19 @@ define(function (require, exports, module) {
* @private
*/
_getEscapedSignInUrl (email) {
return this.getEscapedSyncUrl('signin', ConnectAnotherDeviceView.ENTRYPOINT, { email: email });
return this.getEscapedSyncUrl('signin', ConnectAnotherDeviceView.ENTRYPOINT, {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the exact approach I was thinking @philbooth!

email,
// Users will only reach this view from a verification email, so we can
// hard-code an appropriate utm_source. The utm_source can't be set on
// the originating link because we don't want to clobber the existing
// utm_source for that flow. Related issues:
//
// * https://github.com/mozilla/fxa-content-server/issues/6258
// * https://github.com/mozilla/fxa-auth-server/issues/2496
//
//eslint-disable-next-line camelcase
utm_source: UTM_SOURCE_EMAIL
});
}

static get ENTRYPOINT () {
Expand Down
6 changes: 5 additions & 1 deletion app/tests/spec/views/connect_another_device.js
Expand Up @@ -441,7 +441,11 @@ define(function (require, exports, module) {

assert.isTrue(view.getEscapedSyncUrl.calledOnce);
assert.isTrue(view.getEscapedSyncUrl.calledWith(
'signin', View.ENTRYPOINT, { email: 'testuser@testuser.com' }));
'signin', View.ENTRYPOINT, {
email: 'testuser@testuser.com',
//eslint-disable-next-line camelcase
utm_source: 'email'
}));
});
});

Expand Down