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.
SDK Tagging Methods
Tag a user based on an event of your choosing so later you can create Segments or Message Personalization. Recommend usingsendTags 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 tracksdevice 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: