Google Content Mapping Feature
1. Google content mapping instructions
With app content mapping, you can serve contextually relevant ads to your users and ensure they're placed near content that's appropriate for your advertisers. Google reference documentation
- Applicable customers: content-based products, such as novels, news, and comics APPs
- Supported ad types: native ads , banner ads
- Start supporting version
platform | Version |
---|---|
Android | V9.6.10.1+ |
iOS | V9.3.0+ |
Unity | Plug-in version v1.0.9+ |
Flutter | Plug-in version v1.0.9+ |
2. Calling method
Android platform
//Supports passing in up to 4 URLs
HashMap<String, Object> mLocalExtras = new HashMap<>();
ArrayList<String> urls = new ArrayList<>();
urls.add("https://www.example.com");
urls.add("https://www.mycontenturl1.com");
urls.add("https://www.mycontenturl3.com");
urls.add("https://www.mycontenturl4.com");
mLocalExtras.put("google_neighboring_contenturls", urls);
//Take Native as an example
tpNative.setCustomParams(mLocalExtras);
// Called before requesting ads
tpNative.loadAd();
iOS platform
Supports passing in 1-4 URLs
NSArray *array = @[@"https://www.example.com"];
NSDictionary *params = @{@"google_neighboring_contenturls":array};
//Banner settings
self.banner.localParams = params;
[self.banner loadAdWithSceneId:nil];
//Native advertising settings
self.native.localParams = params;
[self.native loadAd];
Unity Platform
Supports passing in 1-4 URLs
Dictionary<string, object> localParams = new Dictionary<string, object>();
string[] urlArray = { "https://www.example.com" };
localParams.Add("google_neighboring_contenturls", urlArray);
//Native advertising settings
TPNativeExtra extra = new TPNativeExtra();
extra.localParams = localParams;
TradplusNative.Instance().LoadNativeAd(adUnitId, extra);
//Banner ad settings
TPBannerExtra extra = new TPBannerExtra();
extra.localParams = localParams;
TradplusBanner.Instance().LoadBannerAd(adUnitId, sceneId, extra);
Flutter platform
Supports passing in 1-4 URLs
Map localParams = {};//local custom Map
localParams['google_neighboring_contenturls'] = ['https://www.example.com'];
Map customMap = {};//Traffic grouping
//Native advertising settings
//Configuration parameter extraMap
Map extraMap = TPNativeManager.createNativeExtraMap(
templateHeight: 320,
templateWidth: 340,
customMap: customMap,
localParams: localParams);
//Request native ads
TPNativeManager.loadNativeAd("unitId", extraMap: extraMap);
//Banner ad settings
Map extraMap = TPBannerManager.createBannerExtraMap(
height: 60,
width: 320,
customMap: customMap,
localParams:localParams,
sceneId: sceneId);
//Request banner ad
TPBannerManager.loadBannerAd(unitId, extraMap: extraMap);