# Audience Management Integrate audience management features into your .NET app. This guide covers how to identify contacts, access channel IDs, and set tags, attributes, and subscription lists on channels and contacts. For information about using these features for segmentation and targeting, see the [Audience User Guide]({{< ref "/guides/audience/segmentation/segmentation.md" >}}). # Channels > Access and manage channel IDs and listen for channel creation. Each device/app install will generate a unique identifier known as the Channel ID. Once a Channel ID is created, it will persist in the application until the app is reinstalled, or has its internal data is cleared. For information about finding Channel IDs, using the Channel Capture tool, and other methods to access Channel IDs, see [Finding Channel IDs](https://www.airship.com/docs/guides/getting-started/developers/identifiers/). ## Accessing the Airship Channel ID Apps can access the Channel ID directly through the SDK. ```csharp string channelId = Airship.Instance.ChannelId; ``` The Channel ID is asynchronously created, so it may not be available right away on the first run. Changes to Channel data will automatically be batched and applied when the Channel is created, so there is no need to wait for the Channel to be available before modifying any data. Applications that need to access the Channel ID can use a listener to be notified when it is available. ```csharp static void OnChannelCreation(object sender, ChannelEventArgs args) { Console.WriteLine("Channel created: " + args.ChannelId); } Airship.Instance.OnChannelCreation += OnChannelCreation; ``` ## Delaying channel creation Airship creates the channel if at least one feature is enabled in the Privacy Manager. To delay channel creation, use the Privacy Manager to disable all features during initialization. For more information about Privacy Manager, see [SDK Data Collection](https://www.airship.com/docs/reference/data-collection/sdk-data-collection/). # Contacts > Identify contacts, reset contacts, and get named user IDs. A Contact is any user in your project. Contacts are identified as either an Anonymous Contact or a Named User. Airship can set targeting data on these identifiers, which are also used to map devices and channels to a specific user. For detailed information about contacts and named users, see [Named users](https://www.airship.com/docs/guides/audience/named-users/). ## Managing the Contact's identifier (Named User ID) Identify can be called multiple times with the same Named User ID. The SDK will automatically deduplicate `identify` calls made with the same Named User ID. If the ID is changed from a previous value, the Contact will automatically be dissociated from the previous Named User ID. ```csharp Airship.Instance.Contact.Identify("some named user ID"); ``` If the user logs out of the device, you may want to reset the contact. This will clear any anonymous data and dissociate the contact from the Named User ID, if set. This should only be called when the user manually logs out of the app, otherwise you will not be able to target the Channel by its Contact data. ```csharp Airship.Instance.Contact.Reset(); ``` You can get the Named User ID only if you set it through the SDK. ```csharp string namedUserId = await Airship.Instance.Contact.GetNamedUserIdAsync(); ``` # Tags > 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](https://www.airship.com/docs/guides/audience/tags/). ## 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. ```csharp // 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 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. ```csharp 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. ```csharp 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](https://www.airship.com/docs/guides/audience/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. # Attributes > Set channel and contact attributes as key-value pairs for personalization. For information about Attributes, including overview, use cases, and how to target Attributes, see [About Attributes](https://www.airship.com/docs/guides/audience/attributes/about/). ## Channel Attributes Channel attributes are attributes managed on the Channel by the SDK. ```csharp Airship.Instance.Channel.EditAttributes() .SetAttribute("device_name", "Bobby's Phone") .SetAttribute("average_rating", 4.99) .RemoveAttribute("vip_status") .Apply(); ``` ## Contact Attributes Contact attributes are attributes managed on the Contact by the SDK. ```csharp Airship.Instance.Contact.EditAttributes() .SetAttribute("first_name", "Bobby") .Apply(); ``` ## Verifying Attributes To verify that attributes have been set correctly, look up the channel or contact in the [Contact Management](https://www.airship.com/docs/guides/audience/contact-management/) view. You can search by Channel ID or Named User ID to view the attributes associated with a channel or contact. # Subscription Lists > Manage channel and contact subscription lists for topic-based messaging. For information about Subscription Lists, including overview, use cases, and how to create subscription lists, see [Subscription Lists](https://www.airship.com/docs/guides/audience/segmentation/audience-lists/subscription/). ## Channel Subscription Lists Channel subscriptions apply only to the single channel. ```csharp // Modifying channel subscription lists Airship.Instance.Channel.EditSubscriptionLists() .Subscribe("food") .Unsubscribe("sports") .Apply(); // Fetching channel subscription lists List channelSubscriptions = await Airship.Instance.Channel.FetchSubscriptionLists(); ``` ## Contact Subscription Lists Contact subscriptions are set at the user-level and require a Channel scope specifying the types that the subscription list applies to. ```csharp // Modifying contact subscription lists Airship.Instance.Contact.EditSubscriptionLists() .Subscribe("food", ChannelScope.App) .Unsubscribe("sports", ChannelScope.Sms) .Apply(); // Fetching contact subscription lists Dictionary> subscriptions = await Airship.Instance.Contact.GetSubscriptionListsAsync(); ``` ## Verifying Subscription Lists To verify that subscription lists have been set correctly, look up the channel or contact in the [Contact Management](https://www.airship.com/docs/guides/audience/contact-management/) view. You can search by Channel ID or Named User ID to view the subscription lists associated with a channel or contact.