When a user interacts with an Adjust link, their attribution information updates. This can happen if the user interacts with a deep link. Information about a user’s attribution is represented in the AdjustAttribution
class.
ADJAttribution class properties
The AdjustAttribution
class contains details about the current attribution status of the device. Any values that aren’t populated for the user are returned as a null
value.
Values | Data type | Description |
---|---|---|
trackerToken | NSString | The token of the link to which the device is currently attributed |
trackerName | NSString | The name of the link to which the device is currently attributed |
network | NSString | The name of the network to which the device is currently attributed |
campaign | NSString | The name of the campaign to which the device is currently attributed |
adgroup | NSString | The name of the adgroup to which the device is currently attributed |
creative | NSString | The name of the creative to which the device is currently attributed |
clickLabel | NSString | The click label that the install is tagged with |
adid | NSString | The unique Adjust ID assigned to the device |
costType | NSString | The campaign pricing model (for example cpi) |
costAmount | NSNumber | The cost of the install. |
costCurrency | NSString | The 3 character ISO 4217 code of the currency associated with the cost. |
Trigger a function when attribution changes
@property (nonatomic, weak, nullable) NSObject<AdjustDelegate> *delegate;
The SDK can listen for attribution changes and call a function when it detects an update. To configure your delegate function:
- If you aren’t using web views, add the
AdjustDelegate
declaration to yourAppDelegate
header file.
class AppDelegate: UIResponder, UIApplicationDelegate, AdjustDelegate {}
@interface AppDelegate : UIResponder <UIApplicationDelegate, AdjustDelegate>
- Add the delegate callback function to your app delegate implementation.
class AppDelegate: UIResponder, UIApplicationDelegate, AdjustDelegate { func adjustAttributionChanged(_ attribution: ADJAttribution?) { /// ... }}
- (void)adjustAttributionChanged:(ADJAttribution *)attribution { /// ...}
- Set the delegate with your Adjust config instance.
let yourAppToken = "{YourAppToken}"let environment = ADJEnvironmentSandbox as? Stringlet adjustConfig = ADJConfig( appToken: yourAppToken, environment: environment)adjustConfig?.delegate = self//...Adjust.appDidLaunch(adjustConfig)
*adjustConfig = [ADJConfig configWithAppToken:@"{YourAppToken}" environment:ADJEnvironmentSandbox];[adjustConfig setDelegate:self];/// ...[Adjust appDidLaunch:adjustConfig];
setupWebViewJavascriptBridge(function (bridge) { var yourAppToken = yourAppToken; var environment = AdjustConfig.EnvironmentSandbox; var adjustConfig = new AdjustConfig(yourAppToken, environment); adjustConfig.setAttributionCallback(function (attribution) { // In this example, we're just displaying alert with attribution content. alert( "Link = " + attribution.trackerToken + "\n" + "Link name = " + attribution.trackerName + "\n" + "Network = " + attribution.network + "\n" + "Campaign = " + attribution.campaign + "\n" + "Adgroup = " + attribution.adgroup + "\n" + "Creative = " + attribution.creative + "\n" + "Click label = " + attribution.clickLabel + "\n" + "Adid = " + attribution.adid, ); });});
Within your delegate function, you have access to the user’s Attribution
information. See the ADJAttribution
class properties for a list of available properties.
Get current attribution information
+ (nullable ADJAttribution *)attribution;
When a user installs your app, Adjust attributes the install to a campaign. The Adjust SDK gives you access to campaign attribution details for your install. To return this information, call the attribution
method to return the attribution information as an ADJAttribution
object.
let attribution = Adjust.attribution()
ADJAttribution *attribution = [Adjust attribution];
var attribution = Adjust.getAttribution();