Menu

Admob content mapping function

1. Admob content mapping instructions

App content mapping lets you serve contextually relevant ads to your users and ensure they're placed near content that's appropriate for your advertisers. Admob reference documentation

Note: Only 1 url can be passed by default. Multi-content URLs support up to 4, and you need to apply to admob.
  • Supported ad types: all ad styles
  • Start supported version: v6 .2.65

2. Sample code

Add content mapping URL

// Supports passing in 1-4 URLs
Map<String, Object> localExtra = new HashMap<>();
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");
localExtra.put(AdmobATConst.CONTENT_URLS,urls);

//Taking ATNative native advertising as an example, call setLocalExtra to pass in the content mapping URLS before requesting the advertisement.
mATNative.setLocalExtra(localExtra);

//Request an ad
mATNative.makeAdRequest();
Note: The incoming content mapping URL will always be effective, and you do not need to request it every time The same url is passed in every time. If it needs to be replaced, just pass in new content again.

Unmap content URL

If you need to cancel the content mapping URL, just pass in empty URLs again.

// Pass in an empty urls
Map<String, Object> localExtra = new HashMap<>();
ArrayList<String> urls = new ArrayList<String>();
localExtra.put(AdmobATConst.CONTENT_URLS,urls);

//Taking ATNative native advertising as an example, call setLocalExtra to pass in the content mapping URLS before requesting the advertisement.
mATNative.setLocalExtra(localExtra);

//Request an ad
mATNative.makeAdRequest();


Previous
Server-side incentives
Next
SDK preset strategy
Last modified: 2025-05-30Powered by