Attribution callbacks

You can register a delegate callback to notify you of tracker attribution changes. The Adjust SDK cannot provide this information synchronously. This is due to the different sources considered for attribution.

Follow the steps in this article to implement the optional delegate protocol in your app.

Important:
To set up the delegate callback, you need to configure it in your ADJConfig instance. This means you will need to add the setDelegate call before you call the appDidLaunch method.
  1. If you are not using web views, add the AdjustDelegate declaration to your AppDelegate header file.
Objective-C
Swift

In your AppDelegate.h file:

@interface AppDelegate : UIResponder <UIApplicationDelegate, AdjustDelegate>
  1. If you are not using web views, add the delegate callback function to your app delegate implementation.
Objective-C
Swift

In your AppDelegate.m file:

- (void)adjustAttributionChanged:(ADJAttribution *)attribution {
}
  1. Set the delegate with your Adjust config instance.
Objective-C
Swift
Javascript
[adjustConfig setDelegate:self];

The SDK will call the delegate function after receiving its final attribution data. Within the delegate function, you will have access to the attribution object.

All properties are returned as a JSON object. Any values that are not populated will be sent back as nil.

Note:
Cost data (costType, costAmount, and costCurrency) are only available when the needsCost property on the config object is set to true.
ValuesData typeDescription
trackerTokenStringThe token of the tracker to which the device is currently attributed.
trackerNameStringThe name of the tracker to which the device is currently attributed.
networkStringThe name of the network to which the device is currently attributed.
campaignStringThe name of the campaign to which the device is currently attributed.
adgroupStringThe name of the adgroup to which the device is currently attributed.
creativeStringThe name of the creative to which the device is currently attributed.
clickLabelStringThe click label that the install is tagged with.
adidStringThe unique Adjust ID assigned to the device.
costTypeStringThe campaign pricing model (e.g. cpi).
costAmountNumberThe cost of the install.
costCurrencyStringThe code of the currency associated with the cost. This should be a three character string that follows the ISO 4217 standard

User attribution

You can call the attribution method to get the user's current attribution. This will return all the information found in the ADJAttribution class as a JSON object.

Note:
Information about current attribution is available after the backend has tracked the installation. The attribution callback will fetch this information for you to use.
Objective-C
Swift
Javascript
ADJAttribution *attribution = [Adjust attribution];