File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import cloudController from '../services/cloudController'
33import Controller , { emit } from '../services/Controller'
44import network from '../services/Network'
55import browser from '../services/browser'
6+ import analytics from '../services/analytics'
67import { selectDeviceModelAttributes } from '../selectors/devices'
78import {
89 CLIENT_ID ,
@@ -225,6 +226,7 @@ export default createModel<RootModel>()({
225226 async signedIn ( _ : void , state ) {
226227 dispatch . ui . init ( )
227228 zendesk . initChat ( state . auth . user )
229+ analytics . signedIn ( state . auth . user )
228230 cloudController . init ( )
229231 cloudSync . init ( )
230232 network . tick ( )
Original file line number Diff line number Diff line change 1- import browser from './browser'
1+ import browser , { getOs , getApp } from './browser'
22import {
33 GOOGLE_TAG_MANAGER_DESKTOP_KEY ,
44 GOOGLE_TAG_MANAGER_PORTAL_KEY ,
55 GOOGLE_TAG_MANAGER_ANDROID_KEY ,
66 GOOGLE_TAG_MANAGER_IOS_KEY ,
77} from '../constants'
88import TagManager from 'react-gtm-module'
9+ import { version } from '../helpers/versionHelper'
910
1011const analytics = {
1112 initialize ( ) {
@@ -18,13 +19,21 @@ const analytics = {
1819 : GOOGLE_TAG_MANAGER_DESKTOP_KEY
1920 console . log ( 'ANALYTICS INITIALIZE' )
2021 TagManager . initialize ( { gtmId : gtmId ?. trim ( ) } )
21- // analytics.initializeClarity()
22+ TagManager . dataLayer ( {
23+ dataLayer : {
24+ app_version : version ,
25+ platform : getOs ( ) ,
26+ app_name : getApp ( ) ,
27+ } ,
28+ } )
2229 } ,
2330
24- // initializeClarity() {
25- // const user = store.getState().user
26- // if (window.clarity) window.clarity('set', 'user', user.email)
27- // },
31+ signedIn ( user ?: IUser ) {
32+ if ( user ) {
33+ TagManager . dataLayer ( { dataLayer : { user_id : user . id } } )
34+ if ( window . clarity ) window . clarity ( 'identify' , user . id )
35+ }
36+ } ,
2837}
2938
3039export default analytics
You can’t perform that action at this time.
0 commit comments