在 IMA 中啟用 Open Measurement
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
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,您必須使用 3.11.0 以上版本的 IMA SDK for Android。不過,本指南中的範例是針對最新版 SDK 設計,並包含 3.16.5 版中推出的 API。
如果使用 VAST 4.1 以上版本,則必須依據 VAST 4.1 規格設定廣告,將 VAST 中的流量設為 <AdVerifications>
;否則,應使用 <Extension type="AdVerifications">
。
請勿使用任何疊加層 (透明或不透明) 覆蓋 AdDisplayContainer
,因為 OM SDK 會將這些疊加層標示為阻礙物,進而降低可見度。
必要條件
測試
如要使用 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();
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-31 (世界標準時間)。
[null,null,["上次更新時間: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're using IMA SDK for Android version 3.11.0 or higher, and that ads are configured to traffic \u003ccode\u003e<AdVerifications>\u003c/code\u003e tags in their VAST responses.\u003c/p\u003e\n"],["\u003cp\u003eAvoid obstructing the \u003ccode\u003eAdDisplayContainer\u003c/code\u003e with overlays, as they negatively impact viewability measurements, unless they are registered as friendly obstructions, like transparent tap overlays or video control buttons, using the provided API.\u003c/p\u003e\n"],["\u003cp\u003eWhen registering friendly obstructions for video controls, use the \u003ccode\u003eImaSdkFactory.createFriendlyObstruction()\u003c/code\u003e method with a \u003ccode\u003edetailedReason\u003c/code\u003e string that adheres to the IAB standard: 50 characters or less, containing only \u003ccode\u003eA-z\u003c/code\u003e, \u003ccode\u003e0-9\u003c/code\u003e, or spaces.\u003c/p\u003e\n"]]],[],null,["# Enable Open Measurement in IMA\n\nThe 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\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-------\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--------------------------------------------\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/)."]]