广告定位

您可以使用 Yandex Mobile Ads SDK API 添加额外的用户信息。向请求中添加上下文数据可显著提升广告质量进而增加收入。

设置定位

您可以在广告请求中传递用户信息:

您可以提供以下用户信息:

参数

描述

age

用户年龄:字符串格式的数字(例如"14""18"等)。

gender

用户性别:接受 Gender 枚举中的值。

请使用 Gender.MALEGender.FEMALE 常量获取有效的字符串。

location

由您的应用检测到的用户位置,通过 Location 类传递。

设置此参数前,请先获得用户同意,并通过 MobileAds.SetLocationConsent 方法将位置使用权限传递给 SDK。

contextQuery

用户在应用中的搜索查询。

例如,如果用户搜索汽车,此参数可能如下所示:"在莫斯科购买二手车"

contextTags

用户正在查看的页面中的关键字。可能是页面的标题、页面的部分内容、标记及其他元素。

对于包含汽车搜索的页面,此参数可能为"购买汽车""二手车""在莫斯科"

定位示例

自适应内联和粘性横幅

AdRequest adRequest = new AdRequest.Builder()
	.WithAge("20")
	.WithContextQuery("context-query")
	.WithContextTags(["context-tag"])
	.WithLocation(new Location.Builder().SetLatitude(55.734202).SetLongitude(37.588063).SetHorizontalAccuracy(100).Build())
	.WithGender(Gender.FEMALE)
	.Build();
插屏广告、激励广告和开屏广告
AdRequestConfiguration adRequestConfiguration = new AdRequestConfiguration.Builder("your_block_id")
	.WithAge("20")
	.WithContextQuery("context-query")
	.WithContextTags(["context-tag"])
	.WithLocation(new Location.Builder().SetLatitude(55.734202).SetLongitude(37.588063).SetHorizontalAccuracy(100).Build())
	.WithGender(Gender.FEMALE)
	.Build();