Tags for the Apple SDK

Set device tags, contact tags, and tag groups for audience segmentation.

For information about tags, including how to use them for segmentation and targeting, see the Tags user guide.

Channel Tags

Channel tags are tags managed on the Channel by the SDK. Device tags (tags without a group) can be modified or fetched from the Channel.

Modifying channel tags

Airship.channel.editTags { editor in
    editor.set(["one", "two", "three"])
    editor.add("a_tag")
    editor.remove("three")
}

// Accessing channel tags
let tags = Airship.channel.tags
[UAirship.channel editTags:^(UATagEditor *editor) {
    [editor setTags:@[@"one", @"two", @"three"]];
    [editor addTag:@"a_tag"];
    [editor removeTag:@"three"];
}];

// Accessing channel tags
NSArray* tags = [[UAirship channel] tags];

Channel Tag Groups

Tag groups are tags scoped within a group. Tag groups can be modified from the SDK but cannot be fetched. Device tags (tags without a group) can be fetched. If you need to be able to fetch tag groups, consider using subscription lists.

Modifying channel tag groups

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"];
}];

Contact Tag Groups

Contact tag groups are tags scoped within a group at the Contact level. Tag groups can be modified from the SDK but cannot be fetched. If you need to be able to fetch tag groups, consider using subscription lists.

Modifying contact tag groups

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"];
}];

Verifying Tags

To verify that tags have been set correctly, look up the channel or contact in the Contact Management view. You can search by Channel ID or Named User ID to view the tags and tag groups associated with a channel or contact.