You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to addTags() in javascript web sdk v16. All User functions should be synchronous there. But added tags are not send to server in two cases:
Tags are added on page load and OneSignal is not init probably yet.
Tags are added before page redirect and redirect is done before tags are sent to server probably.
It works fine, if page is loaded and there is only small delay before api request to server.
window.OneSignalDeferred=window.OneSignalDeferred||[];OneSignalDeferred.push(asyncfunction(OneSignal){awaitOneSignal.init({appId: $appId,autoResubscribe: true,notifyButton: {enable: true,position: 'bottom-left'}});});// no api call after these call of addTags()OneSignalDeferred.push(function(OneSignal){OneSignal.User.addTags({cart_update: '',product_name: '',product_image: ''});});
How can I wait for OneSignal init?
2 Redirect use case:
window.OneSignalDeferred.push(asyncfunction(OneSignal){awaitOneSignal.User.addTags({cart_update: '',product_name: '',product_image: ''});// change location there
...
});
How can I wait to saving tags?
The text was updated successfully, but these errors were encountered:
@dosercz Thanks for reporting this! Responding to each question in the sections below.
1. Tags are added on page load and OneSignal is not init probably yet.
I am able to reproduce the result you are seeing with the code you provided. We will look into accounting for this scenario so this isn't a problem in the future, in the meantime there is a work around:
2. Tags are added before page redirect and redirect is done before tags are sent to server probably.
If the redirect location is on your same domain and is a page you also initialize OneSignal the SDK will send the tags once the new page has loaded. If you are redirecting to a different domain then the tags will only be sent once the user has revisited your page.
@jkasten2 thanks for help, 1. workaround works fine, but 2. seems it doesn't work for me, we have OneSignal initialized at all pages, but if tags were not sent to server at page, where they were added via OneSignal.User.addTags(), they are not sent after redirect/navigation (I'm not sure if never but in the most cases). Could you check it please?
How can we help?
I'm trying to addTags() in javascript web sdk v16. All User functions should be synchronous there. But added tags are not send to server in two cases:
It works fine, if page is loaded and there is only small delay before api request to server.
Loaded SDK https://cdn.onesignal.com/sdks/web/v16/OneSignalSDK.page.js with defer attribute.
How can I wait for OneSignal init?
2 Redirect use case:
How can I wait to saving tags?
The text was updated successfully, but these errors were encountered: