Segmentation

Addressing Devices

To help target specific devices or users for a notification, we have Tags, Named Users and Tag Groups.

Tags

Tags allow you to attribute arbitrary metadata to a specific device. Common examples include favorites such as sports teams or news story categories.

Modifying tags
// Add tag
UAirship.Shared.AddTag ("some-tag");

// Remove tag
UAirship.Shared.RemoveTag ("other-tag");
Getting tags
// Get tags
IEnumerable<string> tags = UAirship.Shared.Tags;

Named Users

 Note

Associating the channel with a Named User ID, will implicitly disassociate the channel from the previously associated Named User ID, if it existed.

Named Users allow you to associate multiple devices to a single user or profile that may be associated with more than one device, e.g., an end-user's Android phone and tablet. A device can have only one Named User, and a single Named User should not be associated with more than 50 devices. Named Users provide the ability to directly set tags on them (see Tag Groups).

Setting a named user
UAirship.Shared.NamedUserId = "coolNamedUserId";

By default, Named Users cannot be associated from the device. In this case if the devices attempts a Named User association, the association will fail and the plugin will log an error. In order to change this setting, go to Settings » APIs & Integrations » Named Users.

Tag Groups

Tag groups are configurable namespaces for organizing tags for the channel and Named User. Please view the Tag Groups documentation for more details. The Create and push to a tag group guides you through creating and using Tag Groups.

Channel Tag Group Example
UAirship.Shared.EditChannelTagGroups ()
     .AddTag ("loyalty", "silver-member")
     .RemoveTag ("loyalty", "bronze-member")
     .Apply ();
Named User Tag Group Example
UAirship.Shared.EditNamedUserTagGroups ()
     .AddTag ("loyalty", "silver-member")
     .RemoveTag ("loyalty", "bronze-member")
     .Apply ();

By default, Tag Groups cannot be modified from the device. In this case if a device attempts to modify Tag Groups, the modification will fail and the SDK will log an error. In order to change this setting, follow the steps in Manage Tag Groups.

Custom Identifiers

In addition to Named Users, tags, and Tag Groups, you can assign up to 20 custom identifiers to users. Identifiers that define additional ways of looking at a user -- for example, iOS Vendor ID, iOS Advertising ID, Google Analytics CID, or any other identifier you deem significant -- can be added to your users.

Associating an identifier
UAirship.Shared.AssociateIdentifier ("some key", "some identifier");

Custom identifiers will be visible in Real-Time Data Streaming. We recommend adding any IDs that you may want to be visible in your event stream, even if Real-Time Data Streaming does not yet support the relevant integration. Unlike the other identifiers (e.g., tags), you cannot use custom identifiers to target your users.

Airship Channel IDs

The Channel ID is a unique identifier that ties together an application/device pair on a mobile device. The Channel ID is used to target pushes to specific devices using the Airship API. Once a Channel ID is created, it will persist in the application. It may or may not change when the application is reinstalled. For more information on platform-specific operation, see the Android and iOS documentation.

Don't worry if this value initially comes back as null on your app's first run (or after clearing the application data), as the Channel ID will be created and persisted during registration. To receive an event when the Channel ID is created, see Listening for Events.

Getting the Channel ID
string channelId = UAirship.Shared.ChannelId;