fix(metrics): make sure to track oauth screen views in amplitude

Fixes #6742
This commit is contained in:
vladikoff 2018-12-18 14:42:14 -05:00
Родитель 9cee542fcf
Коммит 4934527b3a
2 изменённых файлов: 41 добавлений и 1 удалений

Просмотреть файл

@ -98,7 +98,7 @@ const FUZZY_EVENTS = new Map([
group: eventCategory => VIEW_ENGAGE_SUBMIT_EVENT_GROUPS[eventCategory],
event: 'submit'
} ],
[ /^screen\.([\w-]+)$/, {
[ /^screen\.(?:oauth\.)?([\w-]+)$/, {
group: eventCategory => VIEW_ENGAGE_SUBMIT_EVENT_GROUPS[eventCategory],
event: 'view'
} ],

Просмотреть файл

@ -794,6 +794,46 @@ registerSuite('amplitude', {
assert.equal(arg.event_type, 'fxa_reg - view');
},
'screen.oauth.signin': () => {
amplitude({
time: 'a',
type: 'screen.oauth.signin'
}, {
connection: {},
headers: {
'x-forwarded-for': '63.245.221.32'
}
}, {
flowBeginTime: 'b',
flowId: 'c',
uid: 'd',
service: 'g',
});
assert.equal(process.stderr.write.callCount, 1);
const arg = JSON.parse(process.stderr.write.args[0]);
assert.equal(arg.event_type, 'fxa_login - view');
assert.equal(arg.event_properties.oauth_client_id, 'g');
},
'screen.signin.other_events': () => {
amplitude({
time: 'a',
type: 'screen.signin.other_events'
}, {
connection: {},
headers: {
'x-forwarded-for': '63.245.221.32'
}
}, {
flowBeginTime: 'b',
flowId: 'c',
uid: 'd'
});
assert.equal(process.stderr.write.callCount, 0);
},
'screen.settings': () => {
amplitude({
time: 'a',