adjust-icon

Get attribution information

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 an Attribution object.

The Attribution object contains the following information:

Interface declaration
export type AttributionMapT = $ReadOnly<{|
adid: string,
tracker_token: string,
tracker_name: string,
network?: string,
campaign?: string,
adgroup?: string,
creative?: string,
click_label?: string,
state: string,
|}>;
ValuesData typeDescription
adidstringThe device’s unique Adjust identifier.
tracker_tokenstringThe link token associated with the attribution.
tracker_namestringThe name of the campaign link.
networkstringThe network associate with the campaign.
campaignstringThe name of the campaign associated with the attribution.
adgroupstringThe adgroup associated with the attribution.
creativestringThe creative associated with the attribution.
click_labelstringThe click label associated with the attribution.
statestringThe current state of the attribution. Either installed or reattributed

Trigger a callback when attribution changes

Property declaration
attributionCallback: (string, Object) => mixed;

The SDK can listen for attribution changes and call a function when it detects an update. You can set an attribution callback method by specifying an attributionCallback function in the initSdk method. Within your function, you have access to the user’s attribution information.

Adjust.initSdk({
appToken: "YOUR_APP_TOKEN",
environment: "sandbox",
attributionCallback: function (e, attribution) {
console.log("Adid: " + attribution.adid);
console.log("Tracker Token: " + attribution.tracker_token);
console.log("Tracker Name: " + attribution.tracker_name);
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.click_label);
console.log("Attribution State: " + attribution.state);
},
});

Get current attribution information

Changed in 5.7.0

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. The waitForAttribution method returns a promise that resolves when the SDK successfully receives attribution data from the server.

Adjust.waitForAttribution().then((attr) =>
console.log(JSON.stringify(attr, undefined, 2)),
);

Set a referrer

Method signature
function setReferrer(referrer: string): void;

You can set a referrer to trigger an SDK click with a custom click ID when the SDK starts. The SDK sends your custom click ID to Adjust’s servers for attribution purposes.

To set your referrer, call the setReferrer method and pass your referrer as a URL-encoded string argument.

Adjust.setReferrer("adjust_external_click_id%3DEXTERNAL_CLICK_ID");