Ad targeting
You can use the Yandex Mobile Ads SDK API to add extra details about users to ad requests. Contextual data can help boost ad relevance and maximize your revenue.
Set up targeting
To pass extra details about users, specify AdTargeting in AdRequest.
You can provide the following user information:
|
Parameter |
Description |
|
|
The user's age in string format (for example, |
|
|
The gender of the user. Possible values: |
|
|
The user's location as detected by your app, passed using the To use location data, obtain user consent and enable location tracking in the SDK by calling |
|
|
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 a list such as |
Examples of targeting
val adRequest = AdRequest(
adUnitId = "R-M-XXXXXX-Y",
targeting = AdTargeting(
age = "20",
contextQuery = "context-query",
contextTags = listOf("context-tag"),
gender = "female",
location = AdLocation(latitude = 55.734202, longitude = 37.588063, accuracy = 0.1),
),
)