Skip to content

Commit cbe7688

Browse files
authored
Merge pull request #230 from medyo/improve-analytics-streak
feat: add user streak identification to analytics and update AppLayout
2 parents d2d8cb7 + f511a13 commit cbe7688

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/components/Layout/AppLayout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import 'src/assets/App.css'
66
import { AuthModal, useAuth } from 'src/features/auth'
77
import { usePostStreak } from 'src/features/hits'
88
import { MarketingBanner } from 'src/features/MarketingBanner'
9+
import { identifyUserStreak } from 'src/lib/analytics'
910
import { AuthProvider } from 'src/providers/AuthProvider'
1011
import { Header } from './Header'
1112

@@ -17,6 +18,7 @@ export const AppLayout = () => {
1718
if (isConnected) {
1819
postStreakMutation.mutateAsync(undefined).then((data) => {
1920
setStreak(data.streak)
21+
identifyUserStreak(data.streak)
2022
})
2123
}
2224
}, [isConnected])

src/lib/analytics.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export enum Attributes {
7373
DURATION = 'Duration',
7474
PROVIDER = 'Provider',
7575
ADV = 'ADV',
76+
STREAK = 'Streak',
7677
}
7778

7879
const _SEP_ = ' '
@@ -434,7 +435,9 @@ export const identifyUserMaxVisibleCards = (maxVisibleCards: number) => {
434435
export const identifyAdvBlocked = (blocked: boolean) => {
435436
identifyUserProperty(Attributes.ADV, blocked)
436437
}
437-
438+
export const identifyUserStreak = (value: number) => {
439+
identifyUserProperty(Attributes.STREAK, value)
440+
}
438441
// Private functions
439442
type trackEventProps = {
440443
object: Exclude<Objects, null | undefined>

src/lib/interceptors/DefaultRequestInterceptor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,5 @@ const getUserToken = async () => {
3232
}
3333
unsub()
3434
})
35-
resolve('abc')
3635
})
3736
}

0 commit comments

Comments
 (0)