Page tree


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, PMBannerAdRequestPMInterstitialAdRequestPMNativeAdRequest, and so on.

The following sections describe the most commonly used targeting information.

Location

Location has two different usage options:

1. Automatic

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 PubMaticSDK:

Automatic Location Example
[PubMaticSDK setLocationDetectionEnabled:<#YES/NO#>];

2. Manual

To set location manually:

  1. Disable auto-location detection.
  2. Assign valid CLLocation to the location property of ad request.

    Manual Location Example
    // Manually setting location
    [PubMaticSDK setLocationDetectionEnabled:NO];
    
    adRequest.location = [[CLLocation alloc] initWithLatitude:<#latitude#> longitude:<#longitude#>];


PubMatic recommends that you keep automatic location detection enabled in the SDK to increase monetization.

To protect user privacy, any iOS app built after iOS 10 that also accesses a user's location information, must statically declare the intent to do so. Include the NSLocationWhenInUseUsageDescription key in your app’s Info.plist file and provide a purpose string for this key. If this key is not included in your app's Info.plist file, the SDK won't retrieve the user location automatically. See Using Description Keys for details.

Device Information

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.The Vendor ID (IDFV) is used instead of Advertising ID (IDFA) for non-targeting purposes (for example, frequency capping), if the SDK is not able to retrieve the advertising ID. 

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: 

Secure Device ID With Hash Example
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: 

Other Targeting Information Examples
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.

Passing Custom Keys Example
-(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#>];
You can set multiple values for a single key by using comma separated values for the key in the ad request.


⇧ Top