fix(metrics): make sure to track oauth screen views in amplitude
Fixes #6742
This commit is contained in:
Родитель
9cee542fcf
Коммит
4934527b3a
|
@ -98,7 +98,7 @@ const FUZZY_EVENTS = new Map([
|
||||||
group: eventCategory => VIEW_ENGAGE_SUBMIT_EVENT_GROUPS[eventCategory],
|
group: eventCategory => VIEW_ENGAGE_SUBMIT_EVENT_GROUPS[eventCategory],
|
||||||
event: 'submit'
|
event: 'submit'
|
||||||
} ],
|
} ],
|
||||||
[ /^screen\.([\w-]+)$/, {
|
[ /^screen\.(?:oauth\.)?([\w-]+)$/, {
|
||||||
group: eventCategory => VIEW_ENGAGE_SUBMIT_EVENT_GROUPS[eventCategory],
|
group: eventCategory => VIEW_ENGAGE_SUBMIT_EVENT_GROUPS[eventCategory],
|
||||||
event: 'view'
|
event: 'view'
|
||||||
} ],
|
} ],
|
||||||
|
|
|
@ -794,6 +794,46 @@ registerSuite('amplitude', {
|
||||||
assert.equal(arg.event_type, 'fxa_reg - view');
|
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': () => {
|
'screen.settings': () => {
|
||||||
amplitude({
|
amplitude({
|
||||||
time: 'a',
|
time: 'a',
|
||||||
|
|
Загрузка…
Ссылка в новой задаче