Adjust

Set attributes and trigger automations from Adjust.

Adjust provides mobile measurement capabilities, helping you learn about your audience. This integration helps you take advantage of your audience data from Adjust in Airship, either to segment your audience or to trigger automated messages.

To set up this integration, you must:

  1. Associate channel_id values with Adjust’s airship_channel_id callback parameter.
  2. Provide a token to Adjust.
  3. Create Attributes in Airship to receive audience data set by Adjust.

SDK Setup

To use the Adjust integration, you must add Adjust dependencies and associate Airship Channel IDs with Adjust’s airship_channel_id callback parameter.

Android Setup

For more information, see the Adjust Android SDK Docs

  1. Add dependencies to build.gradle
    implementation 'com.adjust.sdk:adjust-android:4.22.0'
    implementation 'com.android.installreferrer:installreferrer:1.1.2'
  2. Associate channel IDs with Adjust airship_channel_id
    String channelId = UAirship.shared().getChannel().getId();
    Adjust.addSessionPartnerParameter("airship_channel_id", channelId);

iOS Setup

For iOS, you must add the Adjust dependency to your Podfile and then associate channel IDs with Adjust’s airship_channel_id callback parameter. For more information, see the Adjust iOS SDK Docs.

Add dependency to Podfile
  1. If this is your first time using CocoaPods, Install CocoaPods using gem install cocoapods. Otherwise, continue to Step 3.
  2. Run pod setup to create a local CocoaPods spec mirror.
  3. Create a Podfile in your Xcode project directory by running pod init in your terminal, edit the Podfile generated and add the dependency pod 'Adjust', '~> 4.22.1'.
  4. Run pod install in your Xcode project directory. CocoaPods should download and install the added library, and create a new Xcode workspace. Open up this workspace in Xcode or typing open *.xcworkspace in your terminal.

Swift: Associate channel IDs with Adjust airship_channel_id
let channelId = UAirship.channel()?.identifier
if (channelId != nil) {
 Adjust.addSessionPartnerParameter("airship_channel_id", value: channelId!)
}

Objective-C: Associate channel IDs with Adjust airship_channel_id
NSString *channelId = [UAirship channel].identifier;
[Adjust addSessionPartnerParameter:@"airship_channel_id" value:channelId];

Adjust Setup

You’ll generate a token in Airship and provide the token to Adjust to enable this integration. After you set up the integration in Airship, you’ll need to determine the events and parameters that you want to send from Adjust to Airship.

To turn on Adjust’s integration with Airship:

  1. In Airship, generate a Token with the All Access role. You’ll provide your token and app key to Adjust to enable this integration.
    1. Go to Settings » APIs & Integrations » Tokens.
    2. Click Create Token.
    3. Enter a token Name. This is just a friendly name to help you recognize your tokens in Airship.
    4. Select the Role you want to grant for this token. For additional information, see Airship API Security.
      • Audience Modification: Grants read and write permission to audience APIs, including channels, named users, segments, lists, etc. Use this permission for users sending custom events into Airship.
      • All Access: Grants full access to your Airship project, except IBM UBX integrations. You should use this permission when creating a token for an inbound message handling webhook.
    5. Click Create Token.
    6. Copy the values, then click Got it to close the window.
  2. In Adjust, click your app’s options caret (^) and select Partner Setup » ADD PARTNERS.

  3. Select Add   next to Airship.

  4. Enter your Airship Key and Token.

  5. Enable the Events and Attributes that you want to send from Adjust to Airship.

    • In-App Revenue Forwarding sends Revenue Events into Airship as custom events.
    • Session Forwarding sends information about in-app sessions to Airship as custom events.
    • Parameter Forwarding sets attributes on your Airship audience, according to the Partner Parameter Mapping.
  6. (Optional) Click Event Linking to set custom name parameters for events from Adjust.

  7. (Optional) Click Partner Parameter Mapping to see the names of attributes that Adjust will set on your Airship audience. If you change a parameter name mapping here, you’ll need to create a new attribute in Airship to receive the adjust parameter.

  8. Click Save.

Create Adjust Attributes in Airship

You must create attributes in Airship before Adjust can set attributes on your audience. If an Attribute ID does not exist in Airship, or is of the wrong type, Adjust will not be able to set an attribute on your audience.

Repeat the following process for each entry in the table below to create your Adjust attributes. Use the Attribute ID and Type exactly as they appear in the table.

  1. Go to Audience » Attributes » Attribute List and click Create Attribute.

  2. Fill in your attribute using the Attribute ID, Name, and Type exactly as listed in the table below.

  3. Click Add.

Attribute NameAdjust parameterAttribute IDType
Adjust Device IDadidadjust_device_idText
Adjust Device Citycityadjust_device_cityText
Adjust Device Country Subdivisioncountry_subdivisionadjust_device_country_subdivisionText
Adjust Device Country Codecountryadjust_device_country_codeText
Adjust Device Currency Codecurrencycurrency adjust_currency_codeText
Adjust Device Model Numberdevice_nameadjust_device_model_numberText
Adjust Google Play Store Store Ad ID MD5 Hashgps_adid_md5adjust_gps_ad_id_md5Text
Adjust Google Play Store Ad IDgps_adidadjust_gps_ad_idText
Adjust Device IP Addressip_addressadjust_device_ip_addressText
Adjust Is Reattributedis_reattributedadjust_is_reattributedNumber1
Adjust Device ISPispadjust_device_ispText
Adjust Device Language Codelanguageadjust_device_language_codeText
Adjust Last Session Time in Secondslast_time_spentadjust_last_time_spentNumber
Adjust Lifetime Session Countlifetime_session_countadjust_lifetime_session_countNumber
Adjust Attribution Methodmatch_typeadjust_attribution_methodText
Adjust OAID Device ID MD5 Hashoaid_md5adjust_oaid_device_id_md5Text
Adjust OAID Device IDoaidadjust_oaid_device_idText
Adjust Device Postal Codepostal_codeadjust_device_postal_codeText
Adjust Random Device Reference Tagreftagadjust_reftagText
Adjust Device Region Coderegionadjust_device_region_codeText
Adjust Reporting Currencyreporting_currencyadjust_reporting_currencyText
Adjust SDK Versionsdk_versionadjust_sdk_versionText
Adjust Session Countsession_countadjust_session_countNumber
Adjust Current Session Time in Secondstime_spentadjust_time_spentNumber
Adjust Tracking Enabledtracking_enabledadjust_tracking_enabledNumber1
Adjust Tracking Limitedtracking_limitedadjust_tracking_limitedNumber1
Adjust Web Unique IDweb_uuidadjust_web_uuidText

1 Value is either 0 (false) or 1 (true/enabled).

Airship Channel Example with Adjust Attributes

Attributes appear in an attributes object on the channel. Attributes won’t appear on channels until set from Adjust.

Airship channel example
{
   "channel_id": "516a818b-b57e-4a35-b7ad-41c6ef447364",
   "device_type": "android",
   "installed": true,
   "opt_in": true,
   "background": true,
   "push_address": "<push_address>",
   "created": "2019-07-31T00:10:34",
   "last_registration": "2020-08-17T08:11:46",
   "alias": null,
   "tags": [],
   "tag_groups": {
      "group": [
         "tags"
      ]
   },
   "device_attributes": {
      "ua_device_os": "10",
      "ua_country": "US",
      "ua_device_model": "SM-G973U",
      "ua_local_tz": "America/Los_Angeles",
      "ua_app_version": "<version>",
      "ua_location_settings": "true",
      "ua_language": "en",
      "ua_sdk_version": "13.2.0",
      "ua_carrier": "Verizon "
   },
   "attributes": {
      "adjust_lifetime_session_count": 45,
      "adjust_device_postal_code": "97209",
      "adjust_device_region_code": "US",
   }
}

Custom Event Properties from Adjust

Events from Adjust are of the Custom type, with the body.name of the event representing the Adjust event type — install, rejected install, session, in-app event, reattribution, or rejected reattribution. Properties from Adjust appear in the body.properties object.

Custom Event PropertyDescription
adjust_attribution_methodAttribution method
partner_parametersCustom partner parameters collected by the Adjust SDK or S2S request and transmitted to third party providers via postbacks
reporting_revenueRevenue, as reported in the Adjust Dashboard, in whole currency units
revenue_floatRevenue, as sent from Adjust SDK, in whole currency units
revenue_usd_centsRevenue, in US cents
revenue_usdRevenue, in US dollars
revenueRevenue, as sent from Adjust SDK in cents

Sample Adjust Custom Event
{
    "id": "aae70da5-a276-4dd4-a11e-f5b5796a52f1",
    "offset": "1000000000780",
    "occurred": "2020-08-17T22:37:53.000Z",
    "processed": "2020-08-17T22:40:35.337Z",
    "device": {
        "ios_channel": "c014a2ed-4c30-4f6d-a9b3-e2ba7a01b45c",
        "channel": "c014a2ed-4c30-4f6d-a9b3-e2ba7a01b45c",
        "device_type": "IOS",
        "attributes": {
            "locale_variant": "",
            "app_version": "1.0",
            "device_model": "x86_64",
            "connection_type": "WIFI",
            "app_package_name": "com.urbanairship.partner.adjust",
            "iana_timezone": "America/Los_Angeles",
            "push_opt_in": "false",
            "locale_country_code": "US",
            "device_os": "13.0",
            "locale_timezone": "-25200",
            "locale_language_code": "en",
            "location_enabled": "false",
            "background_push_enabled": "false",
            "ua_sdk_version": "13.2.0",
            "location_permission": "UNPROMPTED"
        }
    },
    "body": {
        "name": "session",
        "session_id": "c014a2ed-4c30-4f6d-a9b3-e2ba7a01b45c",
        "source": "API",
        "properties": {
            "adjust_attribution_method": "",
            "partner_parameters": "",
            "reporting_revenue": 25,
            "revenue_float": 25.00,
            "revenue_usd_cents": 2500,
            "revenue_usd": 25,
            "revenue": 2500
        }
    },
    "type": "CUSTOM"
}