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

  • 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.

Configuring the Amplitude Integration

In Airship:

  1. Go to Settings » Project Configuration and click Manage for Partner Integrations.
  2. Select Amplitude.
  3. Click Configure for the inbound integration and follow the onscreen instructions to:

Amplitude Setup

In your Amplitude environment, follow the steps in Send Cohorts to Airship. 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 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 Custom Identifiers for more information.

Airship Outbound Integration Setup

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, either US or EU. If you are unsure which data center you are on please contact our Support team.

In Airship:

  1. Go to Settings » Project Configuration and click Manage for Real-Time Data Streaming.
  2. Under Real-Time Data Streaming, select Amplitude. Previously configured integrations are listed under Enabled Integrations.
  3. Follow the onscreen instructions to configure the integration.

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"
   }
}