From 225319990d35ee059abb7ba64cb9ae76c8e15489 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Thu, 29 Oct 2020 11:02:33 -0700 Subject: [PATCH 1/3] Track creator node selection --- src/containers/service-selection/store/sagas.ts | 7 +++++++ src/services/AudiusBackend.js | 15 +++++++++++++++ src/services/analytics.ts | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/src/containers/service-selection/store/sagas.ts b/src/containers/service-selection/store/sagas.ts index fdcb832495..39dea4a5e0 100644 --- a/src/containers/service-selection/store/sagas.ts +++ b/src/containers/service-selection/store/sagas.ts @@ -41,6 +41,12 @@ export function* watchFetchServices() { primary = autoselect.primary secondaries = autoselect.secondaries services = autoselect.services + + yield call( + AudiusBackend.creatorNodeSelectionCallback, + primary, + secondaries + ) } if (!primary || !secondaries || secondaries.length < 1) { @@ -93,6 +99,7 @@ function* watchSetSelected() { const currentSecondaries = yield select(getSecondaries) const { primary, secondaries } = action.payload + yield call(AudiusBackend.creatorNodeSelectionCallback, primary, secondaries) const newEndpoint = `${primary},${secondaries.join(',')}` const [oldPrimary, ...oldSecondaries] = yield select(getSelectedServices) diff --git a/src/services/AudiusBackend.js b/src/services/AudiusBackend.js index 41c3d14dc7..64eaa1751f 100644 --- a/src/services/AudiusBackend.js +++ b/src/services/AudiusBackend.js @@ -360,6 +360,21 @@ class AudiusBackend { ) } + static creatorNodeSelectionCallback(primary, secondaries, reason) { + track(Name.CREATOR_NODE_SELECTION, { + endpoint: primary, + selectedAs: 'primary', + reason + }) + secondaries.forEach(secondary => { + track(Name.CREATOR_NODE_SELECTION, { + endpoint: secondary, + selectedAs: 'secondary', + reason + }) + }) + } + static async sanityChecks(audiusLibs) { try { const sanityChecks = new SanityChecks(audiusLibs) diff --git a/src/services/analytics.ts b/src/services/analytics.ts index c6a1eb0159..661d13b4bc 100644 --- a/src/services/analytics.ts +++ b/src/services/analytics.ts @@ -99,6 +99,7 @@ export enum Name { WEB_VITALS = 'Web Vitals', PERFORMANCE = 'Performance', DISCOVERY_PROVIDER_SELECTION = 'Discovery Provider Selection', + CREATOR_NODE_SELECTION = 'Creator Node Selection', STEM_COMPLETE_UPLOAD = 'Stem: Complete Upload', STEM_DELETE = 'Stem: Delete', REMIX_NEW_REMIX = 'Remix: New Remix', @@ -594,6 +595,13 @@ type DiscoveryProviderSelection = { reason: string } +type CreatorNodeSelection = { + eventName: Name.CREATOR_NODE_SELECTION + selectedAs: 'primary' | 'secondary' + endpoint: string + reason: string +} + type StemCompleteUpload = { eventName: Name.STEM_COMPLETE_UPLOAD id: number @@ -726,6 +734,7 @@ export type AllTrackingEvents = | BrowserNotificationSetting | TweetFirstUpload | DiscoveryProviderSelection + | CreatorNodeSelection | WebVitals | Performance | StemCompleteUpload From 6fe255e7b99f5c80933681059035f892c7b8b856 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Thu, 29 Oct 2020 11:16:14 -0700 Subject: [PATCH 2/3] Add reason --- src/containers/service-selection/store/sagas.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/containers/service-selection/store/sagas.ts b/src/containers/service-selection/store/sagas.ts index 39dea4a5e0..f741e91b92 100644 --- a/src/containers/service-selection/store/sagas.ts +++ b/src/containers/service-selection/store/sagas.ts @@ -45,7 +45,8 @@ export function* watchFetchServices() { yield call( AudiusBackend.creatorNodeSelectionCallback, primary, - secondaries + secondaries, + 'autoselect' ) } @@ -99,7 +100,12 @@ function* watchSetSelected() { const currentSecondaries = yield select(getSecondaries) const { primary, secondaries } = action.payload - yield call(AudiusBackend.creatorNodeSelectionCallback, primary, secondaries) + yield call( + AudiusBackend.creatorNodeSelectionCallback, + primary, + secondaries, + 'manual' + ) const newEndpoint = `${primary},${secondaries.join(',')}` const [oldPrimary, ...oldSecondaries] = yield select(getSelectedServices) From 0cece283340edc0156a9babe089ea047c0ceab58 Mon Sep 17 00:00:00 2001 From: Raymond Jacobson Date: Thu, 29 Oct 2020 11:30:40 -0700 Subject: [PATCH 3/3] Update libs --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index b97c09c65f..e81e26a547 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,9 +55,9 @@ } }, "@audius/libs": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@audius/libs/-/libs-1.0.7.tgz", - "integrity": "sha512-ezT6Rau/0a2GlfBobM7VEUkltKRwOsEGJqICKq09leJp10VMZ69nxdYFfPsUYOJ9LJ36glLFJmBp3m6bI9YaMw==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@audius/libs/-/libs-1.0.8.tgz", + "integrity": "sha512-HuQVGBfdgShyO/hqxcsj5OtyWcyLivlyZSmFtTPvd5EtJmgwFPmMRJUyw7OMubEWkgRjyDxtpm5Vphe/Sz26PA==", "requires": { "@audius/hedgehog": "^1.0.8", "@ethersproject/solidity": "^5.0.5", @@ -7589,9 +7589,9 @@ }, "dependencies": { "buffer": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.1.tgz", - "integrity": "sha512-2z15UUHpS9/3tk9mY/q+Rl3rydOi7yMp5XWNQnRvoz+mJwiv8brqYwp9a+nOCtma6dwuEIxljD8W3ysVBZ05Vg==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.0.tgz", + "integrity": "sha512-cd+5r1VLBwUqTrmnzW+D7ABkJUM6mr7uv1dv+6jRw4Rcl7tFIFHDqHPL98LhpGFn3dbAt3gtLxtrWp4m1kFrqg==", "requires": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" diff --git a/package.json b/package.json index f59753a58e..75e7f29860 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "version": "0.21.28", "private": true, "dependencies": { - "@audius/libs": "1.0.7", + "@audius/libs": "1.0.8", "@audius/stems": "0.2.11", "@optimizely/optimizely-sdk": "^4.0.0", "@reduxjs/toolkit": "^1.3.2",