Add OneSignal tags to user profile

Turn your website into an app in 60 seconds!
Preview My App
Jack & Jones' desktop website and mobile app.

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

Launch your brand's mobile app with a team of experts by your side.

Our team holds your hand through every step of the process to make building an app a no-brainer.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
  • Preview your app yourself or get a live demo on a call.
  • Learn about our platform and process to help you launch with minimal work required.
  • Risk free - 100% app approval guaranteed or your money back.
Only and Bestseller's iOS and Android apps.
Thank you! We'll be in touch within 48 hours :)
Oops! Something went wrong while submitting the form.
Chat icon.