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 tags. You’ll need to perform a sync operation to set tags on your audience in the amplitude tag group.

Amplitude Integration Requirements

To get started, you must obtain the following:

  • An Enterprise plan with Amplitude
  • An Airship plan that includes Real-Time Data Streaming

Once your contract details are in order, the setup is straightforward. Below is a summary checklist followed by detailed instructions. We will also send you to the Amplitude documentation for the Amplitude-specific steps.

  1. Install Airship and Amplitude SDKs in your project.
  2. Set Airship channel ID as a custom User Property in Amplitude.
  3. Associate advertising identifiers with Airship channels.
  4. Add respective credentials to Airship and Amplitude dashboards to enable segmentation for behavioral cohorts.

Amplitude Setup

In your Amplitude environment, follow the steps in the Airship/Amplitude Integration Guide. We’ll see you back here shortly.

User Association Client Code

Next, you will associate the Amplitude identifierForVendor with the Airship Channel IDAn Airship-specific unique identifier used to address a channel instance, e.g., a smartphone, web browser, email address. . If Airship cannot set the Amplitude user ID or device ID, Airship will not send the event.

For Airship RTDS events to be sent to Amplitude:

  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 the 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 AAID nor IDFA is present Otherwise, Airship sets the channel ID associated with event as the Amplitude device ID.
  4. If Airship cannot set the Amplitude user ID or device ID, Airship will not send the event.
 Important

If IDFA (Apple Advertising ID) was not set to be collected by Airship SDK during configuration, it will not be sent to Amplitude.

The following code examples demonstrate how to add the advertising ID on each supported platform:

iOS

Swift: 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)

Objective C: Add the iOS Advertising ID
// 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];

See iOS Custom Identifiers for more information.

Android

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();

See Android Custom Identifiers for more information.

Airship Integration Setup

  1. Go to Settings » Project Configuration and click Manage for Real-Time Data Streaming.

  2. Under Real-Time Data Streaming, click Amplitude.

     Tip

    Previously configured integrations are listed under Enabled Integrations.

  3. Configure a new Amplitude integration:

    • Enter a user-friendly name and description.
    • Enter your Amplitude API key, found in your Amplitude app settings.
    • Select the Event Types that you want to send into Amplitude.
      • Closes
      • Control
      • Custom Events
      • Email Subscription
      • First Opens
      • First Opt-In
      • In-App Message Expiration, Resolution, and Display Events
      • Location
      • Message Center Read, Delivery, and Delete Events
      • Opens
      • Region
      • Screen Viewed
      • Sends
      • Send Rejected
      • Short Link Click
      • SMS Mobile-Originated
      • Tag Changes
      • Uninstalls
      • Web Notification Session
      • Web Notification Click
  4. Under Data Center Region, check the radio button that corresponds with the region where you have implemented Amplitude: either US or EU. If you are unsure which data center you are on please contact our support team.

  5. Click Activate.

Airship will begin sending events from your Airship app to your Amplitude instance.

Airship Tags in Amplitude

If you select to send Tag Change events from Airship to Amplitude, Airship will use Amplitude’s identify API to apply tags from the current object in tag_change events on your Amplitude audience as user properties.

Airship tags will appear on your Amplitude audience as user_properties: "Airship tag_group": ["tag1", "tag2"].

Tags as user_properties in Amplitude
{
   "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"]
   }
}
tag_change event from Airship
{
  "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"
}

Set Tags from Amplitude Behavioral Cohorts

You can Sync Cohorts to leverage your behavioral cohorts from Amplitude in Airship as tags. To take advantage of Amplitude cohorts in Airship, you must create an amplitude tag group to receive tags.

Tags from Amplitude use the name of your project in Amplitude and the cohort ID for the cohort that you sync to Airship — [Amplitude] Project Name xacjmzs.

  1. In Airship, create an amplitude tag group if it does not already exist.
    1. Go to Settings » Project Configuration and click Manage for Tag Groups.
    2. Click Create Tag Group and configure the fields.
      • Name: This name appears elsewhere in the dashboard, so choose something easily understandable and that describes the associated database, e.g., “Amplitude Integrations”
      • Description: The description should supplement the name, giving additional information about the tag group, if necessary. Be descriptive enough that anyone in your company would understand its source and purpose.
      • Group Key: Enter amplitude. This permanent, unique ID is the text you will use when referring to your tag group in the API.
    3. Click Save.
  2. In Amplitude, create a behavioral cohort.
  3. Click Sync To… and select Airship.Airship will assign a tag representing the cohort to applicable members of your audience in Airship. The tag appears in the amplitude tag group as [Amplitude] <CohortName>:<cohortId>.
 Tip

You can target your Amplitude cohort in Airship using the Amplitude tag group and the name of the tag you exported.

{
   "audience": {
      "group": "amplitude",
      "tag": "[Amplitude] Project Name xacjmzs"
   }
}