adjust-icon

获取归因信息

用户与 Adjust 链接交互时,其归因信息会发生更新。用户与深度链接交互时可能会发生这种情况。用户归因相关信息会在 AdjustAttribution 类中展现。

AdjustAttribution 类属性

AdjustAttribution 类包含设备当前归因状态的细节。任何未针对用户填充的值都会返回 null 值。

发生归因变化时触发函数

属性声明
public setAttributionCallback(callback: (attribution: AdjustAttribution) => void): void

SDK 可监听归因变更并在发现更新时调用一个函数。要配置您的回传函数,请使用函数作为参数调用 setAttributionCallback 方法。

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

获取当前归因信息

方法签名
getAttribution: (callback: (attribution: AdjustAttribution) => void) => void

用户安装您的应用时,Adjust 会将该安装归因至一个推广活动。Adjust SDK 可提供赢得安装归因的推广活动细节。要返回此信息,请调用getAttribution方法,以AdjustAttribution对象的形式返回归因信息。

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