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

The following sections describe the most commonly used targeting information.

Location

Location has two different usage options:


1. Automatic

PubMatic Android SDK enables automatic location detection by default. When available, PubMatic Android 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

Setup Automatic Location Detection
PubMaticSDK.setLocationDetectionEnabled(true/false);


2. Manual

To set location manually:

  1. Disable auto-location detection.
  2. Assign a valid Location object using the setLocation() method of the ad request.
Set Manual Location Detection
//Manually setting location
PubMaticSDK.setLocationDetectionEnabled(false);

// Code to set location on PMBannerAdRequest/PMInterstitialAdRequest/PMNativeAdRequest instance
adRequest.setLocation(<custom-location>);


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

To send the location automatically from the SDK, include the ACCESS_FINE_LOCATION permission in your app’s AndroidManifest.xml file. See Adding Permissions to Manifest file for details. If this permission is not included in your app's AndroidManifest.xml file, then PubMatic Android SDK won't retrieve the user location automatically.

Device Detection

The SDK has the ability to detect Android Advertising ID (AID) of the device and pass it in the ad request. AID is enabled by default. You can call setAndroidAidEnabled(true/false) to toggle the AID. In then event AID is unavailable, the Android ID substitutes for the AID.


PubMatic Android SDK also lets you pass hashed values of udid (AID, or Android ID when AID is not available) using SHA1 and MD5 hashing techniques. 

Pass Hashed UDID Values
adRequest.setUdidHash(<HashingType>);

Pass Extra Targeting Parameters

You can pass two types of additional targeting information in the ad request for greater monetization.


User Information:

Pass User information on PMBannerAdRequestPMInterstitialAdRequestPMNativeAdRequest, or PMPrefetchRequest instance: 

Pass User Information
PMBannerAdRequest adRequest = PMBannerAdRequest.createPMBannerAdRequest(<PubId>, <SiteId>, <AdId>);
adRequest.setCity("New York");
adRequest.setZip("1234");
adRequest.setDMA("734");
adRequest.setGender(PMAdRequest.GENDER.MALE);
adRequest.setState("NY");
adRequest.setEthnicity(PMAdRequest.ETHNICITY.ASIAN_AMERICAN);
adRequest.setIncome("50000");
adRequest.setYearOfBirth("1991");


Application Information:

Pass application information using custom parameters in an instance of PMBannerAdRequest PMInterstitialAdRequest PMNativeAdRequest, or  PMPrefetchRequest

Pass Application Information
// Send App details
adRequest.setStoreURL("http://play.google.com?id=com.test.app");
adRequest.setAppCategory("Games");
adRequest.setIABCategory("IAB-CAT001");
adRequest.setCoppa(false);


⇧ Top