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.
AdjustAttribution 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.
Trigger a function when attribution changes
public setAttributionCallback(callback: (attribution: AdjustAttribution) => void): void
The SDK can listen for attribution changes and call a function when it detects an update. To configure your callback function, call the setAttributionCallback
method with your function as an argument.
const adjustConfig = new AdjustConfig(appToken, environment);
adjustConfig.setAttributionCallback(function (attribution) { // Printing all attribution properties. console.log("Attribution changed!"); console.log(attribution.trackerToken); console.log(attribution.trackerName); console.log(attribution.network); console.log(attribution.campaign); console.log(attribution.adgroup); console.log(attribution.creative); console.log(attribution.clickLabel); console.log(attribution.costType); console.log(attribution.costAmount); console.log(attribution.costCurrency); console.log(attribution.fbInstallReferrer);});
Adjust.initSdk(adjustConfig);
Get current attribution information
getAttribution: (callback: (attribution: AdjustAttribution) => void) => void
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 getAttribution
method to return the attribution information as an AdjustAttribution
object.
Adjust.getAttribution((attribution) => { console.log("Tracker token = " + attribution.trackerToken); console.log("Tracker name = " + attribution.trackerName); console.log("Network = " + attribution.network); console.log("Campaign = " + attribution.campaign); console.log("Adgroup = " + attribution.adgroup); console.log("Creative = " + attribution.creative); console.log("Click label = " + attribution.clickLabel);});