Open-Measurement-SDKJS

Validating your OM SDK for Web Video Integration

Summary

While the SDK signals critical implementation issues via errors and exceptions, you should perform additional validation steps to ensure that your implementation works end to end. You can do this by using a JavaScript script that is bundled with the SDK distribution called the Validation Verification Client.

Below we describe how to execute the script and monitor for events from it to confirm correct implementation. Please note that while you should certainly perform this validation yourself, you should seek further guidance from the IAB Tech Lab to ensure that your implementation is independently certified.

Steps

1. Obtain the Validation Script

Extract /Validation-Script/omid-validation-verification-script.js from the omweb-js-${VERSION}.zip obtained from the IAB Tech Lab Tools Portal. Host it somewhere your browser will be able to download it from, like Amazon S3, or a local server.

2. Inject the Validation Script

In your integration, specify this verification resource when building the AdSession:

const VALIDATION_SCRIPT_URL =
    'https://mycompany.s3.amazonaws.com/validation-script.js';
const VENDOR_KEY = 'dummyVendor'; // you must use this value as is
const PARAMS = JSON.stringify({'k': 'v'});

resources.push(new VerificationScriptResource(
    VALIDATION_SCRIPT_URL, VENDOR_KEY, PARAMS));

const context = new Context(partner, resources, CONTENT_URL);
// Proceed to build AdSession.

3. Follow Integration Steps

Make sure that you’ve implemented the steps outlined in the guide for integrating the OM SDK for Web Video into your site.

4. Open the Web Inspector

The Validation Script will “log” via HTTP requests to localhost. These requests will be sent in response to various events (start of a session, impression event, playback progress, viewability update, etc.) and will include the parameters included with those events. In order to see these events, you can open your browser’s Web Inspector to the Network tab.

5. Build and Run your Site

6. Load Ads and Observe Logs

As you interact with the app and load ads, monitor logs from the Validation Client in your proxy. By default they will go to localhost:66. e.g., this may be edited to replace the url http://localhost:66/sendmessage with your local environment in omid-validation-verification-script-v1.js

http://localhost:66/sendMessage?msg=[url encoded message content]

The exact content of the messages will vary depending on what event is being logged, but, with few exceptions, you can expect the event to be serialized as a JSON object with the following structure:

{
  "adSessionId": "5CAE70B9-2D92-4F09-A10F-44358F316B40",
  "timestamp": "[timestamp]",
  "type": "[eventType]",
  "data": {}
}

A few notes on the above:

From here on out, the validation steps are the same as the ones for OM SDK for Apps. Check for the events listed in the OM SDK iOS Validation Guide.