➤ Passing Targeting Information
Passing extra targeting information increases leads to demand partners, who usually bid higher for such impressions. While it's not mandatory to pass extra targeting information in ad requests, PubMatic highly recommends passing this information to increase monetization.
You can set additional targeting information (in addition to the mandatory parameters), on any
PMAdRequest instance; for example,
PMNativeAdRequest, and so on.
The following sections describe the most commonly used targeting information.
Location has two different usage options:
PubMatic iOS SDK enables automatic location detection by default. When available, PubMatic iOS SDK sends device location in the ad request.
You can also explicitly enable/disable auto-location detection for PubMatic iOS SDK using the
+setLocationDetectionEnabled: class method from
To set location manually:
- Disable auto-location detection.
- Assign valid
locationproperty of ad request.
// Manually setting location
adRequest.location = [[CLLocation alloc] initWithLatitude:<#latitude#> longitude:<#longitude#>];
PubMatic recommends that you keep automatic location detection enabled in the SDK to increase monetization.
NSLocationWhenInUseUsageDescriptionkey in your app’s
Info.plistfile and provide a purpose string for this key. If this key is not included in your app's
Info.plistfile, the SDK won't retrieve the user location automatically. See Using Description Keys for details.
PubMatic iOS SDK can detect the advertising ID of the host iOS device and pass it in an ad request. PubMatic iOS SDK sends Advertising ID (IDFA) by default in every ad request. Disable the use of IDFA by setting the
isIDFAEnabled property of an ad request to
NO. PubMatic SDK also honors the user's preference to Limit Ad Tracking. If user has opted out of targeted ads by enabling Limit Ad Tracking on their iOS device, PubMatic iOS SDK will not send the IDFA.
Enable/Disable Advertising ID (IDFA):
adRequest.isIDFAEnabled = <#YES/NO#>;
Securing Device IDs Using a Hash
You can secure the advertising ID (IDFA/IDFV, whichever is being used, based on
isIDFAEnabled), using a SHA1 or MD5 hash:
adRequest.udidHashType = <#PMUdidhashType#>;
Other Targeting Information
Pass additional targeting information in the ad request for increased monetization; for example, include extra information in an Ad Request instance as shown below:
adRequest.country = @"India";
adRequest.city = @"Pune";
adRequest.zip = @"410001";
adRequest.appCategory = @"Game";
adRequest.storeURL = @"https://itunes.apple.com/testapp";
Passing Custom Key-Values
All of the SDK's ad request classes (for example,
PMBannerAdRequest), provide an API for setting custom key value parameters.
-(void)setCustomParam:(NSString *)paramValue forKey:(NSString *)paramKey;
PMBannerAdRequest * adRequest = [[PMBannerAdRequest alloc] initWithPublisherId:@"<#PUB_ID#>" siteId:@"<#SITE_ID#>" adId:@"<#AD_ID#>"];
adRequest.adSize = CGSizeMake(<#width#>, <#height#>);
[adRequest setCustomParam:<#paramValue#> forKey:<#paramKey#>];