About Attributes

Attributes are metadata used for audience segmentation and personalization. They extend the concept of Tags by adding comparison operators and values to determine whether or not to target a user, helping you better evaluate your audience.

Tags versus Attributes

Consider the example below — you want to target fans of the actor Chris Pine. To accomplish this, you specify an audience of users with the TagMetadata that you can associate with channels or named users for audience segmentation. Generally, they are descriptive terms indicating user preferences or other categorizations, e.g., wine_enthusiast or weather_alerts_los_angeles. Tags are case-sensitive. chris_pine. Either a user has this tag, or not. Note: These API examples can also be used in the dashboard.

Tag audience
{
   "audience": {
      "tag": "chris_pine"
   }
}

But let’s say you wanted to target fans of All The Chrises: Chris Pine, Chris Evans, Chris Pratt, and Chris Hemsworth. With Attributes, you can set your audience to target users whose favorite_actor Attribute contains the value chris, and you will reach all the Chris fans.

Attributes audience
{
   "audience": {
      "attribute": "favorite_actor",
      "operator": "contains",
      "value": "chris"
   }
}

It’s a silly example, but hopefully you can begin to see the power of comparison operators for Attributes.

Attribute types

User information can be stored in an Attribute as text or as a number, date, or JSON object. Each Attribute type is named for the schema that defines what values it accepts. Text, Number, and Date schemas are determined by Airship. You provide your own schema for JSON Attributes.

Values accepted for each Attribute type:

Attribute typeValue formatComments
TextStringn/a
NumberNumber or float valueWhen setting Number Attributes, you can provide your value as an integer, float, or string.
DateISO 8601 date-time formatted string: YYYY-MM-DDTHH:MM:SSYou can set an offset by appending the date-time with +HH:MM. For example, 2020-07-20T12:35:42+08:00. Date Attributes are converted to and stored as UTC.
JSONAn object containing one or more key-value pairs and arraysJSON Attributes are not available in Performance AnalyticsA customizable marketing intelligence tool that provides access to reports and graphs based on engagement data.. See following page section for additional information.

JSON Attributes

JSON Attributes are data objects containing one or more key-value pairs and arrays. You can think of them as collections of information you can assign to a user. Example use cases:

  • Retailer — Store user preferences and send sale or discount messages about items you know a user will be interested in and with personalized content for their preferred brands, colors, etc.

  • Airline — Store a user’s booking information and send confirmation and update messages leading up to, during, and after their trip. Messages would contain their confirmation code, flight numbers, origin and destination airport codes, and departure and arrival times.

For each JSON Attribute, you create a template for the structure and what data to store. The template is the schema and the data is defined as properties. Using the above airline use case, you could have an Attribute with ID reservation and create a schema for the confirmation code and lists of like data types (departures and arrivals) with properties for flight numbers, airport codes, and times.

In addition to the properties defined in your provided schema, each JSON Attribute has a property exp for its expiration date, represented as the number of seconds since the epoch (January 1st, 1970). After expiration, Airship ignores the Attribute where used in segmentation and personalization. When setting a JSON Attribute on a user, if a value for exp is not provided, Airship automatically sets a value of 90 days from the current date and time.

Each instance of setting a JSON Attribute on a user is defined by an instance ID, which is used as a reference for the property values set for that user.

The following describes associating the data with users and targeting and personalization options:

TopicHow it worksAirline use case example
Setting the Attribute on your audienceUse the API to set JSON Attributes on a user, specifying an instance ID and values for properties.When a user books a round-trip flight, you could assign the reservation Attribute with instance ID a001. The JSON data assigned for instance reservation#a001 would contain a list of each flight leg going to the destination and each returning flight leg.
Targeting the AttributeYou target a JSON Attribute's properties, not the object as a whole. All instances of the Attribute are evaluated for matches. Any user that matches the target is included in the message audience.For a flight update message, you could target any user with the Attribute reservation where the initial leg of their trip departs from airport PDX. Any user with that Attribute and value PDX for the airport code property would be included in the message audience.
Personalizing contentIn message content, you can reference JSON Attributes by instance ID or evaluate all instances of the Attribute. In both cases, the message content populates with the property values set for a user.In a flight update message, you could reference reservation properties, and the message would contain user-specific details about how the change affects their trip.

Categories, data sources, and setup

Attributes can come from the Airship SDKs, users, and you.

Data sources, descriptions, and setup per Attribute category:

CategoryData sourceDescriptionSetup
DefaultAirship SDKsAirship automatically sets Default Attributes on your audience. See reference Default Attributes.None.
NPS surveyUser answers to Net Promoter Score (NPS) surveys in ScenesMulti-screen experiences that are cached on users’ devices and displayed when your users meet certain conditions within your app, such as viewing a particular screen or opening the app a certain number of times. Scenes can include survey questions or be presented as a story. and SurveysQuestion-and-answer experiences used to collect and aggregate feedback or generate a net promoter score. They are cached on users’ devices and displayed when your users meet certain conditions within your app, such as viewing a particular screen or opening the app a certain number of times.Airship automatically generates Attributes based on the NPS score or category. See the Segmentation section in About Scenes and About Surveys. See reference NPS survey Attributes.None.
PredefinedCustomerPreformatted Text and Number Attributes you can use to ensure consistency across reports and Performance AnalyticsA customizable marketing intelligence tool that provides access to reports and graphs based on engagement data.. For example, ID first_name for first name, and ID last_name for last name. See reference Predefined Attributes.Add Attributes in your project settings then set them on your audience.
CustomCustomerYou can add any Attribute type to your project.Add Attributes in your project settings then set them on your audience.
 Warning

To target users based on a unique user ID or other external identifier, do not use Custom Attributes. Instead, target Named UserA customer-provided identifier used for mapping multiple devices and channels to a specific individual..

Personalization

You can use Attributes in a message body to personalize content for each user. See Personalizing messages using Attributes.