Content mapping

Prerequisites

  • Google Mobile Ads SDK 19.5.0 or higher

Content URL

Publishers who use content mapping to better monetize their app can pass a content URL for contextual targeting as well as brand safety.

For example, if you'd like to request ads next to content represented by https://www.example.com, you can pass the URL using the AdManagerAdRequest.Builder.setContentUrl() method:

Java

AdManagerAdRequest requestWithContent = new AdManagerAdRequest.Builder()
    .setContentUrl("https://www.example.com")
    .build();

Kotlin

var requestWithContent = AdManagerAdRequest.Builder()
    .setContentUrl("https://www.example.com")
    .build()

Multi-content URL

If your content is represented by more than one URL, for example a feed app, you can request ads next to content represented by up to four URLs by using the AdManagerAdRequest.Builder.setNeighboringContentUrls() method:

Java

ArrayList<String> urls = new ArrayList<String>();
urls.add("https://www.example1.com");
urls.add("https://www.example2.com");
urls.add("https://www.example3.com");
urls.add("https://www.example4.com");
AdManagerAdRequest requestWithContent = new AdManagerAdRequest.Builder()
    .setNeighboringContentUrls(urls)
    .build();

Kotlin

var urls = mutableListOf("https://www.example1.com", "https://www.example2.com",
                         "https://www.example3.com", "https://www.example4.com")
var requestWithContent = AdManagerAdRequest.Builder()
    .setNeighboringContentUrls(urls)
    .build()