Read our documentation
For more in-depth guides on onboarding and setup.
Read Documentation

nativeFunctions.onesignalSendTags()

If you'd like to be able to segment your users based on specific interests or categories when sending push notifications you can use the nativeFunctions.onesignalSendTags() functions to add tags to your users in OneSignal.

If a user enables an option on your website, to receive promotional messages, for example, you could trigger the native function to add the "promotions" tag into his OneSignal profile.

Later on, when sending promotions to your users, you would then be able to target all those users who have the "promotions" tag in their profiles.

Here is an example on how to trigger the native function:

<script type="text/javascript">
// Add the event listener
window.addEventListener("message", (event) => {
isAppReady = event;
}, false);

// Log the user in
function addTag(isAppReady) {
try {
// Check if the native functions are ready to be used
if (isAppReady.data && isAppReady.data == 'nativeFunctionsLoaded') {
nativeFunctions.onesignalSendTags("promotions");
}

} catch (ex) {
console.log(ex.message);
}
}
</script>

You can find more details on how to use tags in OneSignal, here: https://documentation.onesignal.com/docs/add-user-data-tags

Thank you! We'll be in touch within 48 hours :)
Oops! Something went wrong while submitting the form.