Closed iballan closed 11 months ago
Thanks for filing! Will take a look today!
Hey! Thanks for your patience with this issue. I'm having a little trouble reproducing this bug. To attempt reproduce I sent myself a campaign notification to a test app and click opened on it while the app was running. I was able to see the open event was logged and I now see the event in the user's timeline. Can you tell me more about your setup? Where did you put the open tracking code above? Are you opening a push notification from Klaviyo or from another service? Our SDK currently does not log opens from other services.
Hey @ndurell,
Actually on iOS we use the standard Klaviyo sdk flow to do that, where on Android we don't.
This is the didReceive
method:
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let isHandledByKlaviyo = KlaviyoManager.shared.handleKlaviyoNotifiction(response: response, withCompletionHandler: completionHandler) { [weak self] url in
self?.handleDeepLinking(url: url)
}
if !isHandledByKlaviyo {
// Here we handle our Firebase Messaging notification
let url = // get deeplink from the response
handleDeepLinking(url: url)
completionHandler()
}
// get some payloads info for our analytics service
analyticsManager.trackNotificationClicked(..some payloads, isKlaviyo: isHandledByKlaviyo)
}
The KlaviyoManager
class is just a wrapper on the KlaviyoSDK()
, this is handleKlaviyoNotifiction
mentioned in the code above:
func handleKlaviyoNotifiction(response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void, deeplinkHandler: @escaping (URL) -> Void) -> Bool {
let handled = KlaviyoSDK().handle(notificationResponse: response, withCompletionHandler: completionHandler, deepLinkHandler: deeplinkHandler)
return handled
}
Ahh ok this is great and does look correct. However I'll give this a try in our test app and get back to ya.
Quick update: so far I'm not able to repro this. We would like to get you unblocked so I've reached out offline to schedule time to sync up directly on this. One other thing you might want to check is that the open code is being hit when you open the push. Potentially you could add some logging to ensure the handle call is being made to our sdk.
Actually a couple other things you can check (if you haven't already):
I assume this was completed but just wanted to check that as well.
@ndurell hmm I will check that and get back to you
Yeah I made sure we have the UNUserNotificationCenter.current().delegate set, and have func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)
and contains Klaviyo.handle
in it.
The thing is we are getting Klaviyo's notification and clicking it taking us to the deeplink. So most probably the code of the delegate is hit, but since not able to run in debug mode i am not sure whether Klaviyo.handle
returns true or false
I just debugged the code i sent above for sandbox Firebase notification, it works just fine.
Klaviyo.handle
returns false
for Firebase notification and deeplinks handled correctly
Hey @iballan can you update this issue once you hear back from QA?
Hey @iballan did QA have any luck with the open rate?
Hey @ndurell I was on vocation last week, I've seen that our QA is working on it this week. I will let you know about the results soon.
Hi @ndurell Finally with the good news :) Everything is working just fine! Thank you all for your help! Much appreciated.
Glad everything worked out @iballan. Please reach out if you have any issues in the future. Closing this issue now.
Description
Reported the same issue on Android sdk too https://github.com/klaviyo/klaviyo-android-sdk/issues/78
But on Android we had to customize the behavior and log OPENED_PUSH manually. On iOS it is not working even though we are using the SDK's version of handling notification.
KlaviyoSDK().handle should be handling the logic of logging OPENED_PUSH event, yet i tried to create the event and send it to make sure it is sent to Klaviyo. Yet i don't see open rate on the dashboard
Checklist
main
branch of this package.Expected behavior
When I send push notification from klaviyo's dashboard and click on it, I expect to see 1 opened notification on the dashboard.
Actual behavior
Open rate is 0% all the time no matter how I log the OPENED_PUSH event
Steps to reproduce
Send push notification to iOS, clicking it won't show open rate on the dashboard
The Klaviyo Swift SDK version information
2.0.1
Destination operating system
iOS 16
Xcode version information
14.3.1
Swift Compiler version information