Add OneSignal tags to user profile

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 ( && == 'nativeFunctionsLoaded') {

		} catch (ex) {

You can find more details on how to use tags in OneSignal, here:

Did this answer your question?