Ad targeting
You can use the Yandex Mobile Ads SDK API to add extra user information. Adding context data to the request can significantly enhance the quality of advertising and increase your revenue.
Set up targeting
You can pass user information in the ad request:
- For a banner (inline and sticky), interstitial ad, rewarded ad, app open ad and native ad, use
AdRequestwith theAdTargetingobject. - For an ad feed, use the
AdRequestclass.
You can provide the following user information:
|
Parameter |
Description |
|
|
The user's age in string format, for example: |
|
|
The user's gender: You can use the |
|
|
The user's location as detected by your app. Before setting this parameter, you must obtain user consent for location access and call |
|
|
The user's search query in the app. For instance, if the user searched for a car, this parameter might look like this: |
|
|
The keywords from the page the user was viewing. These can be the page's title, parts of its content, tags, and other elements. For a page with a car search, this parameter might look like: |
Examples of targeting (Kotlin)
val targeting = AdTargeting.Builder()
.setAge("25")
.setGender(Gender.MALE)
.setLocation(Location("provider"))
.setContextQuery("Buy a used car in Moscow")
.setContextTags(listOf("Buy a car", "used car", "in Moscow"))
.build()
val adRequest = AdRequest.Builder("your-ad-unit-id")
.setTargeting(targeting)
.build()