Skip to content
Permalink
Browse files

feat(metrics): add optional sync_engines user property to amplitude

  • Loading branch information...
philbooth committed Jun 4, 2019
1 parent 4f7edb9 commit 45b60a81a0e0faa9ba6e682b110a7ff5c1ec17d9
@@ -245,6 +245,7 @@ module.exports = {
}),
mapAppendProperties(data),
mapSyncDevices(data),
mapSyncEngines(data),
mapNewsletterState(eventCategory, data),
mapNewsletters(data),
);
@@ -321,6 +322,14 @@ function countDevices (devices, period) {
return devices.filter(device => device.lastAccessTime >= Date.now() - period).length;
}

function mapSyncEngines (data) {
const { syncEngines: sync_engines } = data;

if (Array.isArray(sync_engines) && sync_engines.length > 0) {
return { sync_engines };
}
}

function mapNewsletterState (eventCategory, data) {
let newsletter_state = NEWSLETTER_STATES[eventCategory];

Some generated files are not rendered by default. Learn more.

@@ -1,6 +1,6 @@
{
"name": "fxa-shared",
"version": "1.0.25",
"version": "1.0.26",
"description": "Shared module for FxA repositories",
"main": "index.js",
"scripts": {
@@ -132,6 +132,7 @@ describe('metrics/amplitude:', () => {
osVersion: 'q',
region: 'r',
service: 'baz',
syncEngines: [ 'wibble', 'blee' ],
templateVersion: 's',
uid: 't',
utm_campaign: 'u',
@@ -177,6 +178,7 @@ describe('metrics/amplitude:', () => {
sync_active_devices_month: 5,
sync_active_devices_week: 3,
sync_device_count: 6,
sync_engines: [ 'wibble', 'blee' ],
ua_browser: 'a',
ua_version: 'b',
utm_campaign: 'u',
@@ -200,6 +202,7 @@ describe('metrics/amplitude:', () => {
deviceId: 'a',
flowBeginTime: 'b',
flowId: 'c',
syncEngines: [],
uid: 'd'
});
});

0 comments on commit 45b60a8

Please sign in to comment.
You can’t perform that action at this time.