Segmentation
You can define your audience based on named users, attributes, tags, tag groups, and Airship channel IDs.
Named Users
Named Users allow you to associate multiple devices to a single user or profile that may be associated with more than one device, e.g., an end-user’s tablet and phone. A device can have only one Named User, and a single Named User should not be associated with more than 50 devices. Named Users provide the ability to directly set tags on them.
By default, Named Users can only be associated server-side, via the API. A 403 Forbidden response is returned if Named User association is attempted when client-side association is disabled. In order to associate a Named User through the application, you must change the application’s Named Users security setting to allow Named Users to be set from devices. See: Enable Named Users.

Associating the channel with a Named User ID will implicitly disassociate the channel from the previously associated Named User ID, if an association existed.
Airship.Instance.NamedUser = "NamedUserID";
Airship.Instance.NamedUser = null;
Attributes
Attributes are metadata that you can use for audience segmentation. Attributes differ from tags in that when evaluating users with attributes, Airship uses operators, e.g., equals, less than/greater than, contains, before/after, to determine whether or not to target a user. Supported attribute types are TEXT, NUMBER, and DATE. For more information see the attributes guide.
// Set string and number attributes
Airship.Instance.EditChannelAttributes()
.SetAttribute("device_name", "Bobby's Phone")
.SetAttribute("average_rating", 4.99)
.RemoveAttribute("connection_type")
.Apply();
Tag-based segmentation
Tags are an easy way to group channels. Many tags can be applied to one or
more devices. Then, a message sent to a tag will be sent out to all devices that
are associated with that tag. After modifying tags, make sure to call updateRegistration
to have the SDK sync the tags with Airship.
// Add tags
Airship.Instance.EditDeviceTags()
.AddTags(new string[] { "one", "two", "three" })
.Apply();
// Add a tag
Airship.Instance.EditDeviceTags()
.AddTag("a_tag")
.Apply();
// Remove a tag
Airship.Instance.EditDeviceTags()
.RemoveTag("a_tag")
.Apply();
Tag groups
A tag group is an array of tags that you can associate with both channels and named users. In addition to the Airship default tag groups, you can create custom tag groups in the dashboard. See the Tag Groups documentation for more details, including security information.
If setting channel tags is enabled on the device, the predefined device
Tag
Group cannot be modified from the device and will log an error message. Disable
channel tags by disabling channelTagRegistrationEnabled
on the UAChannel instance
if you want to modify this “default” Tag Group.
// Add tags to a group
Airship.Instance.EditChannelTagGroups()
.AddTags(new string[] { "silver-member", "gold-member" }, "loyalty")
.Apply();
// Remove tags from a group
Airship.Instance.EditChannelTagGroups()
.RemoveTags(new string[] { "bronze-member", "club-member"}, "loyalty")
.Apply();
// Set tags on a group
Airship.Instance.EditChannelTagGroups()
.SetTags(new string[] { "bingo" }, "games")
.Apply();
// Add tags to a group
Airship.Instance.EditNamedUserTagGroups()
.AddTags(new string[] { "silver-member", "gold-member" }, "loyalty")
.Apply();
// Remove tags from a group
Airship.Instance.EditNamedUserTagGroups()
.RemoveTags(new string[] { "bronze-member", "club-member" }, "loyalty")
.Apply();
// Set tags on a group
Airship.Instance.EditNamedUserTagGroups()
.SetTags(new string[] { "bingo" }, "games")
.Apply();
Airship Channel IDs
The Channel ID is a unique identifier that ties together an application/device pair on iOS devices. The Channel ID is used to target pushes to specific devices using the Airship API.
The Channel ID will be logged for all apps. You can get the Channel ID by adding one extra line to your application:
string channelId = Airship.Instance.ChannelId;
Don’t worry if this value initially comes back as null on your app’s first run (or after clearing the application data), as the Channel ID will be created and persisted during registration.
Categories