allboatsrise / expo-marketingcloudsdk

Expo module for Salesforce Marketing Cloud SDK
MIT License
12 stars 12 forks source link

Marketing Cloud SDK not tracking user interactions on push notifications #17

Closed byFadili closed 1 year ago

byFadili commented 1 year ago

Hello !

I am using Marketing Cloud Mobile Push for push notification to send push notifications to registered devices and having some trouble tracking "Opened" and "Last activity date".

Screenshot 2023-07-11 at 15 45 15

I tried the @allboatsrise/expo-marketingcloudsdk .track() method, but it doesn't seem to work.

On MC SDK documentation they provide some information about tracking and I wanted to know if that has been implemented in this package.

Does anyone have the same issue ? Any idea why did is happening ?

Thank you !

andrejpavlovic commented 1 year ago

You can try adding this to ExpoMarketingCloudSdkNotificationsDelegate.swift to see if it helps.

  @objc
  public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    SFMCSdk.mp.setNotificationRequest(response.notification.request)
    completionHandler()
  }
FelipeGCastro commented 1 year ago

You can try adding this to ExpoMarketingCloudSdkNotificationsDelegate.swift to see if it helps.

  @objc
  public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    SFMCSdk.mp.setNotificationRequest(response.notification.request)
    completionHandler()
  }

Hello @andrejpavlovic, tried to add the code but looks like it's not working 😞, another guess?

andrejpavlovic commented 1 year ago

@FelipeGCastro So you:

  1. Receive the notification on your device
  2. Press on the notification which then opens the app

After all this, the opened status is still not recorded?

FelipeGCastro commented 1 year ago

@andrejpavlovic , it took a long time to show on the overview, but looks like it works, also I forgot to set analyticsEnabled: true

andrejpavlovic commented 1 year ago

also I forgot to set analyticsEnabled: true

That would definitely help :)

@FelipeGCastro Did you have to add the code above that I suggested as well?

andrejpavlovic commented 1 year ago

@FelipeGCastro I see you added it in https://github.com/allboatsrise/expo-marketingcloudsdk/pull/20 , works for me :)

andrejpavlovic commented 1 year ago

Fix published in [49.0.1](https://github.com/allboatsrise/expo-marketingcloudsdk/releases/tag/49.0.1