AppLovin MAX SDK 12.6.0 版本引入了一种隐私安全的方式来定向瀑布流。此版本中引入的 API 针对通用键-值数字配对方法作为目标。您负责映射代表您所针对用户的细分键和适用值
For example, you could establish segments that represent the genres that interest a user.
You could represent these segments with the key number 849.
Genre values might include “horror”, “thriller”, and “romance”.
You could represent these by the values of 1, 2, and 3 respectively.
定义上述键和值后,则可以使用下面的代码将一位用户添加到恐怖和浪漫类型分群中:
ALSdkInitializationConfiguration *initConfig = [ALSdkInitializationConfiguration configurationWithSdkKey: «SDK-key» builderBlock:^(ALSdkInitializationConfigurationBuilder *builder) {
builder.mediationProvider = ALMediationProviderMAX;
builder.segmentCollection = [MASegmentCollection segmentCollectionWithBuilderBlock:^(MASegmentCollectionBuilder *builder) {
[builder addSegment: [[MASegment alloc] initWithKey: @(849) values: @[@(1), @(3)]]];
}];
}];
⋮
[sdk initializeWithConfiguration: initConfig completionHandler:^(ALSdkConfiguration *sdkConfig) { …
let initConfig = ALSdkInitializationConfiguration(sdkKey: "«SDK-key»") { builder in
builder.mediationProvider = ALMediationProviderMAX
builder.segmentCollection = MASegmentCollection { segmentCollectionBuilder in
segmentCollectionBuilder.add(MASegment(key: 849, values: [1, 3]))
}
}
⋮
sdk.initialize(with:initConfig) { sdkConfig in …AppLovin 建议您在发送广告请求时传递应用内容 URL,方便买方进行上下文分析或审查。 某些 DSP 买家可能需要此信息。 您可以在竞价请求中发送该 URL。
下面的代码片段展示了在发送广告请求时如何传递应用内容 URL:
self.bannerAd = [[MAAdView alloc] initWithAdUnitIdentifier: @"«ad-unit-ID»"];
[self.bannerAd setExtraParameterForKey: @"content_url" value: @"«value»"];
self.interstitialAd = [[MAInterstitialAd alloc] initWithAdUnitIdentifier: @"«ad-unit-ID»"];
[self.interstitialAd setExtraParameterForKey: @"content_url" value: @"«value»"];
self.mrecAd = [[MAAdView alloc] initWithAdUnitIdentifier: @"«ad-unit-ID»" adFormat: MAAdFormat.mrec ];
[self.mrecAd setExtraParameterForKey: @"content_url" value: @"«value»"];
self.nativeAdLoader = [[MANativeAdLoader alloc] initWithAdUnitIdentifier: @"«ad-unit-ID»"];
[self.nativeAdLoader setExtraParameterForKey: @"content_url" value: @"«value»"];
self.rewardedAd = [MARewardedAd sharedWithAdUnitIdentifier: @"«ad-unit-ID»"];
[self.rewardedAd setExtraParameterForKey: @"content_url" value: @"«value»"];
let bannerAd = MAAdView(adUnitIdentifier: "«ad-unit-ID»")
bannerAd.setExtraParameterForKey("content_url", value: "«value»")
let interstitialAd = MAInterstitialAd(adUnitIdentifier: "«ad-unit-ID»")
interstitialAd.setExtraParameterForKey("content_url", value: "«value»")
let mrecAd = MAAdView(adUnitIdentifier: "«ad-unit-ID»", adFormat: MAAdFormat.mrec)
mrecAd.setExtraParameterForKey("content_url", value: "«value»")
let nativeAdLoader = MANativeAdLoader(adUnitIdentifier: "«ad-unit-ID»")
nativeAdLoader.setExtraParameterForKey("content_url", value: "«value»")
let rewardedAd = MARewardedAd.shared(withAdUnitIdentifier: "«ad-unit-ID»")
rewardedAd.setExtraParameterForKey("content_url", value: "«value»")您可以在竞价流中传递 UID2 token。 买方使用这些 token 定向应用广告位并对广告位进行准确竞价。 您负责生成 token 并将其发送至 AppLovin。 以下代码示例展示了传递 token 的方法:
ALSdkSettings *settings = [ALSdk shared].settings;
[settings setExtraParameterForKey: @"uid2_token" value: @"«value»"];
let settings = ALSdk.shared()?.settings
settings?.setExtraParameterForKey("uid2_token", value: "«value»")