Adjust

This guide describes how to add and configure Adjust integration.

Adjust is the industry leader in mobile measurement and fraud prevention.

How does Integration Work?

This integration works in two ways.

1. Receive Attribution Data from Adjust

Once you successfully configured Adjust integration, Apphud will receive attribution data from it. You can view this data on the user's page:

2. Send Subscription Events to Adjust

Apphud can also send all subscription events to Adjust. So you could view these events in Adjust dashboard and Adjust could pass this data to their partners. This will help to measure the efficiency of your ad campaigns.

How to Add Integration?

🚧

Collect advertising identifiers

For both iOS and Android you must manually provide advertising identifier by calling Apphud.setAdvertisingIdentifier(idfa)on iOS and Apphud.collectDeviceIdentifiers() on Android.

Step 1

Step 2

Open Adjust and sign in.

Step 3

Copy App token. Select your app and click here:

Copy App token:

Step 4

Create desired subscription events in Adjust, for example, "trial_started", "trial_converted", "subscription_renewed" etc. You can view the list of all available events here. You can create event tokens only for events that you need, there is no need to add all events.

In Adjust open app's "All Settings", go to the "Events" section and create necessary events. For each event, Adjust will generate a unique Event token.

As a result, you will have something like this:

Step 5

At Apphud go to "Integrations" section and add Adjust:

Step 6

Paste Adjust App Token into "App token" field:

Step 7

Paste Adjust Event tokens from step 4 into corresponding fields and turn on switches. Enable events that you need:

8

Enable integration:

Pass Attribution Data to Apphud (required)

Send attribution data to Apphud (or at least Adjust ID):

// set delegate
adjustConfig?.delegate = self
...

func adjustAttributionChanged(_ attribution: ADJAttribution?) {
    if let data = attribution?.dictionary() {
        Apphud.addAttribution(data: data, from: .adjust) { (result) in }
    } else if let adid = Adjust.adid() {
        Apphud.addAttribution(data: ["adid" : adid], from: .adjust) { (result) in }
    }
}

func adjustSessionTrackingSucceeded(_ sessionSuccessResponseData: ADJSessionSuccess?) {
    if let data = Adjust.attribution()?.dictionary() {
        Apphud.addAttribution(data: data, from: .adjust) { (result) in }
    } else if let adid = Adjust.adid() {
        Apphud.addAttribution(data: ["adid" : adid], from: .adjust) { (result) in }
    }
}
// set delegate to ADJConfig
config.delegate = self;
...

- (void)adjustAttributionChanged:(ADJAttribution *)attribution {
    [self sendAdjustAttribution:attribution];
}

- (void)adjustSessionTrackingSucceeded:(ADJSessionSuccess *)sessionSuccessResponseData {
    [self sendAdjustAttribution:Adjust.attribution];
}

- (void)sendAdjustAttribution:(ADJAttribution*)attribution {
    if (attribution != nil && attribution.adid != nil) {
            [Apphud addAttributionWithData:attribution.dictionary from:ApphudAttributionProviderAdjust identifer:nil callback:^(BOOL result) {
            }];
    } else if (Adjust.adid != nil) {
        [Apphud addAttributionWithData:@{@"adid" : Adjust.adid} from:ApphudAttributionProviderAdjust identifer:nil callback:^(BOOL result) {
            }];
    }
}
fun setupAdjust() {
    val listener = object : OnAttributionChangedListener {
        override fun onAttributionChanged(attribution: AdjustAttribution) {
            Apphud.addAttribution(ApphudAttributionProvider.adjust, attribution.convertToMap(), attribution.adid)
        }
    }
    val sessionListener = object : OnSessionTrackingSucceededListener {
        override fun onFinishedSessionTrackingSucceeded(sessionSuccessResponseData: AdjustSessionSuccess) {
            Apphud.addAttribution(ApphudAttributionProvider.adjust, null, sessionSuccessResponseData.adid)
        }
    }
    val env = AdjustConfig.ENVIRONMENT_PRODUCTION
    val config = AdjustConfig(this, "YOUR_ADJUST_TOKEN", env)
    config.setOnAttributionChangedListener(listener)
    config.setOnSessionTrackingSucceededListener(sessionListener)
    Adjust.onCreate(config)
    Apphud.collectDeviceIdentifiers()
}

fun AdjustAttribution.convertToMap() = mapOf<String, Any>(
    "trackerToken" to trackerToken,
    "trackerName" to trackerName,
    "network" to network,
    "campaign" to campaign,
    "adgroup" to adgroup,
    "creative" to creative,
    "clickLabel" to clickLabel,
    "adid" to adid
)
AdjustConfig adjustConfig = AdjustConfig(yourAppToken, environment);

config.sessionSuccessCallback = (AdjustSessionSuccess sessionSuccessData) {
  if (sessionSuccessData.adid != null) {
    print('[Adjust]: Adid: ' + sessionSuccessData.adid);
    Apphud.addAttribution(data: {'adid': sessionSuccessData.adid}, provider: ApphudAttributionProvider.adjust)
  }
};
config.sessionFailureCallback = (AdjustSessionFailure sessionFailureData) {
  if (sessionFailureData.adid != null) {
    print('[Adjust]: Adid: ' + sessionFailureData.adid);
    Apphud.addAttribution(data: {'adid': sessionFailureData.adid}, provider: ApphudAttributionProvider.adjust)
  }
};

Adjust.start(adjustConfig);

While configuring integration you can also choose between sending revenue as sales or proceeds (without Apple/Google 15%-30% commission).

📘

Note

You can read more how Apple calculates commission here.

❗️

Important Note

In order to receive Adjust attribution data from Facebook, you should accept Facebook’s "Advanced Mobile Measurement Agreement" using this link.

Collect Device Identifiers on Android (required)

For Android SDK 1.8.0 or higher, Advertising Identifier is not collected automatically. You must manually call Apphud.collectDeviceIdentifiers() method after SDK initialization.
When targeting Android 13 and above, you must also declare AD_ID permission in the manifest file.

Request IDFA Consent (required)

Starting iOS 14.5 access to IDFA requires user consent. You should request IDFA manually using AppTrackingTransparency framework and pass it to Apphud. Read more here.

Testing Adjust Integration (iOS)

To test Adjust integration from scratch you should do the following:

  • Reset IDFA (Settings > Privacy > Advertising > Reset Advertising Identifier).
  • Uninstall the app.
  • Make sure you initialized Adjust SDK with the ADJEnvironmentSandbox environment. Don't forget to change back to ADJEnvironmentProduction before release!
  • Make sure adjustAttributionChanged(_ attribution: ADJAttribution?) delegate method is called.
  • If the Adjust Attribution Data block exists in your user's page in Apphud, then integration is successful.
  • When viewing events in Adjust Dashboard, make sure you enabled Sandbox Mode in the filter pane.

Events Cheat Sheet

This is a list of all possible events and their parameters that can be sent to AppsFlyer.

📘

Note

You can read more about subscription events here and parameters here.

Trial

Trial period started parameters

  • partner_params.product_id: String

Successful conversion from trial period to regular subscription parameters

  • partner_params.product_id: String
  • revenue: Float
  • currency: String

Failed conversion from trial period to regular subscription parameters

  • partner_params.product_id: String
  • partner_params.reason: String

Cancellations

Trial Canceled parameters

  • partner_params.product_id: String

Subscription Canceled parameters

  • partner_params.product_id: String

Autorenew disabled parameters (Deprecated)

  • partner_params.product_id: String

Autorenew enabled parameters

  • partner_params.product_id: String

Introductory Offer

Introductory offer started parameters

  • partner_params.product_id: String
  • partner_params.offer_type: String
  • revenue: Float
  • currency: String

Introductory offer renewed parameters

  • partner_params.product_id: String
  • partner_params.offer_type: String
  • revenue: Float
  • currency: String

Successful conversion from introductory offer to regular subscription parameters

  • partner_params.product_id: String
  • partner_params.offer_type: String
  • revenue: Float
  • currency: String

Failed conversion from introductory offer to regular subscription or failed renewal parameters

  • partner_params.product_id: String
  • partner_params.reason: String
  • partner_params.offer_type: String

Refund during introductory offer parameters

  • partner_params.product_id: String
  • partner_params.offer_type: String
  • partner_params.reason: String

Regular

Subscription started parameters

  • partner_params.product_id: String
  • revenue: Float
  • currency: String

Subscription renewed parameters

  • partner_params.product_id: String
  • revenue: Float
  • currency: String

Subscription expired parameters

  • partner_params.product_id: String
  • partner_params.reason: String

Subscription refunded parameters

  • partner_params.product_id: String
  • partner_params.reason: String

Promo Offer

Promotional offer started parameters

  • partner_params.product_id: String
  • partner_params.offer_id: String
  • partner_params.offer_type: String
  • revenue: Float
  • currency: String

Promotional offer renewed parameters

  • partner_params.product_id: String
  • partner_params.offer_id: String
  • partner_params.offer_type: String
  • revenue: Float
  • currency: String

Successful conversion from promotional offer to regular subscription parameters

  • partner_params.product_id: String
  • partner_params.offer_id: String
  • partner_params.offer_type: String
  • revenue: Float
  • currency: String

Failed conversion from promotional offer to regular subscription or failed renewal parameters

  • partner_params.product_id: String
  • partner_params.offer_id: String
  • partner_params.offer_type: String
  • partner_params.reason: String

Refund during promotional offer parameters

  • partner_params.product_id: String
  • partner_params.offer_id: String
  • partner_params.offer_type: String
  • partner_params.reason: String

Other Events

Non-renewing purchase parameters

  • partner_params.product_id: String
  • revenue: Float
  • currency: String

Non-renewing purchase refunded parameters

  • partner_params.product_id: String
  • partner_params.reason: String

Billing issue parameters

  • partner_params.product_id: String

Billing issue resolved parameters

  • partner_params.product_id: String

Please note: we don't send revenue properties with refund events. That's because Adjust API currently doesn't support sending revenue with a negative value.

📘

Note

For each event, Apphud includes the environmentparameter depending on the environment of the subscription.