Skip to content

Commit

Permalink
TEST
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Dec 12, 2024
1 parent d282a9c commit f1b093c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions app/src/redux/analytics/mixpanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ export function trackEvent(
log.debug('Trackable event', { event, optedIn })
if (MIXPANEL_ID != null && optedIn) {
if (event.superProperties != null) {
mixpanel.register(event.superProperties)
mixpanel.register?.(event.superProperties)
}
if ('name' in event && event.name != null) {
mixpanel.track(event.name, event.properties)
mixpanel.track?.(event.name, event.properties)
}
}
}
Expand All @@ -58,11 +58,14 @@ export function setMixpanelTracking(
): void {
if (MIXPANEL_ID != null) {
initMixpanelInstanceOnce(config)

console.log('=>(mixpanel.ts:64) mixpanel', mixpanel)

if (config.optedIn) {
log.debug('User has opted into analytics; tracking with Mixpanel')
mixpanel.identify(config.appId)
mixpanel.opt_in_tracking()
mixpanel.register({
mixpanel.identify?.(config.appId)
mixpanel.opt_in_tracking?.()
mixpanel.register?.({
appVersion: CURRENT_VERSION,
appId: config.appId,
appMode: Boolean(isOnDevice) ? 'ODD' : 'Desktop',
Expand All @@ -81,6 +84,8 @@ function initializeMixpanelInstanceOnce(
let hasBeenInitialized = false

return function (config: AnalyticsConfig): undefined {
console.log('=>(mixpanel.ts:81) config', config)

if (!hasBeenInitialized && MIXPANEL_ID != null) {
hasBeenInitialized = true
log.debug('Initializing Mixpanel', { config })
Expand Down

0 comments on commit f1b093c

Please sign in to comment.