Add analytics event for when the app is opened from a notification (#1270)

* Add analytics event for when the app is opened from a notification

* Tweak notification ID
zio/stable
Paul Frazee 2023-08-24 16:07:16 -07:00 committed by GitHub
parent a115c17a09
commit c6f321862b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -86,6 +86,8 @@ interface TrackPropertiesMap {
'MobileShell:SearchButtonPressed': {} 'MobileShell:SearchButtonPressed': {}
'MobileShell:NotificationsButtonPressed': {} 'MobileShell:NotificationsButtonPressed': {}
'MobileShell:FeedsButtonPressed': {} 'MobileShell:FeedsButtonPressed': {}
// NOTIFICATIONS events
'Notificatons:OpenApp': {}
// LISTS events // LISTS events
'Lists:onRefresh': {} 'Lists:onRefresh': {}
'Lists:onEndReached': {} 'Lists:onEndReached': {}

View File

@ -2,6 +2,7 @@ import * as Notifications from 'expo-notifications'
import {RootStoreModel} from '../../state' import {RootStoreModel} from '../../state'
import {resetToTab} from '../../Navigation' import {resetToTab} from '../../Navigation'
import {devicePlatform, isIOS} from 'platform/detection' import {devicePlatform, isIOS} from 'platform/detection'
import {track} from 'lib/analytics/analytics'
const SERVICE_DID = (serviceUrl?: string) => const SERVICE_DID = (serviceUrl?: string) =>
serviceUrl?.includes('staging') serviceUrl?.includes('staging')
@ -89,6 +90,7 @@ export function init(store: RootStoreModel) {
store.log.debug( store.log.debug(
'User pressed a notification, opening notifications tab', 'User pressed a notification, opening notifications tab',
) )
track('Notificatons:OpenApp')
resetToTab('NotificationsTab') resetToTab('NotificationsTab')
} }
}, },