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
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 |
|
|
User's age: a number in string format ( |
|
|
User's gender: set as one of the Use the |
|
|
The user's location as known in your app, passed using the Before setting this parameter, obtain the user's consent and pass permission to use location to the SDK using the |
|
|
The user's search query in the app. For example, if the user searched for a car, the parameter might look like this: |
|
|
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 |
Targeting examples
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
);