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,
|}>;

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

Method signature
function getAttribution(): Attribution | undefined;

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.

const attribution = Adjust.getAttribution();

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");