Ad targeting
Targeting is used to set precise parameters so that users can see ads that are more relevant to them. Here's an example of using targeting:
|
Format |
Class |
|
|
|
|
// AdRequest example
BannerAd(
adUnitId: _adUnitId,
adSize: BannerAdSize.sticky(width: 320),
adRequest: AdRequest(
age: 25,
gender: Gender.male,
contextTags: ['games', 'flutter', 'test'],
contextQuery: 'user_search_query',
location: AdLocation(
latitude: 60.0,
longitude: 30.0,
accuracy: 100,
),
parameters: {
'custom1': 'value1',
'custom2': 'value2',
},
),
);
// AdRequestConfiguration example
adRequestConfiguration: AdRequestConfiguration(
adUnitId: _adUnitId,
age: 25,
gender: 'male', // or "female"
contextTags: ['games', 'flutter', 'test'],
contextQuery: 'user_search_query', // search query string
location: AdLocation(
latitude: 60.0,
longitude: 30.0,
accuracy: 100,
),
parameters: {
'custom1': 'value1',
'custom2': 'value2',
},
)
|
Parameter |
Description |
|
|
The user's age in string format, for example: “14”, “18”. |
|
|
The user's gender: “male”, “female”. You can use the |
|
|
The user's location as detected by your app. To use location data, you must obtain the user's consent and then set |
|
|
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”. |
|
|
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”. |