用户与 Adjust 链接交互时,其归因信息会发生更新。用户与深度链接交互时可能会发生这种情况。用户归因相关信息会在 AdjustAttribution
类中展现。
ADJAttribution 类属性
AdjustAttribution
类包含设备当前归因状态的细节。任何未针对用户填充的值都会返回 null
值。
只有在您的 ADJConfig
实例 needsCost
属性为 true
的情况下,才能访问下列值:
costType
costAmount
costCurrency
值 | 数据类型 | 描述 |
---|---|---|
trackerToken | NSString | 设备当前归因链接的识别码 |
trackerName | NSString | 设备当前归因链接的名称 |
network | NSString | 设备当前归因渠道的名称 |
campaign | NSString | 设备当前归因推广活动的名称 |
adgroup | NSString | 设备当前归因广告组的名称 |
creative | NSString | 设备当前归因素材的名称 |
clickLabel | NSString | 用于标记安装的点击标签 |
costType | NSString | 推广活动定价模型 (如 cpi) |
costAmount | NSNumber | 安装成本 |
costCurrency | NSString | 与成本关联的货币的 3 字符 ISO 4217 代码。 |
发生归因变化时触发函数
@property (nonatomic, weak, nullable) NSObject<adjustdelegate> *delegate;
SDK 可监听归因变更并在发现更新时调用一个函数。要配置您的委托函数:
- 如果您使用的不是 web 视图,请将
AdjustDelegate
声明添加到您的AppDelegate
标头文件中。
class AppDelegate: UIResponder, UIApplicationDelegate, AdjustDelegate {}
@interface AppDelegate : UIResponder <UIApplicationDelegate, AdjustDelegate>
- 添加委托回传功能至您的应用委托执行 (app delegate implementation)。
class AppDelegate: UIResponder, UIApplicationDelegate, AdjustDelegate { func adjustAttributionChanged(_ attribution: ADJAttribution?) { /// ... }}
- (void)adjustAttributionChanged:(ADJAttribution *)attribution { /// ...}
- 用 Adjust config 实例设置委托。
let yourAppToken = "{YourAppToken}"let environment = ADJEnvironmentSandboxlet adjustConfig = ADJConfig( appToken: yourAppToken, andEnvironment: environment)adjustConfig?.delegate = self//...Adjust.initSdk(adjustConfig)
ADJConfig *adjustConfig = [[ADJConfig alloc] initWithAppToken:@"{YourAppToken}" andEnvironment:ADJEnvironmentSandbox];/// ...[Adjust initSdk:adjustConfig];
在委托函数内,您可以访问 Attribution
信息。要获取可用属性列表,请查看 ADJAttribution
类属性。
获取当前归因信息
+ (void)attributionWithCompletionHandler:(nonnull ADJAttributionGetterBlock)completion;
用户安装您的应用时,Adjust 会将该安装归因至一个推广活动。Adjust SDK 可提供赢得安装归因的推广活动细节。要返回此信息,请使用 completion handler 调用[Adjust attributionWithCompletionHandler]
方法。SDK 会异步调取归因信息,并将其作为ADJAttribution
对象传递至您的 completion handler 代码。
Adjust.attribution() { attribution in // add your completion handler}
[Adjust attributionWithCompletionHandler:^(ADJAttribution * _Nullable attribution) { // add your completion handler}
用户与 Adjust 链接交互时,其归因信息会发生更新。用户与深度链接交互时可能会发生这种情况。用户归因相关信息会在 AdjustAttribution
类中展现。
ADJAttribution 类属性
AdjustAttribution
类包含设备当前归因状态的细节。任何未针对用户填充的值都会返回 null
值。
只有在您的 ADJConfig
实例 needsCost
属性为 true
的情况下,才能访问下列值:
costType
costAmount
costCurrency
值 | 数据类型 | 描述 |
---|---|---|
trackerToken | NSString | 设备当前归因链接的识别码 |
trackerName | NSString | 设备当前归因链接的名称 |
network | NSString | 设备当前归因渠道的名称 |
campaign | NSString | 设备当前归因推广活动的名称 |
adgroup | NSString | 设备当前归因广告组的名称 |
creative | NSString | 设备当前归因素材的名称 |
clickLabel | NSString | 用于标记安装的点击标签 |
adid | NSString | 设备的唯一 Adjust ID |
costType | NSString | 推广活动定价模型 (如 cpi) |
costAmount | NSNumber | 安装成本 |
costCurrency | NSString | 与成本关联的货币的 3 字符 ISO 4217 代码。 |
发生归因变化时触发函数
@property (nonatomic, weak, nullable) NSObject<adjustdelegate> *delegate;
SDK 可监听归因变更并在发现更新时调用一个函数。要配置您的委托函数:
- 如果您使用的不是 web 视图,请将
AdjustDelegate
声明添加到您的AppDelegate
标头文件中。
class AppDelegate: UIResponder, UIApplicationDelegate, AdjustDelegate {}
@interface AppDelegate : UIResponder <UIApplicationDelegate, AdjustDelegate>
- 添加委托回传功能至您的应用委托执行 (app delegate implementation)。
class AppDelegate: UIResponder, UIApplicationDelegate, AdjustDelegate { func adjustAttributionChanged(_ attribution: ADJAttribution?) { /// ... }}
- (void)adjustAttributionChanged:(ADJAttribution *)attribution { /// ...}
- 用 Adjust config 实例设置委托。
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, ); });});
在委托函数内,您可以访问 Attribution
信息。要获取可用属性列表,请查看 ADJAttribution
类属性。
获取当前归因信息
+ (nullable ADJAttribution *)attribution;
用户安装您的应用时,Adjust 会将该安装归因至一个推广活动。Adjust SDK 可提供赢得安装归因的推广活动细节。要返回此信息,请调用attribution
方法,以ADJAttribution
对象的形式返回归因信息。
let attribution = Adjust.attribution()
ADJAttribution *attribution = [Adjust attribution];
var attribution = Adjust.getAttribution();