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.

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 customer-provided identifier used for mapping multiple devices and channels to a specific individual..

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.

Triggering Automations and Sequences

Automations and Sequences can act on tags at three points:

  • Trigger — Start an Automation or Sequence when a tag changes.
  • Condition — Require a tag to deliver a message.
  • Exit — Remove users from a Sequence when a tag changes.

In the dashboard

Configure tag-driven behavior in 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 via 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."
         }
      }
   }
}