Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Track creator node selection #90

Merged
merged 3 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 13 additions & 0 deletions src/containers/service-selection/store/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ export function* watchFetchServices() {
primary = autoselect.primary
secondaries = autoselect.secondaries
services = autoselect.services

yield call(
AudiusBackend.creatorNodeSelectionCallback,
primary,
secondaries,
'autoselect'
)
}

if (!primary || !secondaries || secondaries.length < 1) {
Expand Down Expand Up @@ -93,6 +100,12 @@ function* watchSetSelected() {

const currentSecondaries = yield select(getSecondaries)
const { primary, secondaries } = action.payload
yield call(
AudiusBackend.creatorNodeSelectionCallback,
primary,
secondaries,
'manual'
)
const newEndpoint = `${primary},${secondaries.join(',')}`

const [oldPrimary, ...oldSecondaries] = yield select(getSelectedServices)
Expand Down
15 changes: 15 additions & 0 deletions src/services/AudiusBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions src/services/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -726,6 +734,7 @@ export type AllTrackingEvents =
| BrowserNotificationSetting
| TweetFirstUpload
| DiscoveryProviderSelection
| CreatorNodeSelection
| WebVitals
| Performance
| StemCompleteUpload
Expand Down