启用开放式衡量
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
适用于 HTML5 的 IMA SDK 包含 Open Measurement (OM) SDK,这是由互动广告联盟 (IAB) 开发的业界标准,可实现第三方可见度和验证衡量。使用适用于 HTML5 的 IMA SDK 时,所包含的 OM SDK 会自动解析 VAST 广告代码中的 <AdVerifications>
代码,并使用 OMID API 将可见度数据发送给指定的衡量供应商。您可以选择为每个请求设置访问模式规则,以控制验证脚本可以访问的内容。
IMA SDK 支持 OM SDK v1.4。
前提条件
如果使用 VAST 4.1 或更高版本,则必须将广告配置为使用 <AdVerifications>
提供验证。如果使用旧版 VAST,广告必须使用 <Extension type="AdVerifications">
。
如果您的广告是通过 Ad Manager 进行广告投放的,请为您的 Ad Manager 广告资源网配置可见度提供商,并将该可见度提供商分配给您的订单项。如需了解详情,请参阅为您的 Ad Manager 广告资源网配置可见度提供商。
访问模式
OM SDK 支持在四种不同的访问模式下运行验证脚本,这些模式用于控制验证脚本可以访问的内容:
FULL
:验证脚本可以直接访问广告素材和发布商页面。
CREATIVE
:验证脚本和广告素材会从发布商页面沙盒化。不过,脚本可以直接访问广告素材。
LIMITED
:验证脚本已沙盒化,无法访问广告素材或发布商页面,也无法直接确认其所在的发布商网域。
某些可见度提供商可能不支持所有访问模式。请与您的可见度提供商联系,确认支持哪些模式。以前,IMA 支持 DOMAIN
访问模式,现在默认为 LIMITED
模式。
为请求设置访问模式规则
访问模式规则必须在
AdsRequest
级别设置。如需为不同的验证脚本提供程序设置不同的访问模式,请传递一个字典,将每个
OmidVerificationVendor
映射到上述某种访问模式。
OmidVerificationVendor.OTHER
字段用于为字典中未明确包含的所有供应商设置默认访问模式。如果未指定任何访问模式规则,则验证脚本将在供应商的
LIMITED
访问模式下运行。
请参阅以下将 GOOGLE
设置为 google.ima.OmidAccessMode.FULL
的示例。所有其他提供程序(包括 OmidVerificationVendor
中列出的提供程序)均默认采用 OmidVerificationVendor.OTHER
的设置方式。
request.omidAccessModeRules = {};
request.omidAccessModeRules[google.ima.OmidVerificationVendor.GOOGLE]
= google.ima.OmidAccessMode.FULL;
request.omidAccessModeRules[google.ima.OmidVerificationVendor.OTHER]
= google.ima.OmidAccessMode.LIMITED;
如需实现 CREATIVE
访问模式,您必须执行以下两个步骤:
在安全的 iframe 中沙盒化您的视频播放器,使其与您网站的其余部分隔离。
将可见度合作伙伴的 OmidAccessMode
设置为 FULL
。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eThe IMA SDK for HTML5 utilizes the Open Measurement (OM) SDK for third-party viewability and verification measurement, automatically sending data to specified vendors.\u003c/p\u003e\n"],["\u003cp\u003eAds must be configured to supply verification using \u003ccode\u003e<AdVerifications>\u003c/code\u003e (VAST 4.1+) or \u003ccode\u003e<Extension type="AdVerifications">\u003c/code\u003e (previous VAST versions).\u003c/p\u003e\n"],["\u003cp\u003eFour access modes (FULL, CREATIVE, DOMAIN, LIMITED) control verification script access to the creative and publisher page, impacting the level of data access.\u003c/p\u003e\n"],["\u003cp\u003eAccess mode rules are set at the \u003ccode\u003eAdsRequest\u003c/code\u003e level, allowing customized access for different verification vendors, with \u003ccode\u003eLIMITED\u003c/code\u003e as the default.\u003c/p\u003e\n"],["\u003cp\u003eImplementing \u003ccode\u003eCREATIVE\u003c/code\u003e access mode requires sandboxing the video player in a secure iframe and setting the \u003ccode\u003eOmidAccessMode\u003c/code\u003e to \u003ccode\u003eFULL\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Enable Open Measurement\n\nThe IMA SDK for HTML5 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 HTML5, the\nincluded OM SDK automatically parses the `\u003cAdVerifications\u003e` tag within VAST ad\ntags and sends viewability data to the specified measurement vendors using the\nOMID API. You can optionally set access mode rules for each request to control\nwhat content the verification script can access.\n\nThe IMA SDK supports OM SDK v1.4.\n\nPrerequisites\n-------------\n\n- If using VAST 4.1 or higher, ads must be configured to supply verification\n using `\u003cAdVerifications\u003e`. If using previous VAST versions, ads must use\n `\u003cExtension type=\"AdVerifications\"\u003e`.\n\n- If your ads are trafficked through Ad Manager, configure a viewability\n provider for your Ad Manager network and assign that viewability provider to\n your line item. For more information, see\n [Configure a viewability provider for your Ad Manager network](//support.google.com/admanager/answer/9025968#configure-a-viewability-provider).\n\nAccess modes\n------------\n\nThe OM SDK supports running verification scripts in four different access modes\nwhich controls how much the verification script can access:\n\n- `FULL`: The verification script has direct access to the creative and the\n publisher page.\n\n- `CREATIVE`: The verification script and creative are sandboxed from the\n publisher page. However, the script has direct access to the creative.\n\n- `LIMITED`: The verification script is sandboxed and cannot access the creative\n or publisher page, and cannot directly confirm what publisher domain it is on.\n\nSome viewability providers might not support all access modes. Contact your\nviewability providers to verify which modes are supported. Previously, IMA\nsupported a `DOMAIN` access mode, which now defaults to `LIMITED` mode.\n\nSet the access mode rules for a request\n---------------------------------------\n\nAccess mode rules must be set at the [`AdsRequest`](/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdsRequest#omidAccessModeRules) level. To set different access modes for different verification script providers, pass a dictionary that maps each [`OmidVerificationVendor`](/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima#.OmidVerificationVendor) to one of the access modes listed above. The `OmidVerificationVendor.OTHER` field is used to set the default access mode for all vendors not explicitly included in the dictionary. If no access mode rules are specified, verification scripts run in `LIMITED` access mode for vendors.\n\n\u003cbr /\u003e\n\nSee the following example which sets `GOOGLE` to\n`google.ima.OmidAccessMode.FULL`. All other providers, including those\nlisted in\n[`OmidVerificationVendor`](/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima#.OmidVerificationVendor),\ndefault to how `OmidVerificationVendor.OTHER` is set. \n\n request.omidAccessModeRules = {};\n request.omidAccessModeRules[google.ima.OmidVerificationVendor.GOOGLE]\n = google.ima.OmidAccessMode.FULL;\n request.omidAccessModeRules[google.ima.OmidVerificationVendor.OTHER]\n = google.ima.OmidAccessMode.LIMITED;\n\n\nTo implement `CREATIVE` access mode, you must follow both of the following\nsteps:\n\n1. Sandbox your video player in a secure iframe, isolated from the rest of your\n site.\n\n2. Set the `OmidAccessMode` for your viewability partner to `FULL`."]]