Aller au contenu principal
Version: 5.x.x

Targeting Audiences

In order to take advantage of our targeting campaign, you must use our RequestOptions class instance.

RequestOptions *requestOptions = [[RequestOptions alloc] initWithAge:@(25) location:[[CLLocation alloc] initWithLatitude:48.87610 longitude:10.453] gender:GenderMale keyword:@"brand=myBrand;category=sport" contentUrl:@"https://my_content_url.com/"];

Converting RequestOptions to MNGPreference

You can convert RequestOptions to MNGPreference class instance by using RequestOptionsToPreferenceTransformer's transform(_ requestOptions: method.

RequestOptionsToPreferenceTransformer *requestOptionTransformer = [[RequestOptionsToPreferenceTransformer alloc] init];
MNGPreference *preference = [requestOptionTransformer transform:requestOptions];

Location Targeting

The Madvertise adserver and certain ad can use your user’s location to send more targeted ads by passing Latitude and Longitude.

You must also edit the plist by adding NSLocationAlwaysUsageDescription key.

your application can be rejected by Apple if you use the device's location only for advertising

if (![APP_DELEGATE sharedLocationManager]) {
APP_DELEGATE.sharedLocationManager = [[CLLocationManager alloc]init];
if([[APP_DELEGATE sharedLocationManager]respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[APP_DELEGATE.sharedLocationManager requestWhenInUseAuthorization];
}
[APP_DELEGATE.sharedLocationManager startUpdatingLocation];
}
preferences.location = [APP_DELEGATE sharedLocationManager].location;

this link can help you to get device location.

Keyword Targeting

Keywords allow you to target certain ad requests with user data. Keywords are useless for targeting, if you can provide dynamic values per users/devices.

To add keyword targeting, you will need to pass these keywords up through the application (They should be formatted as key/value pairs) :

  • Characters per key: 20
  • Characters per value: 40
preference.keyword = @"page=football;category=sport";//Separator in case of multiple entries is ; key=value

User demographic Targeting

When people are signed in on your app, can you please share Demographic informations from their settings with following code :

preference.gender = MNGGenderFemale;//or MNGGenderMale
preference.age = 25;//NSInteger