Amplitude

AIRSHIP MAINTAINED INTEGRATION

This integration is maintained by Airship. Please contact Airship for support.

Airship Real-Time Data StreamingA service that delivers engagement events in real time via the Data Streaming API or an Airship partner integration. (RTDS) delivers user-level information about push sends, conversions, and uninstall events. Adding Airship’s unique information to Amplitude gives you a full view of what’s going on in and around your app.

By adding user-level mobile engagement data to your Amplitude data, you can leverage Amplitude Behavioral Cohorts for targeting via Airship.

You can also leverage Amplitude’s behavioral cohorts in Airship as TagsMetadata that you can associate with channels or named users for audience segmentation. Generally, they are descriptive terms indicating user preferences or other categorizations, e.g., wine_enthusiast or weather_alerts_los_angeles. Tags are case-sensitive..

Amplitude Integration Requirements

  • Accounts
    1. Amplitude — Enterprise Account
    2. Airship — Must include both:
  • Airship project
    • The Airship SDK must use the same user identity as the Amplitude SDK.

Inbound Integration

The inbound integration applies Amplitude user information to Airship users as TagsMetadata that you can associate with channels or named users for audience segmentation. Generally, they are descriptive terms indicating user preferences or other categorizations, e.g., wine_enthusiast or weather_alerts_los_angeles. Tags are case-sensitive.. It works by syncing an Amplitude behavioral cohort with Airship. Airship then sets Tags on the applicable users. Once your data is in Airship, you can target users who do or do not have those Tags.

The Tags appear in the amplitude Tag GroupAn array of tags that you can associate with both channels and named users. and contain the name and ID of your synced Amplitude cohort in the format [Amplitude] <cohort name>: <cohortID>. For example: [Amplitude] Has Sent Notification: y4isxl9.

See also Cohorts and user behavior in Amplitude’s documentation.

Configuring the Inbound Integration

In Airship:

  1. Go to Settings.
  2. Under Project Configuration, select Manage for Partner Integrations.
  3. Select Amplitude.
  4. Select Configure for the inbound integration and follow the onscreen instructions to:

From your new cohort in Amplitude, select Sync, then Airship. Airship will start setting Tags representing your Amplitude data on applicable members of your Airship audience.

You can continue syncing on demand or set up recurring or real-time syncing. See Sync to third-party destinations in Amplitude’s Syncs and integrations documentation.

Targeting Users

In the API, target using the "audience" object. Specify the amplitude Tag Group and the Tag in the format [Amplitude] <cohort name>: <cohortID>.

Targeting Amplitude Tags
{
   "audience": {
      "group": "amplitude",
      "tag": "[Amplitude] Has Sent Notification: y4isxl9"
   }
}

To target in the dashboard, create a SegmentA grouping of audience members selected by unique or shared identifiers. Multiple identifiers can be combined within a segment. and add a Tag as a condition. First select the amplitude Tag Group, then search for a Tag and complete configuring the Segment. For individual messages, you can create a single-use Segment while creating the message. You can also create reusable Segments instead of having to recreate your audience selections.

For In-App AutomationMessages that are cached on users’ devices and displayed when your users meet certain conditions within your app, such as viewing a particular screen or opening the app a certain number of times., ScenesMulti-screen experiences that are cached on users’ devices and displayed when your users meet certain conditions within your app, such as viewing a particular screen or opening the app a certain number of times. Scenes can include survey questions or be presented as a story., and SurveysQuestion-and-answer experiences used to collect and aggregate feedback or generate a net promoter score. They are cached on users’ devices and displayed when your users meet certain conditions within your app, such as viewing a particular screen or opening the app a certain number of times., you cannot target server-side Tags directly. Instead, create a reusable Segment that includes the tags you added using this integration, then select that Segment in the Audience step in the composer. See Segments in Target Specific Users: In-App Experiences. Required: iOS SDK 14.2+Android SDK 14.1+

For more information, see Targeting users in the Tags documentation.

Outbound Integration

The outbound integration sends your Airship events to Amplitude using Real-Time Data StreamingA service that delivers engagement events in real time via the Data Streaming API or an Airship partner integration..

For those events:

  1. Airship sets the Named UserA customer-provided identifier used for mapping multiple devices and channels to a specific individual. associated with the event as the Amplitude user ID.
  2. If Named User is not present, Airship sets the Android Advertising ID (AAID) or Apple Advertising ID (IDFA) associated with the event as the Amplitude device ID.
  3. If neither the AAID nor IDFA is present, Airship sets the Channel IDAn Airship-specific unique identifier used to address a channel instance, e.g., a smartphone, web browser, email address. associated with the event as the Amplitude device ID. If your app is configured to exclude collecting the IDFA by the Airship SDK, it cannot be sent to Amplitude.
  4. If Airship cannot set the Amplitude user ID or device ID, Airship will not send the event.

Configuring the Outbound Integration

You will need your Amplitude API key, found in your Amplitude app settings. You will also need to know the region where you have implemented Amplitude so you can select a data center, either US or EU. If you are unsure which region to select, contact Airship Support.

In Airship:

  1. Go to Settings.
  2. Under Project Configuration, select Manage for Partner Integrations.
  3. Select Amplitude.
  4. Select Configure for the outbound integration and follow the onscreen instructions to:
    • Add your Amplitude API key.
    • Select a data center location.
    • Select the Airship events to send to Amplitude.

After completing setup, Airship will begin sending events from your Airship project to your Amplitude instance.

Setting Advertising IDs

For Airship RTDS events without an associated Named UserA customer-provided identifier used for mapping multiple devices and channels to a specific individual., you can collect advertising IDs to be used as device IDs for events sent to Amplitude. See Custom Identifiers for more information. The following code examples demonstrate how to add the advertising ID on each supported platform.

For iOS, associate the Apple advertisingID with the Airship Channel IDAn Airship-specific unique identifier used to address a channel instance, e.g., a smartphone, web browser, email address.. If applicable, you can also associate Apple’s identifierForVendor with the Channel ID. For more information, see identifierForVendor in Apple’s UIKit documentation.

Add the iOS Advertising ID

// Get the current identifiers
let identifiers = Airship.analytics.currentAssociatedDeviceIdentifiers()

// Set the advertising ID info
identifiers.advertisingID = ASIdentifierManager.sharedManager().advertisingIdentifier.UUIDString;
identifiers.advertisingTrackingEnabled = ASIdentifierManager.sharedManager().advertisingTrackingEnabled;
identifiers.vendorID = UIDevice.currentDevice().identifierForVendor?.UUIDString

// Associate the identifiers
Airship.analytics.associateDeviceIdentifiers(identifiers)
// Get the current identifiers
UAAssociatedIdentifiers *identifiers = [UAirship.analytics currentAssociatedDeviceIdentifiers];

// Set the advertising ID info
identifiers.advertisingID = [[ASIdentifierManager sharedManager].advertisingIdentifier] UUIDString];
identifiers.advertisingTrackingEnabled = [ASIdentifierManager sharedManager].advertisingTrackingEnabled;
identifiers.vendorID = [[UIDevice currentDevice].identifierForVendor UUIDString];

// Associate the identifiers
[UAirship.analytics associateDeviceIdentifiers:identifiers];

For Android, associate the Android Advertising ID with the Airship Channel ID.

Automatically track the Android Advertising ID
UAirship.shared().getAnalytics().setAutoTrackAdvertisingIdEnabled(true);

Manually track the Android Advertising ID
// Get the Android Advertising ID info - This call is blocking and should be done in a
// background thread.
AdvertisingIdClient.Info adInfo = AdvertisingIdClient.getAdvertisingIdInfo(getContext());

UAirship.shared().getAnalytics()
   .editAssociatedIdentifiers()
   .setAdvertisingId(adInfo.getId(), adInfo.isLimitAdTrackingEnabled())
   .apply();

Tag Change Mapping

For tag_change events in outbound integrations, Airship uses Amplitude’s Identify API to apply Tags on your Amplitude audience.

Tags in an tag_change event’s current object appear as user_properties in an Amplitude identifyEvent. They appear in the format Airship <Tag Group name>": ["<Tag name>", "<Tag name>"]. Compare the two in the following code samples.

An Airship tag_change event
{
  "id": "00000169-4a14-67b2-1ddd-d9e733622c3a",
  "occurred": "2019-03-04T19:00:45.106Z",
  "offset": "1000001260057",
  "processed": "2019-03-04T19:00:47.094Z",
  "type": "SEND_REJECTED",
  "device": {
    "ios_channel": "1ef235f0-03d5-1384-893e-a19b5cd0d110",
    "channel": "1ef235f0-03d5-1384-893e-a19b5cd0d110",
    "device_type": "IOS",
    },
  "body":{
    "add": {
        "crm": [
          "partner",
          "active"
        ],
        "loyalty": [
          "silver_member"
        ]
    },
    "remove": {
        "device": [
          "shoe_buyer"
        ]
    },
    "current": {
        "crm": [
          "partner",
          "active",
          "new_user"
        ],
        "loyalty": [
          "silver_member",
          "special_offers"
        ],
        "device": [
          "san_francisco",
          "sports"
        ]
      }
    },
  "type": "TAG_CHANGE"
}
Amplitude user_properties
{
   "user_properties": {
      "ios_channel": "1ef235f0-03d5-1384-893e-a19b5cd0d110",
      "channel": "1ef235f0-03d5-1384-893e-a19b5cd0d110",
      "device_type": "IOS",
      "Airship crm": ["partner", "active", "new_user"],
      "Airship loyalty": ["silver_member", "special_offers"],
      "Airship device": ["san_francisco", "sports"]
   }
}