Amplitude

Airship Real-Time Data Streaming 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.

Amplitude Integration Requirements

To get started, you must obtain the following:

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

Airship Tags in Amplitude

If you elect 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"
}

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 ID. Example code is provided below.

 Note

If the Apple Advertising ID (IDFA) or Android Advertising ID (AAID) isn’t set on the user, Airship will not send over any data. We will only send events that have the IDFA/AAID associated with them.

iOS

Add the iOS Advertising ID:

// Get the current identifiers
let identifiers = UAirship.shared().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.shared().analytics.associateDeviceIdentifiers(identifiers)
// Get the current identifiers
UAAssociatedIdentifiers *identifiers = [[UAirship shared].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 shared].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 » 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 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. Click Activate.

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