---
metadata:
  - name: generator
    content: Diplodoc Platform v5.57.3
alternate:
  - https://ads.yandex.com/helpcenter/en/easy/integration/react-native/advanced-settings/targeting.md
  - https://ads.yandex.com/helpcenter/ru/easy/integration/react-native/advanced-settings/targeting.md
  - https://ads.yandex.com/helpcenter/zh/easy/integration/react-native/advanced-settings/targeting.md
  - href: en/easy/integration/react-native/advanced-settings/targeting.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

# Ad targeting

Targeting is used to set precise parameters so that users can see ads that are more relevant to them. Below is an example aligned with the current Yandex Mobile Ads SDK API.

For all ad formats, use `AdRequest` with optional `AdTargeting`.

{% list tabs %}

- Banners

    Example of targeting with `AdRequest`:

    ```JavaScript
    const StickyBannerScreen = () => {
    // ... state and layout ...

    let adRequest = new AdRequest({
        age: '20',
        contextQuery: 'context-query',
        contextTags: ['context-tag'],
        gender: Gender.Male,
        location: new Location(55.734202, 37.588063),
    });

     return (
        <BannerView
            size={adSize!}
            adUnitId={selectedAdNetwork?.adUnitId!}
            adRequest={adRequest}
        />
     );
    };
    ```

- Interstitial and rewarded ads

    Example of targeting with `loadAd`:

    ```JavaScript
    const loadAd = async () => {
    let loader = await InterstitialAdLoader.create()
        .catch((error) => {
            logger.addLog(`Did fail to create the loader with error: ${error}`, setLogs);
            setIsButtonDisabled(false);
            return;
        });

    await loader.loadAd({
        adUnitId: adUnitId,
        targeting: {
            age: '20',
            contextQuery: 'context-query',
            contextTags: ['context-tag'],
            gender: Gender.Female,
            location: new Location(55.734202, 37.588063),
        },
    })
        .then((ad) => {
            logger.addLog('Did load', setLogs);
            setAd(ad);
            setButtonLabel('Show ad');
            setIsButtonDisabled(false);
        })
        .catch((error) => {
            logger.addLog(`Did fail to load with error: ${error}`, setLogs);
            setAd(undefined);
            setButtonLabel('Load ad');
            setIsButtonDisabled(false);
        });
    };
    ```

{% endlist %}

#|
||

**Parameter**

|

**Description**

||
||

`age`

|

The user's age in string format, for example: “14”, “18”.

||
||

`gender`

|

The user's 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 location data, you must obtain the user's consent and then set `MobileAds.setLocationConsent(true)` in the SDK.

||
||

`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 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 this: “buy a car”, “used car”, “in Moscow”.

||
|#
