# Open Measurement

> Implement the IAB Open Measurement SDK to support third-party viewability and verification for in-app ads.

Unity supports Open Measurement (OM) third-party verification code with your video ad. For more information, refer to the the IAB's [OM spec](https://iabtechlab.com/blog/vast-4-1-open-measurement-the-long-awaited-video-verification-solution/).

## VAST tag

To implement OM code in your VAST tag, complete the following steps:

1. Include the `<AdVerifications>` node. For more information, refer to **section 3.16** of the [VAST guidelines](https://www.iab.com/wp-content/uploads/2016/04/VAST4.0_Updated_April_2016.pdf).

> **Note:**
>
> If you are using VAST 2.X or 3.X, include `<AdVerifications>` as an `<Extension>` under `<Extensions>`.

2. Include your vendor key (to identify whether you have extra parameters that need to be sent to your verification script) inside the `<Verification>` tag.
3. Include the verification script inside the [`<JavaScriptResource>`](#javascript-resource) tag.

```xml
<AdVerifications>
	<Verification vendor="company.com-omid">
		<JavaScriptResource apiFramework="omid" browserOptional="true">
			<![CDATA[https://verification.com/omid_verification.js]]>
		</JavaScriptResource>
		<VerificationParameters>
			<![CDATA[verification params key/value pairs]]>
		</VerificationParameters>
	</Verifications>
</AdVerifications>
```

> **Note:**
>
> Verification parameters are optional.

### JavaScript resource##javascript-resource

Include a verification script in the `<JavaScriptResource>` tag that immediately registers session observers, video events, and ad events to simplify event management and ensure that all events are called in order.

> **Note:**
>
> When registering the session observer, always include a vendor key that matches the `vendor='key'` attribute in the `<Verifications>` node.

The following list details the macros that Unity supports if they are provided in the tracking URL:

* `%OM_ENABLED%`
  * Defaults to `false`.
  * If VAST supports OM, set to `true`.
* `%OM_VENDORS%`
  * An identifier for the OM SDK integration.
  * This is the same as the `name` and `versionString` parameters of the `OMIDPartner` object.

[Example of a simple verification script](https://github.com/InteractiveAdvertisingBureau/Open-Measurement-JSClients/blob/master/src/validation-verification-script/validation-verification-client.js)

## OMID troubleshooting

If an error occurs, a tracking pixel's `[REASON]` macro might return one of the following reasons:

* `VERIFICATION_RESOURCE_REJECTED`
* `VERIFICATION_NOT_SUPPORTED`
* `ERROR_RESOURCE_LOADING`
