Ad Targeting Options
Besides ad unit size, there are a number of targeting options you can include in the request that's sent to the Amazon Mobile Ad Network. For example, you may include latitude and longitude gathered from the device. To set targeting options, you must construct an
AdTargetingOptions object and pass it to the
InterstitialAd.loadAd method call.
Optional - Including Latitude and Longitude
You may choose to supply the Amazon Mobile Ads API with latitude and longitude coordinates as part of an ad request, if your app has permission from the user to gather this information. Requests that contain geographic location may earn higher CPMs.
Important: On Android your app must include permissions for ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION to utilize latitude and longitude coordinates. See Step 2 of the [Quick Start Guide][mobile-ads/mb-quick-start] for more information about permissions.
AdTargetingOptions opt = new AdTargetingOptions().enableGeoLocation(true);
Advanced options can be set as String key value pairs through the setAdvancedOption method. The advanced options currently include "ec" for floor price.
AdTargetingOptions opt = new AdTargetingOptions().setAdvancedOption("key", "value");
Optional - Floor Price
When making load ad requests, you can specify a floor price in micro-dollars. For example, if you wanted to earn a minimum of $0.85 per thousand ads returned, then you would specify "850000" micro-dollars. The floor price is set through the advanced options using the key "ec".
Important: The Amazon Mobile Ad Network is designed to maximize your revenue opportunity. Setting floor price may limit your revenue potential as it might prevent several paid campaigns from running on your placement. Amazon recommends not setting this value in most cases. If you do set a floor price, please double-check your value as setting a high floor price, even unintentionally, may severely limit your fill rate and revenue, requiring a new app version to fix.
The code shown in the following example will only allow ads to be returned if they have a CPM of $0.85 or greater.
AdTargetingOptions opt = new AdTargetingOptions().setAdvancedOption("ec", "850000");
Note: Alternatively, you can instead set the floor price using the AdTargetingOptions.setFloorPrice method and passing in the value in micro-dollars. This is equivalent to adding floor price as an advanced option.