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

You can pass user information in the ad request:

You can provide the following user information:

Parameter

Description

age

User's age: a number in string format (for example, "14", "18", and so on).

gender

User's gender: accepts values from the Gender enumeration.

Use the Gender.MALE and Gender.FEMALE constants to get a valid string.

location

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

Before setting this parameter, obtain the user's consent and pass the permission to use the location to the SDK via the MobileAds.SetLocationConsent method.

contextQuery

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

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

Targeting examples

Adaptive inline and sticky banners

AdRequest adRequest = new AdRequest.Builder()
	.WithAge("20")
	.WithContextQuery("context-query")
	.WithContextTags(["context-tag"])
	.WithLocation(new Location.Builder().SetLatitude(55.734202).SetLongitude(37.588063).SetHorizontalAccuracy(100).Build())
	.WithGender(Gender.FEMALE)
	.Build();
Interstitial ads, rewarded ads, and app open ads
AdRequestConfiguration adRequestConfiguration = new AdRequestConfiguration.Builder("your_block_id")
	.WithAge("20")
	.WithContextQuery("context-query")
	.WithContextTags(["context-tag"])
	.WithLocation(new Location.Builder().SetLatitude(55.734202).SetLongitude(37.588063).SetHorizontalAccuracy(100).Build())
	.WithGender(Gender.FEMALE)
	.Build();