# Audience Management Integrate audience management features into your Flutter app to identify users, set attributes, manage tags, and control subscription lists for targeted messaging. # 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. ```dart // Get the channel ID (may return null if not yet created) String? channelId = await Airship.channel.identifier; // Wait for the channel ID to be created (returns the channel ID once available) String channelId = await Airship.channel.waitForChannelId(); ``` The Channel ID is asynchronously created, so it may not be available right away on the first run. Use `waitForChannelId()` if you need to wait for the channel to be created before proceeding. 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. ```dart Airship.channel.onChannelCreated.listen((event) { debugPrint('Channel created $event'); }); ``` ## Channel Capture tool The Channel Capture tool is a feature built into the SDK that helps users find their Channel ID. For detailed information about how it works and how to use it, see [Finding Channel IDs](https://www.airship.com/docs/guides/getting-started/developers/identifiers/). The Channel Capture tool can be disabled through the Airship Config options passed to `takeOff` during SDK initialization. For information about setting up the Airship SDK and configuring `AirshipConfig`, see [Flutter SDK Setup](https://www.airship.com/docs/developer/sdk-integration/flutter/installation/getting-started/). ```dart Airship.takeOff( AirshipConfig( ... isChannelCaptureEnabled: false ) ); ``` ## 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 takeOff. 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. ```dart Airship.contact.identify(namedUserId); ``` 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. ```dart Airship.contact.reset(); ``` You can get the Named User ID only if you set it through the SDK. ```dart await Airship.contact.namedUserId; ``` # 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. ```dart Airship.channel.addTags(["flutter"]); Airship.channel.removeTags(["some-tag"]); // Accessing channel tags List tags = await Airship.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. ```dart Airship.channel.editTagGroups() ..addTags("loyalty", ["silver-member"]) ..removeTags("loyalty", ["bronze-member"]) ..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. ```dart Airship.contact.editTagGroups() ..addTags("loyalty", ["silver-member"]) ..removeTags("loyalty", ["bronze-member"]) ..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. ```dart Airship.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. ```dart Airship.contact.editAttributes() ..setAttribute("first_name", "Bobby") ..apply() ``` ## JSON Attributes JSON Attributes are data objects containing one or more string, number, date, or boolean key-value pairs. ```dart Airship.contact.editAttributes() ..setJsonAttribute("attribute_name", "instance_id", {"key":"value", "another_key":"another_value"}) ..removeJsonAttribute("some_attribute_name", "some_instance_id") ..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. ```dart // Modifying channel subscription lists Airship.channel.editSubscriptionLists() ..subscribe("food") ..unsubscribe("sports") ..apply(); // Fetching channel subscription lists List channelSubscriptions = await Airship.channel.subscriptionLists; ``` ## 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. ```dart // Modifying contact subscription lists Airship.contact.editSubscriptionLists() ..subscribe("food", ChannelScope.app) ..unsubscribe("sports", ChannelScope.sms) ..apply(); // Fetching contact subscription lists Map> contactSubscriptions = await Airship.contact.subscriptionLists; ``` ## 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.