---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/unity/target.md
  - https://ads.yandex.com/helpcenter/ru/dev/unity/target.md
  - https://ads.yandex.com/helpcenter/zh/dev/unity/target.md
  - href: en/dev/unity/target.md
    type: text/markdown
    title: Markdown version
  - href: llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/en/llms.txt

<!--
Используется в Boost: boost/en/ad-monetization/dev/unity
-->

# Ad targeting

The SDK API lets you add extra information about the user. Contextual data in the request can significantly improve ad quality and increase your revenue.

## Set up targeting {#setup}

To pass targeting parameters, use the `AdTargeting` class. The `AdTargeting` object is passed to the `AdRequest` constructor for all ad formats.

You can provide the following information about the user:

#|
|| **Parameter** | **Description** ||
|| `age` | User's age: a number in string format (`"14"`, `"18"`, and so on). ||
|| `gender` | User's gender: set as one of the `Gender` enumeration values.

Use the `Gender.MALE` and `Gender.FEMALE` constants to get a valid string. ||
|| `location` | The user's location as known in your app, passed using the `Location` class.

Before setting this parameter, obtain the user's consent and pass permission to use location to the SDK using the `YandexAds.SetLocationTracking` method. ||
|| `contextQuery` | The user's search query in the app.

For example, if the user searched for a car, the parameter might look like this: `"Buy a used car in Moscow"`. ||
|| `contextTags` | Keywords from the page the user was viewing. These can be a title, part of the content, tags, and so on.

For a car search page, the parameter might look like `"Buy a car"`, `"used car"`, `"in Moscow"`. ||
|#


## Targeting examples {#examples}

```c#
AdTargeting targeting = new AdTargeting(
    age: "20",
    gender: Gender.FEMALE,
    location: new Location.Builder()
        .SetLatitude(55.734202)
        .SetLongitude(37.588063)
        .SetHorizontalAccuracy(100)
        .Build(),
    contextQuery: "context-query",
    contextTags: new List<string> { "context-tag" });

AdRequest adRequest = new AdRequest(
    "your_block_id",
    targeting: targeting
);
```
