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.

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:

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.

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

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

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

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

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. Create an amplitude tag group if it does not already exist.
    1. Go to Settings » APIs & Integrations » 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., “Segment 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 segment-integration. 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.

  4. 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] <your_project_name> <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"
   }
}