If you plan to use open measurement with custom native ad formats that
don't contain a video asset, you'll be responsible for calling the Open
Measurement APIs yourself.
If you're using custom native ad formats with a video asset, you don't need to
follow this guide; the Mobile Ads SDK tracks viewability of the video asset on
your behalf.
Load an ad
Loading an ad is the same whether you're using open measurement or not. Here is
a method that demonstrates how to request a custom native ad:
Java
privatevoidloadCustomNativeAd(Contextcontext,ViewGroupnativeCustomFormatAdContainer){AdLoaderadLoader=newAdLoader.Builder(context,"AD_UNIT_ID").forCustomFormatAd("CUSTOM_TEMPLATE_ID",newNativeCustomFormatAd.OnCustomFormatAdLoadedListener(){@OverridepublicvoidonCustomFormatAdLoaded(@NonNullNativeCustomFormatAdad){// Show the ad first and then register your view and begin open measurement.// Make sure to do this on the main thread.// ...// Show ad// ...startOpenMeasurement(ad,nativeCustomFormatAdContainer);}},newNativeCustomFormatAd.OnCustomClickListener(){@OverridepublicvoidonCustomClick(NativeCustomFormatAdad,StringassetName){// Handle the click action}}).build();adLoader.loadAd(newAdRequest.Builder().build());}
privatefunloadCustomNativeAd(context:Context,nativeCustomFormatAdContainer:ViewGroup){valadLoader=AdLoader.Builder(context,"AD_UNIT_ID").forCustomFormatAd("CUSTOM_TEMPLATE_ID",NativeCustomFormatAd.OnCustomFormatAdLoadedListener{ad->
// Show the ad first and then register your view and begin open measurement. Make sure// to do this on the main thread.// ...// Show ad// ...startOpenMeasurement(ad,nativeCustomFormatAdContainer)},NativeCustomFormatAd.OnCustomClickListener{ad,assetName->
// Handle the click action.},).build()adLoader.loadAd(AdRequest.Builder().build())}
Replace AD_UNIT_ID and CUSTOM_TEMPLATE_ID with your ad unit ID and custom template ID.
Register your view and begin measuring
To enable open measurement on a custom native ad, display the ad first, and then
register your custom ad view with the DisplayOpenMeasurement object associated
with the custom native ad. The DisplayOpenMeasurement object provides the
setView() method to register your container view with open measurement.
You also need to explicitly tell the SDK to begin measuring your ad. To do this
call the start() method on the DisplayOpenMeasurement object of your
custom native ad. The start() method must be called from the main
thread, and subsequent calls have no effect.
Note that you should display your ad before registering your view. Displaying
your ad is covered in Custom Native Ad
Formats.
The customTemplateAdFrame
layout is the ad container for the custom native ad and must contain all
assets within the bounding box of the view.
Certify with IAB
Once you release your app, you will begin receiving measurement data; however,
your data won't be certified until you complete the
IAB certification process.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-15 UTC."],[[["This guide explains how to integrate custom native ad formats with open measurement for display-type ads using the Google Mobile Ads SDK."],["For custom native ads with video assets, the Mobile Ads SDK automatically tracks viewability."],["Publishers using display-type custom native ads need to register their ad view with the `DisplayOpenMeasurement` object and explicitly start measurement."],["To ensure IAB-certified measurement data, publishers must complete the IAB certification process after releasing their app."],["Before implementing open measurement, ensure you have fulfilled prerequisites such as integrating custom native ad formats and configuring a viewability provider."]]],[]]