---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/android/target.md
  - https://ads.yandex.com/helpcenter/ru/dev/android/target.md
  - https://ads.yandex.com/helpcenter/zh/dev/android/target.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/en/llms.txt

# 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 {#setup}

Pass user information using `AdTargeting` when you create an `AdRequest`.

You can provide the following information about the user:

#|
|| **Parameter** | **Description** ||
|| `age` | User age: a number in string format (`"14"`, `"18"`, and so on). ||
|| `gender` | User gender: `MALE`, `FEMALE`.

You can use the `Gender` object to get a valid string. ||
|| `location` | The user's location as detected by your app.

To use the location, you must obtain the user's consent to your app using their location and set `YandexAds.setLocationTracking(true)` in the SDK. ||
|| `contextQuery` | The user's search query in the app.

For instance, if the user searched for a car, the parameter might look like `"Buy a used car in Moscow"`. ||
|| `contextTags` | Keywords from the page the user was viewing. These could 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 `"Buy a car"`, `"used car"`, `"in Moscow"`. ||
|#

## Targeting examples (Kotlin) {#examples-kotlin}


```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("RM-XXXXX-YY")
    .setTargeting(targeting)
    .build()
```
