# About tags

Use tags to target audiences, trigger automations, filter message delivery, and localize content.

## How tags work

Tags are metadata you attach to a [channel](https://www.airship.com/docs/reference/glossary/#channel_term) or [named user](https://www.airship.com/docs/reference/glossary/#named_user) for audience segmentation. They typically describe a user preference or other categorization, such as `wine_enthusiast` or `weather_alerts_los_angeles`.

Airship evaluates tags by presence or absence, not by value. You can set up to 1,000 tags on a single channel or named user, but large tag counts slow audience evaluation.

Tags are organized into tag groups, which categorize related tags such as an `interests` group for preferences or a `loyalty` group for membership tiers. Every tag belongs to a tag group, and the same tag name in different groups is treated as distinct.

[Set or remove tags](https://www.airship.com/docs/guides/audience/tags/setting/) directly using the SDK or API, or by uploading a CSV in the dashboard. You can also configure messages to set or remove tags based on user interaction. For example, tags can capture actions such as viewing a product page in your app, submitting a preference form on your website, tapping a promotional link in an email, or replying to a text message with a keyword.

For some use cases, another feature is a better fit:

- When you need values you can compare or filter, such as `lifetime_purchase_total` or `last_login_date`, use [attributes](https://www.airship.com/docs/reference/glossary/#attribute).
- When you need to read a user's opt-ins from the SDK, for example to display current subscriptions in your app, use [subscription lists](https://www.airship.com/docs/reference/glossary/#subscription_list). This is because tags can be set from the SDK but not read.

## Using tags with messaging

Tags support the following messaging capabilities:

- **Targeting** — Target audiences for messages, [feature flags](https://www.airship.com/docs/reference/glossary/#feature_flag), [A/B tests](https://www.airship.com/docs/guides/experimentation/a-b-tests/), and [Intelligent Rollouts](https://www.airship.com/docs/guides/experimentation/intelligent-rollouts/) based on tag presence or absence. You can also include tags in [segments](https://www.airship.com/docs/reference/glossary/#segment).
- **Triggering** — Set your [Automations and Sequences](https://www.airship.com/docs/guides/messaging/messages/sequences/about/) to run when a tag is added or removed. You can also set a tag change as a Sequence exit condition.
- **Delivery filtering** — Set delivery conditions on Automations and Sequences by requiring or excluding specific tags.
- **Localization** — Use locale and country tags in [Handlebars](https://www.airship.com/docs/reference/glossary/#handlebars).

Targeting and setting tags can work together in a single message. For example, in a push notification about a new film release, target users with the `likes_movies` tag in the `interests` tag group and set the `tapped_movie_promo` tag in the `engagement` tag group when they tap the message. Later, send a follow-up discount to users with the `tapped_movie_promo` tag.

**Target movie fans by tag and set another tag on those who engage**

```json
{
   "audience": {
      "tag": "likes_movies",
      "group": "interests"
   },
   "notification": {
      "alert": "New movie release this Friday. Get tickets before they sell out.",
      "actions": {
         "tags": [
            {
               "type": "channel",
               "action": "add",
               "group": "engagement",
               "tags": ["tapped_movie_promo"]
            }
         ]
      }
   },
   "device_types": ["ios", "android"]
}
```


## Tag types, data sources, and setup

Tags can come from Airship, the Airship SDKs, and you.

The following table shows the data source, description, and setup required for each tag type:

| Type | Data source | Description | Setup |
| --- | --- | --- | --- |
| **Device property** | Airship SDKs or customer | The Airship SDKs automatically set device property tags on your audience based on device data such as locale, time zone, and OS. For email, SMS, and open channels, you can assign values that do not come from a device. See [Device properties](https://www.airship.com/docs/guides/audience/device-properties/). | None. |
| **Custom** | Customer | You can add your own tags to your project, organized in tag groups you define. For example, you may want to group tags for user interests, loyalty tiers, or CRM data. | Create custom tag groups in your project, then set tags on your audience. |
| **Primary device** | Customer | Any tag you set without specifying a custom tag group is assigned to the `device` tag group. | None. |

> **Warning:** When the app and web SDKs update Airship, all primary device tags are replaced by the data coming from the app or website. Custom tags only change when you add or remove them. Use custom tags for data you need to persist.


### Feature tags

These Airship features have dedicated tags that enable their functionality:

| Feature | Tag group | Valid tags | Setup |
| --- | --- | --- | --- |
| [Predictive Churn](https://www.airship.com/docs/reference/glossary/#predictive_churn) | `ua_churn_prediction` | `high`, `medium`, `low` | Enable the feature in your project settings. |
| [Optimal Send Time](https://www.airship.com/docs/reference/glossary/#optimal_send_time) | `ua_send_time_prediction` | Hour of day (`0`–`23`) | Enable the feature in your project settings. |
| [Channel Coordination](https://www.airship.com/docs/reference/glossary/#channel_coordination) | `ua:orchestration` | `last_active`, `priority_platform`, `user_preferred` | Implement [named users](https://www.airship.com/docs/reference/glossary/#named_user). |
| [Autogroup](https://www.airship.com/docs/reference/glossary/#autogroup) | `autogroup` | A random number from `1` to `100` | [Contact Airship Support](https://support.airship.com/) to enable autogroup for your account. |

## Where tags are stored

A tag stored on a [contact](https://www.airship.com/docs/reference/glossary/#contact) applies across all channels associated with that user, and a tag stored on a channel applies only to that channel. The following table shows where each tag type is stored under each segmentation system:

| Tag type | Contact-level segmentation | Channel-level segmentation |
| --- | --- | --- |
| Custom | Contact | Contact or channel |
| Primary device | Channel | Channel |
| Device property | Channel | Channel |

Under channel-level segmentation, channel tags do not propagate up to the contact, and Airship removes a contact's tags from a channel when you disassociate it.

For the broader audience-data storage model, see [Data storage](https://www.airship.com/docs/guides/audience/your-audience/#data-storage) in *Your audience*. For details on the segmentation systems and how to check your project's setting, see [Channel-level segmentation](https://www.airship.com/docs/guides/audience/segmentation/about/#channel-level-segmentation) in *Segmenting your audience*.
