Setting and removing tags
Set and remove tags on your audience from your systems or from user behavior in messages.
Before you set tags
You must create custom tag groups in your project before you can set tags that belong to them. You do not need to create the individual tags in advance, since Airship creates each one the first time you set it.
No setup is required for primary device tagsA tag set without specifying a custom tag group. Belongs to the device tag group and applies to a channel only, not a named user. or device propertyInformation about a channel, such as language and time zone settings, OS and browser versions, and notification opt-in status. Device properties apply to a channel only, not a named user. Values come from the user’s device when an SDK is present, or are set via the API for channels without one. Each property is automatically made available as an attribute, a tag, or both for audience segmentation. tags, which are set automatically by the Airship SDKs.
Tag names and limits
Tag names are case-sensitive, can contain up to 128 characters, and cannot have leading or trailing whitespace. Do not include personally identifiable information in tag names, and use stable, lowercase names for consistency across your project.
You can set up to 1,000 tags on a single channel or named user. Large tag counts slow audience evaluation, so avoid setting tags you do not use for targeting.
Named users versus channels
You can set tags on channels and named users, but their inheritance varies:
- Channels inherit from named users — All channels associated with a named user also bear the named user’s tags. When you remove a channel from a named user, Airship removes the named user’s tags from that channel.
- Named users do not inherit from channels — Any tag set at the channel level does not propagate to the named user.
For example, setting the loyalty_gold tag on named user user_abc123 applies it to every channel associated with user_abc123.
In general, set tags at the named user level when using named users so you can target across any of a user’s channels. Setting tags at the channel level limits the tag to that channel and can negate the benefits of named users.
For details on how tags are stored under contact-level and channel-level segmentation, see Where tags are stored in About tags.
Create custom tag groups
Create a custom tag group for each source of tag data you want to manage separately, for example a loyalty database or POS system. You can create custom tag groups only in the Airship dashboard, up to 100 per project, and you cannot delete them.
- Go to Audience, then Tags, then Tag Groups.
- Select Create tag group and complete the fields:
Field Description Name Enter a friendly name that describes the tag group’s data source, for example, “Loyalty database tags.” The name appears in the dashboard when searching for tags and tag groups. Description Add details about the tag group’s source and purpose. Group Key Enter a unique ID used in API calls, using lowercase ASCII characters only and no spaces, for example, pos-database. You cannot change this later. - (Optional) Under Tag security, enable Allow these tags to be set only from your server to increase security by requiring tag read-write operations to be authenticated with your master secret key. You cannot change this later.
Warning If you do not enable this setting, an attacker with your app secret can modify tags on their device to gain access to messages meant for other audiences or opt themselves out of ones intended for them.
See Tag & Named User Security in App Keys & Secrets: Security.
- Select Create tag group, and you will return to your list of all tag groups.
In the tag groups list, you can search by name or group key. After creating a tag group, you can edit its name and description, or disable it.
Disabling a tag group hides it and its tags from search in the dashboard and prevents Sequences that reference it from being republished. Tags already set on your audience remain, and you can re-enable the tag group later.
Set and remove tags from your systems
Push tag data from an external system, such as a CRM, POS, or loyalty database, into Airship.
CSV upload
AXPBulk add or remove tags in custom tag groups by uploading a CSV file of channels, named users, email addresses, or MSISDNs. When using email or SMS identifiers, Airship registers new channels for addresses or MSISDN/sender combinations that are new to your project. Additional CSV fields indicate opt-in status so that you can send messages to new channels generated from your upload.
Custom tag groups must exist in your project before you upload. See Create custom tag groups.
- Prepare your CSV file using the guidelines in Tags CSV Format.
- Go to Audience, then Tags, then Set tags. You can select Download sample CSV to see a formatted file.
- Select Choose file and select your CSV.
- Select Add or Remove, enter a tag name in the search field, then:
- If you search for an existing tag, select it from the search results. Search results include all custom tag groups that contain that tag.
- If you create a new tag, select Create new tag: [search term], enter a custom tag group name in the search field that appears, then select from the search results.
- Select Set tags.
To see upload status and history, go to Audience, then Tags, then Upload History. For Tags changed, select the info icon () for the list of tags. When the status is Processed with errors, select the download icon () to download the error list.
Retention and deletion
Airship automatically deletes a list and all its versions after 90 days of inactivity. Timestamps used to calculate the 90-day period:
- Creation date
- New version uploaded
The creation date is the initial day one of the 90-day period. Each instance of uploading a new version resets the timestamp to day one.
After deletion, the list is removed from the upload history and is no longer visible in the Airship dashboard or through API calls. Deletion does not affect the project state. For example, if you use a tag list that adds tag A to a channel, tag A still exists on the channel after list deletion.
SDK
Use the Airship SDKs to set tags as your audience navigates your app or website. Setting tags in custom tag groups requires iOS SDK 20+ and Android SDK 20+.
Setting tags requires the Tags and Attributes flag in Privacy Manager. Setting contact-level tags also requires the Contacts flag. See SDK data collection.
For code samples and platform-specific details, see the tags topic in the SDK documentation.
API
Use the API to set tags server-side. This is common for integrations and for SMS, email, and open channels, which do not have an Airship SDK.
Set tags on your audience using these endpoints:
Each endpoint accepts an audience object identifying the users, plus tag operations grouped by tag group key. Use add and remove together to modify a user’s existing tags, or use set alone to replace all tags in the specified groups. A single request cannot combine set with add or remove.
POST /api/named_users/tags HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json
{
"audience": {
"named_user_id": ["user-1", "user-2"]
},
"add": {
"loyalty": ["gold", "opted_in"]
},
"remove": {
"loyalty": ["silver"]
}
}Set and remove tags from user behavior
Configure tags to apply automatically when your audience interacts with your app, your messages, or your SMS content.
Message display
Set or remove tags when the following message types are displayed to a user:
| Message type | Supported action | Setup |
|---|---|---|
| Message Center | Set or remove | Configure the Onload field in the Visual editor. |
| Landing page | Set or remove | Configure the Onload field in the Visual editor. |
| Scene | Set | Specify a tag when configuring each screen. See Set a tag in Configuring screens. |
| In-App Automation | Set | Specify a tag when configuring triggers. See In-App Experience Triggers. |
Message interaction
Set or remove tags when your audience interacts with a message. This helps you segment audiences by how they engaged. For example, add a tapped_promo tag when a user taps your promo, then re-target that group with a follow-up or compare it to the message’s total audience to measure engagement.
You can set or remove tags when the following actions occur:
| Message type | Message action | Button press | Image press |
|---|---|---|---|
| Push notification | |||
| Web push notification | |||
| In-app message | |||
| Message Center | |||
| Landing page | |||
| Scene | |||
| In-App Automation | 1 |
1. You must use the drag-and-drop option in the Interactive editor to create the content.
Setting tags in custom tag groups from a message interaction requires iOS SDK 20+ and Android SDK 20+.
For In-App Automations and Scenes, see In-app experience actions.
For push, web push, in-app messages, Message Center, and landing pages, see Actions and Buttons. For the API, specify tag actions in the actions object of the payload for the Send a push endpoint, either at the notification level or per-button under interactive.button_actions.
POST /api/push HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json
{
"audience": "all",
"notification": {
"alert": "Interested in our loyalty program?",
"interactive": {
"type": "ua_yes_no_foreground",
"button_actions": {
"yes": {
"actions": {
"tags": [
{
"type": "contact",
"action": "add",
"group": "loyalty",
"tags": ["opted_in"]
}
]
}
}
}
}
},
"device_types": ["ios", "android"]
}SMS interaction
Set or remove tags based on SMS interactions:
- Keyword replies — Configure tag actions when users reply with a keyword or alias to your sender ID. See SMS keywords.
- Shortened link taps — Add tag actions to Airship-shortened links in your SMS and MMS content. See SMS link shortening.
- Opt-in workflows — Set tags during opt-in flows, including double opt-in, and on channels that have not yet completed opt-in. See SMS opt-in and opt-out handling.
Verifying tags on a user
To confirm which tags are set on an individual channel or named user, use the Contact Management tool.