fix(metrics): promote entrypoint to amplitude user properties (#5684) r=@vladikoff
Fixes mozilla/fxa-amplitude-send#26.
This commit is contained in:
Родитель
eee6e92632
Коммит
65b4b04523
|
@ -120,9 +120,9 @@ const NOP = () => {};
|
|||
|
||||
const EVENT_PROPERTIES = {
|
||||
[GROUPS.email]: mixProperties(mapEmailType, mapService),
|
||||
[GROUPS.login]: mixProperties(mapEntrypoint, mapService),
|
||||
[GROUPS.registration]: mixProperties(mapEntrypoint, mapService),
|
||||
[GROUPS.settings]: mixProperties(mapEntrypoint, mapDisconnectReason),
|
||||
[GROUPS.login]: mapService,
|
||||
[GROUPS.registration]: mapService,
|
||||
[GROUPS.settings]: mapDisconnectReason,
|
||||
[GROUPS.sms]: NOP
|
||||
};
|
||||
|
||||
|
@ -204,6 +204,7 @@ function mapUserProperties (group, eventCategory, data, userAgent) {
|
|||
return Object.assign(
|
||||
{},
|
||||
mapBrowser(userAgent),
|
||||
mapEntrypoint(data),
|
||||
mapExperiments(data),
|
||||
USER_PROPERTIES[group](eventCategory, data)
|
||||
);
|
||||
|
@ -272,6 +273,13 @@ function mixProperties (...mappers) {
|
|||
Object.assign({}, ...mappers.map(m => m(event, eventCategory, data)));
|
||||
}
|
||||
|
||||
function mapEntrypoint (data) {
|
||||
const entrypoint = marshallOptionalValue(data.entrypoint);
|
||||
if (entrypoint) {
|
||||
return { entrypoint };
|
||||
}
|
||||
}
|
||||
|
||||
function mapExperiments (data) {
|
||||
if (data.experiments && data.experiments.length > 0) {
|
||||
return {
|
||||
|
@ -300,13 +308,6 @@ function mapEmailType (event, eventCategory) {
|
|||
}
|
||||
}
|
||||
|
||||
function mapEntrypoint (event, eventCategory, data) {
|
||||
const entrypoint = marshallOptionalValue(data.entrypoint);
|
||||
if (entrypoint) {
|
||||
return { entrypoint };
|
||||
}
|
||||
}
|
||||
|
||||
function mapService (event, eventCategory, data) {
|
||||
const service = marshallOptionalValue(data.service);
|
||||
if (service) {
|
||||
|
|
|
@ -98,7 +98,6 @@ define([
|
|||
device_id: 'bar',
|
||||
event_properties: {
|
||||
device_id: 'bar',
|
||||
entrypoint: 'baz',
|
||||
service: 'amo'
|
||||
},
|
||||
event_type: 'fxa_login - forgot_submit',
|
||||
|
@ -111,6 +110,7 @@ define([
|
|||
time: 'foo',
|
||||
user_id: 'soop',
|
||||
user_properties: {
|
||||
entrypoint: 'baz',
|
||||
experiments: [
|
||||
'first_experiment_group_one',
|
||||
'second_experiment_group_two',
|
||||
|
@ -163,8 +163,7 @@ define([
|
|||
device_id: 'b',
|
||||
device_model: 'iPad',
|
||||
event_properties: {
|
||||
device_id: 'b',
|
||||
entrypoint: 'c'
|
||||
device_id: 'b'
|
||||
},
|
||||
event_type: 'fxa_pref - password',
|
||||
language: 'f',
|
||||
|
@ -176,6 +175,7 @@ define([
|
|||
time: 'a',
|
||||
user_id: 'h',
|
||||
user_properties: {
|
||||
entrypoint: 'c',
|
||||
ua_browser: 'Mobile Safari',
|
||||
ua_version: '6'
|
||||
}
|
||||
|
@ -342,7 +342,6 @@ define([
|
|||
device_id: 'b',
|
||||
event_properties: {
|
||||
device_id: 'b',
|
||||
entrypoint: 'c',
|
||||
service: 'pocket'
|
||||
},
|
||||
event_type: 'fxa_reg - engage',
|
||||
|
@ -353,6 +352,7 @@ define([
|
|||
time: 'a',
|
||||
user_id: 'h',
|
||||
user_properties: {
|
||||
entrypoint: 'c',
|
||||
flow_id: 'e',
|
||||
utm_campaign: 'i',
|
||||
utm_content: 'j',
|
||||
|
@ -616,6 +616,7 @@ define([
|
|||
time: 'a',
|
||||
user_id: 'h',
|
||||
user_properties: {
|
||||
entrypoint: 'c',
|
||||
flow_id: 'e'
|
||||
}
|
||||
});
|
||||
|
@ -738,6 +739,7 @@ define([
|
|||
time: 'a',
|
||||
user_id: 'h',
|
||||
user_properties: {
|
||||
entrypoint: 'c',
|
||||
flow_id: 'e'
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче