Enable and Use Analytics on iOS
Enable analytics in your configuration file using the analytics:true value. The SDK collects analytics in the background and when your app calls SDK methods.
Track Push Notifications
To make sure that the SDK and Marketing Cloud Next track push notifications accurately, call the SDK in your push notification handler method. If you don’t, analytic events can’t track open counts for your push messaging campaigns.
1/**
2The method is called on the delegate when the user responds to the notification
3by opening the application, dismissing the notification or choosing a
4UNNotificationAction. Set the delegate before the application returns from
5applicationDidFinishLaunching:.
6**/
7func userNotificationCenter(
8 _ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse,
9 withCompletionHandler completionHandler: @escaping () -> Void
10) {
11 // tell the SDK about the notification
12 PushFeature.requestSdk { pushFeature in
13 pushFeature?.setNotificationResponse(response)
14 }
15 completionHandler()
16}