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

age

The user's age in string format (for example, "14", "18", and so on).

gender

The gender of the user. Possible values: male or female.

location

The user's location as detected by your app, passed using the AdLocation class.

To use location data, obtain user consent and enable location tracking in the SDK by calling YandexAds.setLocationTracking(true).

contextQuery

The user's search query in the app.

For instance, if the user searched for a car, this parameter might look like this: "Buy a used car in Moscow".

contextTags

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 "Buy a car", "used car", "in Moscow".

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),
    ),
)
Previous
Next