Skip to main content
The methods below require the OneSignal SDK versions 3 & 4.It is recommended to upgrade to our latest version 5 SDKs for User Model APIs.See Update to User Model for migration steps.
OneSignal tags are custom key : value pairs of string data for setting custom user or event properties. This guide details how to add tags through the SDK, but tags can be set in a number of ways outlined in Tags: Tracking User Events and Attributes Tags should be added as string data, but any numbers/integers/decimals will be detected automatically on our backend and available for use.
Do not use tags for setting “user Ids” or sending messages to individual users. Instead use the External User Id property.OneSignal is not meant to be a database. If you wish to store complex user attributes, we recommend using a dedicated Database, DMP, or CRM.

SDK Tagging Methods

Tag a user based on an event of your choosing so later you can create Segments or Message Personalization. Recommend using sendTags over sendTag if you need to set more than one tag on a user at a time. iOS SDK implements callbacks to verify tags were successfully added. Android saves tags to device cache and will retry updating the tag automatically upon a stable network connection being established.

sendTag Method

Tag a user based on an app event of your choosing so later you can later create segments to target these users. We recommend using sendTags over sendTag if you need to add or update more than one tag on a user at a time. If you try to set more tags on a user than you plan allows, it will fail. You will need to delete any unwanted tags first before setting or updating tags. See Data Tags for details.

sendTags Method

Tag a user based on an app event of your choosing, so that later you can create segments to target these users. If you try to set more tags on a user than you plan allows, it will fail. You will need to delete any unwanted tags first before setting or updating tags. See Data Tags for details.

getTags Method

Retrieve a list of tags as that have been set on the user from the OneSignal server. Android will provide a cached copy if there is no network connection.

deleteTag Method

Deletes a single tag that was previously set on a user with sendTag or sendTags. Use deleteTags if you need to delete more than one.

deleteTags Method

Deletes one or more tags that were previously set on a user with sendTag or sendTags.

Tagging Examples

Tag Based on Browser or Operating System

OneSignal currently tracks device type, which you can use to create Segments to target Android and iOS mobile app subscribers and Web Push subscribers independently. If you want to segment by mobile web vs. desktop web subscribers, you can use this example code on the site to tag automatically once detected:
For segmenting around all different types of Operating Systems and Browsers, you can use this more in-depth tagging options:

Get and Delete All Tags

Example of fetching all tags and deleting them.