How to Track Push Notifications
- 1. Tracking users who have enabled push notifications and accept alerts
- 2. Tracking notifications
- Notes
1. Tracking users who have enabled push notifications and accept alerts
Within your application delegate’s application: didFinishLaunchingWithOptions:
Below the initialization of the KissmetricsAPI…
2. Tracking notifications
iOS apps will receive notifications differently depending on the state of the application
A. When your app is running:
In your application delegate’s application: (UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
Capture any valuable data from the userInfo remote notification dictionary:
EX: Capturing the alert message
and/or capture any additional data that you’ve supplied in the push notification’s JSON payload.
B. When your app is not running:
In your application delegate’s application: (UIApplcation *)application: didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Capture any valuable data from the userInfo remote notification dictionary:
EX: Capturing the alert message
and/or capture any additional data that you’ve supplied in the push notification’s JSON payload.
Or, in iOS7, if your app delegate is using application: didReceiveRemoteNotification: fetchCompletionHandler: You’ll want to capture your notification data there.
Notes
-
“If the app is not running when a push notification arrives, the method launches the app and provides the appropriate information in the launch options dictionary. The app does not call this method to handle that push notification. Instead, your implementation of the
application:willFinishLaunchingWithOptions:
orapplication:didFinishLaunchingWithOptions:
method needs to get the push notification payload data and respond appropriately.” -
“If your delegate also implements the
application:didReceiveRemoteNotification:fetchCompletionHandler:
method, the app object calls that method instead of this one.” Link for more