数据和关键词传递
分群定向
AppLovin MAX SDK 12.6.0 版本能在保护隐私的同时定向瀑布流和 Direct Sold campaign。 此版本中引入的 API 使用通用键-值数字配对方法。
您来决定每个键和值的含义。
例如,您可以针对用户感兴趣的类型创建分群,
并使用键值 849
代表这些分群。
类型值可能包括“恐怖”、“惊悚”和“爱情”。
这些可以分别用 1
、2
和 3
来表示。
定义上述键和值后,则可以使用下面的代码将一位用户添加到恐怖和浪漫类型分群中:
val initConfig = AppLovinSdkInitializationConfiguration.builder( "«SDK-key»", this ) .setMediationProvider( AppLovinMediationProvider.MAX ) .setSegmentCollection( MaxSegmentCollection.builder() .addSegment( new MaxSegment( 849, Arrays.asList( 1, 3 ) ) ) .build() ) .build();⋮AppLovinSdk.getInstance( this ).initialize( initConfig, sdkConfig -> {⋮
val initConfig = AppLovinSdkInitializationConfiguration.builder("«SDK-key»", this) .setMediationProvider(AppLovinMediationProvider.MAX) .setSegmentCollection(MaxSegmentCollection.builder() .addSegment(MaxSegment(849, listOf(1, 3))) .build() ) .build()⋮AppLovinSdk.getInstance(this).initialize(initConfig) { sdkConfig ->⋮}
内容 URL 传递
AppLovin 建议您在发送广告请求时传递应用内容 URL,方便买方进行上下文分析或审查。 某些 DSP 买家可能需要此信息。 您可以在竞价请求中发送该 URL。
您可以在发送广告请求时传递应用内容 URL。 下面的代码片段展示了如何完成此操作:
横幅广告
bannerAd = new MaxAdView( "«ad-unit-ID»", this );bannerAd.setExtraParameter( "content_url", "«value»" );
插屏广告
interstitialAd = new MaxInterstitialAd( "«ad-unit-ID»", this );interstitialAd.setExtraParameter( "content_url", "«value»" );
MREC 广告
mrecAd = new MaxAdView( "«ad-unit-ID»", MaxAdFormat.MREC, this );mrecAd.setExtraParameter( "content_url", "«value»" );
原生广告
nativeAdLoader = new MaxNativeAdLoader( "«ad-unit-ID»", this );nativeAdLoader.setExtraParameter( "content_url", "«value»" );
激励广告
rewardedAd = MaxRewardedAd.getInstance( "«ad-unit-ID»", this );rewardedAd.setExtraParameter( "content_url", "«value»" );
横幅广告
var bannerAd = MaxAdView( "«ad-unit-ID»", this )bannerAd.setExtraParameter( "content_url", "«value»" )
插屏广告
var interstitialAd = MaxInterstitialAd( "«ad-unit-ID»", this )interstitialAd.setExtraParameter( "content_url", "«value»" )
MREC 广告
var mrecAd = MaxAdView( "«ad-unit-ID»", MaxAdFormat.MREC, this )mrecAd.setExtraParameter( "content_url", "«value»" )
原生广告
var nativeAdLoader = MaxNativeAdLoader( "«ad-unit-ID»", this )nativeAdLoader.setExtraParameter( "content_url", "«value»" )
激励广告
var rewardedAd = MaxRewardedAd.getInstance( "«ad-unit-ID»", this )rewardedAd.setExtraParameter( "content_url", "«value»" )
统一标识符
您可以在竞价流中传递 UID2 token。 买方使用这些 token 定向应用广告位并对广告位进行准确竞价。 您负责生成 token 并将其发送至 AppLovin。 以下代码示例展示了传递 token 的方法:
AppLovinSdkSettings settings = AppLovinSdk.getInstance( context ).getSettings();settings.setExtraParameter( "uid2_token", "«value»" );
val settings = AppLovinSdk.getInstance( context ).settingssettings.setExtraParameter( "uid2_token", "«value»" )
针对 Google Ad Manager Direct Sold 的自定义定向
您可以将自定义定向值传递至 Google Ad Manager 的 Direct Sold 请求。
要将自定义定向值传递至 Google Ad Manager,请将本地额外参数 custom_targeting
的值 (一个或多个) 设置为您的定向值 (一个或多个),如下所示:
请使用以下对象声明您的自定义定向,值可以是 String
或 列表<String>
:
Map<String, Object> customTargetingValues = new HashMap<>();// For a single valuecustomTargetingValues.put("«custom-targeting-key»", "«custom-targeting-value»");
// For multiple valuescustomTargetingValues.put( "«custom-targeting-key-multiple»", Arrays.asList( "«value1»", "«value2»" ));
横幅广告
bannerAd = new MaxAdView( "«your-ad-unit-ID»", context );bannerAd.setLocalExtraParameter("custom_targeting", customTargetingValues );
插屏广告
interstitialAd = new MaxInterstitialAd( "«your-ad-unit-ID»", context );interstitialAd.setLocalExtraParameter( "custom_targeting", customTargetingValues );
MREC 广告
mrecAd = new MaxAdView( "«your-ad-unit-ID»", MaxAdFormat.MREC, context );mrecAd.setLocalExtraParameter( "custom_targeting", customTargetingValues );
激励广告
rewardedAd = MaxRewardedAd.getInstance( "«your-ad-unit-ID»", context );rewardedAd.setLocalExtraParameter( "custom_targeting", customTargetingValues );
请使用以下 map
声明您的自定义定向, 定向中的 Any
可以是 String
或 列表<String>
值:
val map: MutableMap<String, Any> = mutableMapOf()// For a single valuemap["«custom-targeting-key»"] = "«custom-targeting-value»"
// For multiple valuesmap["«custom-targeting-key-multiple»"] = listOf("«value1»", "«value2»")
横幅广告
var bannerAd = MaxAdView( "«your-ad-unit-ID»", context )bannerAd.setLocalExtraParameter( "custom_targeting", customTargetingValues )
插屏广告
var interstitialAd = MaxInterstitialAd( "«your-ad-unit-ID»", context )interstitialAd.setLocalExtraParameter( "custom_targeting", customTargetingValues )
MREC 广告
var mrecAd = MaxAdView( "«your-ad-unit-ID»", MaxAdFormat.MREC, context )mrecAd.setLocalExtraParameter( "custom_targeting", customTargetingValues )
激励广告
var rewardedAd = MaxRewardedAd.getInstance( "«your-ad-unit-ID»", context )rewardedAd.setLocalExtraParameter( "custom_targeting", customTargetingValues )