Instream Video Ads Tracking

Overview

Instream tracking module allows Analytics Adapters and Bid Adapters to track BID_WON events for Instream video bids.

This module uses window.performance.getEntriesByType('resource') to check the presence of Video Cache URL.

Configuration

Field Scope Type Description
instreamTracking Required Object Configuration object for instream tracking
instreamTracking.enabled Required Boolean Enable/disable the instream tracking feature. Default: false.
instreamTracking.maxWindow Optional Integer The time in ms after which polling for instream delivery stops. Default: 60000 i.e. 60 seconds
instreamTracking.pollingFreq Optional Integer The frequency of polling. Default: 500ms
instreamTracking.urlPattern Optional RegExp Regex for cache url patterns, to avoid false positives.

Basic Example

pbjs.setConfig({
        'instreamTracking': {
            enabled: true,
        }
});

Example with urlPattern

While checking for URLs having videoCacheKey, there are chances of false positives. To avoid those cases, we can set instreamTracking.urlPattern: /REGEX_PATTERN/.

pbjs.setConfig({
        'instreamTracking': {
            enabled: true,
            urlPattern: /(prebid\.adnxs\.com\/pbc\/v1\/cache\.*)|(search\.spotxchange\.com\/ad\/vast\.html\?key=\.*)/
        }
});

Intergation

To install the module, follow these instructions:

Step 1: Prepare the base Prebid file

  • Option 1: Use Prebid Download page to build the prebid package. Ensure that you do check Instream Tracking module

  • Option 2: From the command line, run gulp build --modules=instreamTracking,...

Step 2: Set configuration

Enable instreamTracking using pbjs.setConfig

pbjs.setConfig({
        'instreamTracking': {
            enabled: true,
        }
});

Further Reading

​ Prebid.js for Video
Client-side Caching of VAST XML