OneSignal-Website-SDK icon indicating copy to clipboard operation
OneSignal-Website-SDK copied to clipboard

[Question]: Web SDK to send session data without registering web push?

Open erictse opened this issue 2 years ago • 1 comments

How can we help?

I want to use the Web SDK to measure webpage activity (session count, duration, last session timestamp), but I don't need web push–I just use addEmail() to create an email subscription. However, I cannot get the Web SDK to send the session data and have it update the email subscription in the web dashboard. When I did enable web push, I see the web push subscription in the dashboard, and Web SDK does the correct thing and sends the session data.

Is there a bug or did I misunderstand? I thought the Web SDK is supposed to update all subscriptions (since conceptually there is a single OneSignal user) that match an external ID with the session data. The session management code in the Web SDK seems sophisticated so I need to utilize what you have instead of building my own solution.

erictse avatar Sep 14 '23 15:09 erictse

@erictse There is a current limitation for this SDK where a push subscription has to exists before it will create the User and attach other subscription (like email) to it.

We plan to lift this limitation in the future so any subscription (email or SMS included) will create a User.

jkasten2 avatar Sep 25 '23 20:09 jkasten2