Ad targeting

Targeting enables passing user and context data to display more relevant ads. Below is an example using the current Yandex Mobile Ads SDK API.

For all ad formats, use AdRequest with optional AdTargeting.

Example of targeting (Dart)

var adRequest = AdRequest(
  adUnitId: 'your_block_id',
  targeting: AdTargeting(
    age: 20,
    contextQuery: 'context-query',
    contextTags: ['context-tag'],
    gender: 'female',
    location: const AdLocation(latitude: 55.734202, longitude: 37.588063, accuracy: 0.1),
  ),
);

Pass adRequest to loadAd (or to the banner builder) as shown in the ad format guides.

Parameter

Description

age

User's age as a number (for example, 14, 18).

gender

Gender: male or female.

location

User location determined by the app.

Before using this feature, obtain user consent and call YandexAds.setLocationTracking(true) in the SDK.

contextQuery

The user's search query in the app.

contextTags

The keywords from the page the user was viewing.