Targeting your audience using tags

Target users with tags and tag groups, and create reusable segments based on tag data.

View as Markdown

Airship evaluates tags by presence or absence, not by value. Target users by specifying a tag and the tag group it belongs to.

Targeting in the dashboard

In messages, A/B tests, feature flagsAn experimentation tool for controlling the availability of content or functionality in your app or website. A flag’s Configurations determine the audience, schedule, and property values to apply when the flag is enabled. Flag properties enable making immediate code updates, bypassing the need for traditional code changes and release processes., and Intelligent Rollouts, select Target by conditions and Target specific users in the Audience step. You can configure logic that includes or excludes audience members based on whether or not they have specific tags. Instead of recreating the same audience each time, create segmentsA reusable audience group you create by selecting unique or shared user data.. Configuration in the audience step uses the same interface and process as creating segments.

Tags can be combined with other segmentation data, such as events and attributes. For full instructions and usage locations, see Segments and Targeting specific users.

Targeting using the API

Airship’s audience selector accepts tag conditions, so you can target tags in any endpoint that takes an audience object, such as Send a push. Specify the tag and the tag group it belongs to. The condition matches channels with that tag in that tag group, including channels that inherit from a named userA contact identified with an ID you provide, such as a customer ID from your CRM. Associating channels with that ID maps multiple devices and channels to one individual. Each named user has a unique named user ID..

Target users who like movies
{
   "audience": {
      "tag": "likes_movies",
      "group": "interests"
   }
}

Use Boolean NOT, AND, and OR operators to combine tag conditions or mix tags with other audience criteria. See Audience Selection in the Data Formats section of the API reference.

Target movie or series fans who haven’t tapped the promo
{
   "audience": {
      "AND": [
         {
            "OR": [
               { "tag": "likes_movies", "group": "interests" },
               { "tag": "likes_series", "group": "interests" }
            ]
         },
         { "NOT": { "tag": "tapped_movie_promo", "group": "engagement" } }
      ]
   }
}

As in the dashboard, you can save an audience as a reusable segment and reference it by segment ID from any audience selector. See Segments in the API reference.

Using tags in Automations and Sequences

Tags can act on Automations and Sequences at several points:

In the dashboard

Configure how tags affect an Automation or Sequence:

  • Tag Change in Automation and Sequence triggers
  • Conditions in the Setup section of Create an Automation, for gating an entire Automation
  • Conditions in Add Messages to a Sequence, for gating a single message in a Sequence
  • Exit events in Sequence outcomes, using a tag change as the exit signal

Using the API

Use the Create an Automation endpoint to create tag-driven Automations. Sequences cannot be created using the API.

To trigger on a tag change, include a tag_added or tag_removed selector in the immediate_trigger object. Both selectors take the same shape.

Trigger an Automation when a tag is added to a custom tag group
POST /api/pipelines HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json

{
   "name": "Loyalty welcome",
   "enabled": true,
   "immediate_trigger": {
      "tag_added": {
         "tag": "gold",
         "group": "loyalty"
      }
   },
   "outcome": {
      "push": {
         "audience": "triggered",
         "device_types": ["ios", "android"],
         "notification": {
            "alert": "Welcome to Gold status."
         }
      }
   }
}

To gate delivery on a tag, add a tag object to the pipeline’s condition array using the key tag_name, not tag (which is the key used in triggers). The group field is optional and defaults to device. The condition is evaluated before the outcome runs, so only users who meet it are messaged. Set negated: true to match on absence of a tag.

Send only to movie fans who haven’t tapped the promo
POST /api/pipelines HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json

{
   "name": "Movie promo welcome",
   "enabled": true,
   "immediate_trigger": "first_open",
   "condition": [
      {
         "and": [
            { "tag": { "tag_name": "likes_movies", "group": "interests" } },
            { "tag": { "tag_name": "tapped_movie_promo", "group": "engagement", "negated": true } }
         ]
      }
   ],
   "outcome": {
      "push": {
         "audience": "triggered",
         "device_types": ["ios", "android"],
         "notification": {
            "alert": "Check out this week's movie release."
         }
      }
   }
}