Tags for the .NET Package

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.

// Add tags
Airship.Instance.Channel.EditTags()
    .Add("one")
    .Add("two")
    .Add("three")
    .Apply();

// Add a tag
Airship.Instance.Channel.EditTags()
    .Add("a_tag")
    .Apply();

// Remove a tag
Airship.Instance.Channel.EditTags()
    .Remove("a_tag")
    .Apply();

// Accessing channel tags
IEnumerable<string> tags = await Airship.Instance.Channel.GetTagsAsync();

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.

Airship.Instance.Channel.EditTagGroups()
    .Add("silver-member", "loyalty")
    .Add("gold-member", "loyalty")
    .Set(new string[] { "bingo" }, "games")
    .Remove("bronze-member", "loyalty")
    .Remove("club-member", "loyalty")
    .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.

Airship.Instance.Contact.EditTagGroups()
    .Add("silver-member", "loyalty")
    .Add("gold-member", "loyalty")
    .Set(new string[] { "bingo" }, "games")
    .Remove("bronze-member", "loyalty")
    .Remove("club-member", "loyalty")
    .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.