启用开放式衡量
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
适用于 Android 的 IMA SDK 包含 Open Measurement (OM) SDK,这是由互动广告联盟 (IAB) 开发的业界标准,可实现第三方可见度和验证衡量。使用适用于 Android 的 IMA SDK 时,所含的 OM SDK 会自动解析 VAST 广告代码中的 <AdVerifications>
代码,并通过 OMID API 将可见度数据发送给指定的衡量供应商。IMA SDK 支持 OM SDK v1.4、VAST 2 及更高版本的 GAM AdVerifications 扩展,以及 VAST 4 及更高版本的 AdVerifications 节点。如需充分利用 Open Measurement,请注意以下几点:
如需使用 Open Measurement,您必须使用 Android 版 IMA SDK 3.11.0 或更高版本。不过,本指南中的示例适用于最新版 SDK,并包含版本 3.16.5 中引入的 API。
如果使用 VAST 4.1 或更高版本,则必须根据 VAST 4.1 规范将广告配置为在 VAST 中使用 <AdVerifications>
进行流量传送;否则,应使用 <Extension type="AdVerifications">
。
请勿使用任何叠加层(透明或不透明)遮盖 AdDisplayContainer
,因为这些叠加层会被 OMSDK 标记为遮挡物,从而降低可见度。
前提条件
测试
如需使用 IMA SDK 测试 Open Measurement,请使用上述任一必需的 SDK 版本以及测试广告代码。
您应该会在 VAST 响应中看到返回的 <AdVerifications>
。
注册视频控件叠加层遮挡
视频控件(例如暂停按钮或进度条)可向用户提供重要的播放信息和操作。在移动设备上,由于点按不精确且用户有此预期,因此通常会在媒体元素上呈现大尺寸、触控友好的控件。这些控件通常会在用户点按时淡入淡出,并且在大部分播放时间内都不会显示。
以下是 YouTube 应用呈现的视频控件的示例:

使用 IMA SDK 时,大多数发布商都会在广告展示容器上方添加一个大部分透明的视图,以实现这些控件。通常,控件是此视图的子元素,会完全遮挡底层视频播放器。此透明叠加层用于捕获点按事件,然后在用户点按时向用户呈现控件。
通过 Open Measurement SDK 计算广告可见度时,所有叠加在媒体元素上的视图都会被视为遮挡,并会降低可见度。如果透明点按叠加层位于整个广告展示容器上方,则广告资源可能会被声明为完全不可见。
Open Measurement SDK 提供了相应规定,将视频控件视为对用户体验至关重要的“友好”遮挡。注册为友好控制功能后,这些控制功能将从广告可见度衡量范围中排除。
IMA SDK 在获得 IAB 和 MRC 支持后,引入了一个 API,用于在 Open Measurement SDK 中注册这些叠加层。这些控件必须是完全透明的叠加层或小按钮。不得注册任何与视频控件无关的其他视图。
DO 寄存器 |
请勿注册 |
- 用于捕获用户点按的透明叠加层
-
暂时性按钮
- 暂停
- 播放
- 全屏
- 投屏/AirPlay
- 收起
- 进度/快进
- 与播放相关的其他操作
|
- 水印
- 弹出式窗口
- 对话框
- 非暂时性按钮
- 其他遮挡视图
|
以下示例代码演示了如何在广告展示容器上注册视频控件叠加层:
myTransparentTapOverlay = (ViewGroup) rootView.findViewById(R.id.overlay);
myPauseButton = (ImageButton) rootView.findViewById(R.id.pauseButton);
// Substitute "myTransparentTapOverlay" and "myPauseButton" with the
// elements you want to register as video controls overlays.
// Make sure to register before ad playback starts.
overlayObstruction = ImaSdkFactory.createFriendlyObstruction(
myTransparentTapOverlay,
FriendlyObstructionPurpose.NOT_VISIBLE,
"This overlay is transparent"
);
pauseButtonObstruction = ImaSdkFactory.createFriendlyObstruction(
myPauseButton,
FriendlyObstructionPurpose.VIDEO_CONTROLS,
"This is the video player pause button"
);
displayContainer.registerFriendlyObstruction(overlayObstruction);
displayContainer.registerFriendlyObstruction(pauseButtonObstruction);
使用完这些内容后,您可以通过调用以下方法来移除这些障碍:
displayContainer.unregisterAllFriendlyObstructions();
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eThe IMA SDK for Android incorporates the Open Measurement (OM) SDK, an industry standard for third-party viewability and verification measurement, automatically sending viewability data to specified vendors.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize Open Measurement, ensure you are using IMA SDK for Android version 3.11.0 or higher, ads are configured to traffic \u003ccode\u003e<AdVerifications>\u003c/code\u003e tags in their VAST responses, and avoid obstructing the \u003ccode\u003eAdDisplayContainer\u003c/code\u003e with overlays.\u003c/p\u003e\n"],["\u003cp\u003ePublishers can register transparent video control overlays as "friendly obstructions" with the IMA SDK to prevent them from negatively impacting viewability measurements, but these overlays must adhere to IAB standards for size and character usage.\u003c/p\u003e\n"]]],["The IMA SDK for Android uses the Open Measurement (OM) SDK to enable third-party ad viewability and verification, automatically parsing `\u003cAdVerifications\u003e` tags in VAST ads. To use this, ensure the IMA SDK version is 3.11.0 or greater, and configure ads to traffic `\u003cAdVerifications\u003e`. Video controls can be registered as \"friendly\" obstructions, exempting them from viewability calculations. This is done by calling `ImaSdkFactory.createFriendlyObstruction()` on transparent overlays or buttons, and registering them with `displayContainer.registerFriendlyObstruction()`.\n"],null,["The IMA SDK for Android includes the\n[Open Measurement (OM) SDK](//iabtechlab.com/standards/open-measurement-sdk/),\nan industry standard developed by the\n[Interactive Advertising Bureau (IAB)](//www.iab.com/) to enable third-party\nviewability and verification measurement. When using the IMA SDK for\nAndroid, the included OM SDK automatically parses\nthe `\u003cAdVerifications\u003e` tag within VAST ad tags and sends viewability data to\nthe specified measurement vendors via the OMID API.The IMA SDK supports OM SDK\nv1.4, GAM AdVerifications extensions on VAST 2+,\nand the AdVerifications node on VAST 4+.To take advantage of Open Measurement,\nkeep the following points in mind:\n\n- To use Open Measurement you must have version\n 3.11.0 or\n greater of the IMA SDK for Android.\n However, the sample in this guide is designed for the newest version of the SDK\n and includes APIs introduced in version 3.16.5.\n\n- Ads must be configured to traffic `\u003cAdVerifications\u003e` in their VAST as per\n the [VAST 4.1 spec](//iabtechlab.com/wp-content/uploads/2018/06/VAST4.1-June7-FINAL.pdf)\n if using VAST 4.1+; otherwise, `\u003cExtension type=\"AdVerifications\"\u003e`\n should be used.\n\n- Refrain from covering the `AdDisplayContainer` with any overlays\n (transparent or opaque), since these will be flagged as obstructions by the OM\n SDK and reduce viewability.\n\nPrerequisites\n\n- If your ads are trafficked through Ad Manager, [configure a viewability\n provider for your Ad Manager network](//support.google.com/admanager/answer/9025968#configure-a-viewability-provider) and assign that viewability provider to your line item.\n\nTesting\n\nTo test Open Measurement using the IMA SDK, use one of the required versions of\nthe SDK above, along with a [test ad tag](https://pubads.g.doubleclick.net/gampad/ads?iu=/21775744923/external/omid_ad_samples&env=vp&gdfp_req=1&output=vast&sz=640x480&description_url=http%3A%2F%2Ftest_site.com%2Fhomepage&vpmute=0&vpa=0&vad_format=linear&url=http%3A%2F%2Ftest_site.com&vpos=preroll&unviewed_position_start=1&correlator=).\n\nYou should see the `\u003cAdVerifications\u003e` returned in your VAST response.\n\nRegister video controls overlay obstructions\n\nVideo controls such as pause buttons or progress bars provide essential playback\ninformation and actions to users. On mobile, imprecise taps and user\nexpectations have made it common practice to render large, touch-friendly\ncontrols over the media element. These controls usually fade in and out on a\nuser tap and are not visible for the vast majority of playback time.\n\nBelow is an example of video controls rendered by the YouTube app:\n\nWhen using the IMA SDK, most publishers implement these controls by adding a\nview above the ad display container that is mostly transparent. Usually, the\ncontrols are child elements of this view that fully occludes the underlying\nvideo player. This transparent overlay is used to capture tap events and then\nrender the controls to users when tapped.\n\nWhen ad viewability via the Open Measurement SDK is calculated, all views\noverlaying the media element are considered obstructions and reduce the\nviewability rate. In the case where a transparent tap overlay sits above the\nentire ad display container, it is possible for inventory to be declared\ncompletely unviewable.\n\nThe Open Measurement SDK makes provisions for video controls to be considered\n\"friendly\" obstructions that are essential to the user's experience. Once\nregistered as friendly, these controls are excluded from ad viewability\nmeasurement.\n\nWith IAB and MRC support, the IMA SDK introduces an API for registering these\noverlays with the Open Measurement SDK. These controls must be fully transparent\noverlays or small buttons. Any other views not related to video controls must\nnot be registered.\n\n| DO register | DO NOT register |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|\n| - Transparent overlay to capture user taps - Transient buttons - Pause - Play - Fullscreen - Cast/AirPlay - Collapse - Progress/Seek - Other playback relevant actions | - Watermarks - Pop ups - Dialogs - Non-transient buttons - Other obscuring views |\n\nThe following sample code demonstrates how to register video controls overlays\non the ad display container:\n\n\n| **Key Point:** The `detailedReason` string used when calling [`ImaSdkFactory.createFriendlyObstruction()`](/interactive-media-ads/docs/sdks/android/client-side/api/reference/com/google/ads/interactivemedia/v3/api/ImaSdkFactory#public-friendlyobstruction-createfriendlyobstruction-view-view,-friendlyobstructionpurpose-purpose,-string-detailedreason) must follow the IAB standard by:\n|\n| - Being 50 characters or less.\n| - Only contain characters `A-z`, `0-9`, or spaces.\n- The string can be nil. \n\n myTransparentTapOverlay = (ViewGroup) rootView.findViewById(R.id.overlay);\n myPauseButton = (ImageButton) rootView.findViewById(R.id.pauseButton);\n // Substitute \"myTransparentTapOverlay\" and \"myPauseButton\" with the\n // elements you want to register as video controls overlays.\n // Make sure to register before ad playback starts.\n overlayObstruction = ImaSdkFactory.createFriendlyObstruction(\n myTransparentTapOverlay,\n FriendlyObstructionPurpose.NOT_VISIBLE,\n \"This overlay is transparent\"\n );\n pauseButtonObstruction = ImaSdkFactory.createFriendlyObstruction(\n myPauseButton,\n FriendlyObstructionPurpose.VIDEO_CONTROLS,\n \"This is the video player pause button\"\n );\n\n displayContainer.registerFriendlyObstruction(overlayObstruction);\n displayContainer.registerFriendlyObstruction(pauseButtonObstruction);\n\nWhen you're done with them, these obstructions can be removed by calling the\nfollowing method:\n\n displayContainer.unregisterAllFriendlyObstructions();\n\n| **Note:** For information on measurement and verification providers that have committed to the development of this new viewability standard, see the [IAB open measurement documentation](//iabtechlab.com/working-groups/open-measurement-working-group/)."]]