diff --git a/server/lib/amplitude.js b/server/lib/amplitude.js index 332e0bd76..d154d2511 100644 --- a/server/lib/amplitude.js +++ b/server/lib/amplitude.js @@ -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' } ], diff --git a/tests/server/amplitude.js b/tests/server/amplitude.js index dd9d05811..b10100613 100644 --- a/tests/server/amplitude.js +++ b/tests/server/amplitude.js @@ -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',