Tags for the Android 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 {
    addTag("some_tag")
    removeTag("some_other_tag")
}

// Accessing channel tags
val tags = Airship.channel.tags
Airship.getChannel().editTags()
    .addTag("some_tag")
    .removeTag("some_other_tag")
    .apply();

// Accessing channel tags
ArrayList<String> tags = Airship.getChannel().getTags();

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 {
    addTag("loyalty", "bronze-member")
    removeTag("loyalty", "bronze-member")
    setTag("games", "bingo")
}
Airship.getChannel().editTagGroups()
    .addTag("loyalty", "bronze-member")
    .removeTag("loyalty", "bronze-member")
    .setTag("games", "bingo")
    .apply();

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 {
    addTag("loyalty", "bronze-member")
    removeTag("loyalty", "bronze-member")
    setTag("games", "bingo")
}
Airship.getContact().editTagGroups()
    .addTag("loyalty", "bronze-member")
    .removeTag("loyalty", "bronze-member")
    .setTag("games", "bingo")
    .apply();

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.