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.contact.identify("NamedUserID")
[UAirship.contact identify:@"NamedUserID"];
Airship.contact.reset()
[UAirship.contact reset];
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.
Airship.channel.editAttributes { editor in
editor.set(string: "Bobby's Phone", attribute: "device_name")
editor.set(number: 4.99, attribute: "average_rating")
editor.remove("connection_type")
}
[UAirship.channel editAttributes:^(UAAttributesEditor * editor) {
[editor setString:@"Bobby's Phone" attribute:@"device_name"];
[editor setNumber:@(4.99) attribute:@"average_rating"];
[editor removeAttribute:@"connection_type"];
}];
Airship.contact.editAttributes { editor in
editor.set(string: "Bobby", attribute: "first_name")
}
[UAirship.contact editAttributes:^(UAAttributesEditor * editor) {
[editor setString:@"Bobby" attribute:@"first_name"];
}];
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.
// Edit tags
Airship.channel.editTags { editor in
editor.set(["one", "two", "three"])
editor.add("a_tag")
editor.remove("three")
}
[UAirship.channel editTags:^(UATagEditor *editor) {
[editor setTags:@[@"one", @"two", @"three"]];
[editor addTag:@"a_tag"];
[editor removeTag:@"three"];
}];
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 UAPush instance
if you want to modify this “default” Tag Group.
Airship.channel.editTagGroups { editor in
editor.add(["silver-member", "gold-member"], group:"loyalty")
editor.remove(["bronze-member", "club-member"], group:"loyalty")
editor.set(["bingo"], group:"games")
}
[UAirship.channel editTagGroups:^(UATagGroupsEditor *editor) {
[editor addTags:@[@"silver-member", @"gold-member"] group:@"loyalty"];
[editor removeTags:@[@"bronze-member", @"club-member"] group:@"loyalty"];
[editor setTags:@[@"bingo"] group:@"games"];
}];
Airship.contact.editTagGroups { editor in
editor.add(["silver-member", "gold-member"], group:"loyalty")
editor.remove(["bronze-member", "club-member"], group:"loyalty")
editor.set(["bingo"], group:"games")
}
[UAirship.contact editTagGroups:^(UATagGroupsEditor *editor) {
[editor addTags:@[@"silver-member", @"gold-member"] group:@"loyalty"];
[editor removeTags:@[@"bronze-member", @"club-member"] group:@"loyalty"];
[editor setTags:@[@"bingo"] group:@"games"];
}];
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 identifier with a couple of extra lines to your application:
let channelID = Airship.channel.identifier
print("My Application Channel ID: \(channelID)")
NSString *channelID = UAirship.channel.identifier;
NSLog(@"My Application Channel ID: %@", channelID);
Don’t worry if this value initially comes back as null on your app’s first run as the Channel ID will be created and persisted during registration.
You can listen for channel creation by adding an NSNotificationCenter
observer
for
UAChannel channelCreatedEvent
.
Categories