Integrating the Equativ Video Plugin for HTML5 players

A step by step guide to integrate the Equativ Video Plugin with your HTML5 content player.

  1. Overview
  2. Import the Library
  3. Define Equativ Data
  4. Register Video Plugin
  5. Define custom configuration
  6. Define AdRules
  7. Set your language
  8. Set content data
  9. User identification
  10. Add callbacks functions
  11. Add VAST callbacks

Overview

The integration of Equativ's Video Plugin is a quick and simple 3 step process:

  1. Import the Library on your page.
  2. Define your targeting data (site, page, format, keyword targeting).
  3. Register the Video Plugin, so that the Equativ script knows where it can display ads.

The steps mentioned above are mandatory; make sure you have gone through all of them.

Optionally, you can also set a custom configuration for the Video Plugin, manage ad rules, change the Video Plugin language, set content data, set callback functions and define callbacks for VAST events.

Import the Library

The Equativ Video Plugin Library contains all the logic of the video solution. It makes the requests to the ad server, parses the responses, manages ad breaks and all the tracking for reporting. Caution is advised, since each Equativ customer has a dedicated version of the library.

During the integration process, the technical account manager will send you your domain and your network ID.

Please add the following to your page’s head section:


		<script type="text/javascript" src="http://r.sascdn.com/video/config.js?nwid=<YOUR_NETWORK_ID>"></script>
<script type="text/javascript" src="http://r.sascdn.com/video/controller.js?nwid=<YOUR_NETWORK_ID>"></script>

Make sure you replace <YOUR_NETWORK_ID> by your own network ID.

This will automatically include Equativ's library in your web page. The next step is to Define Equativ Data.

Define Equativ Data

The Equativ Data object is the equivalent to the variables defined when setting up display ad serving tags. It tells the Video Plugin what to request (site, page, format, keywords).

All of these values should be defined in a sasVideoData object (property adData). You can define different values for each instance of player.

The adData object should contain the following keys:

Name Description
sas_siteid An identifier for the website, defined in Manage.
sas_pageid An identifier for the page of the website, defined in Manage.
sas_pagename A name for the page of the website, defined in Manage.
sas_format_linears Identifier of the Video - Linear format defined in Manage. The same format id is used for preroll, midroll and postroll formats.
sas_format_overlays Identifier of the Video - NonLinear format defined in Manage.
sas_target Keywords for targeting.

Example 1: “my_keyword”. Targeting with keywork only.

Example 2: “my_keyword=my_value”. Targeting with keyword-value pairs.

Example 3: “my_keyword1=my_value1;my_keyword2=my_value2”. Targeting with multiple keywords.
sas_target_pre Keywords for targeting for prerolls only. sas_target will not be used for prerolls if sas_target_pre is used.
sas_target_mid Keywords for targeting for midrolls only. sas_target will not be used for midrolls if sas_target_mid is used.
sas_target_post Keywords for targeting for postrolls only. sas_target will not be used for postrolls if sas_target_post is used.
sas_target_overlays Keywords for targeting for overlays only. sas_target will not be used for overlays if sas_target_overlays is used.

Warning: This step should be done before registering the player.


				// Equativ variables
var sasVideoData= {
	id: "playerId",
	adData: {
		sas_siteid: '44928',
		sas_pageid: '322652',
		sas_pagename: 'linear',
		sas_target: '',
		sas_format_linears: '20180',
		sas_format_overlays: '19582'
	}
};
				

You are now ready to register Video Plugin.

The video plugin is capable of requesting banner ad when pausing the main video content. The corresponding configuration keys must be set in the dedicated banner object of sasVideoData. See here for more information

Register Video Plugin

After adding the js library on your page and defining the Equativ Data, you need to register all players where you want to display ads by calling this method:


					sas.video.register(sasVideoData);
			

Here, sasVideoData is an object with defined Equativ data and plugin settings. By calling this method, you will instantiate a new “javascript controller” which is responsible for loading, parsing and displaying the ads.

Note: Preferably, register the player when it has already been created. Otherwise, the javascript library will be looping until the DOM element is found to start processing.

With defined Equativ Data, the integration code should look as follows:


			var sasVideoData= {
	id: 'myContainer',
	adData: {
		sas_siteid: '44928',
		sas_pageid: '322652',
		sas_pagename: 'linear',
		sas_target: '',
		sas_format_linears: '20180,20316,20317',
		sas_format_overlays: '19582'
	}
};
sas.video.register(sasVideoData);
			
  • Click here to view the full structure of this registration object.

    Structure of the registration object

    Name Description
    id DOM object id; HTML tag id (parent tag of video element) in case of a HTML5 video player
    adData Equativ Data object is the equivalent to the variables defined in display ad serving tags.

    For more details, see above
    adRules Ad rules allow you to define the frequency and the size of ad breaks for different sets of content durations.

    For more details, read how to define ad rules
    callbacks Callbacks are javascript functions which can be executed at a specific time.

    For more details, see the callbacks section
    configuration With the configuration object, you can customize Equativ's plugin to fit your needs.

    The configuration object is divided into these sections
    contentData Content data passed to the ad server for reporting and targeting purposes describe the video content in which the instream ads are inserted.
    For more details, read how to define Content Data
    contentPlayer If your content player provides some custom API, please give the access to it, by using property:
    • api (content player API)

    Equativ Video Plugin will use this API for integration purpose.
    This is mostly used for flowplayer, you can check some integration sample here.
    language Changes the language used by the plugin.
    For more details, see language section
    user At this time, one user property is supported :
    • gdpr_consent

    Contains the encoded GDPR purposes and vendors consent string, as defined by the IAB Transparency & Consent Framework.

    If this parameter is not "manually" passed by the publisher as an input parameter, the Equativ Video Plugin will search for CMP function and will retrieve consent string automatically.

After this last mandatory step, you should be able to see some ads on your player.

If you are interested in more advanced features, check these optional settings:

User identification

This part of the configuration allows you to set up uid and eids.

The publisher can provide a 1st-party user identification value in the user.uid parameter.
Note that this is different from the uids parameter in the eid object.

eids stands for extended IDs in the AdCOM 1.0 specification of the IAB (used in OpenRTB 3.0). With this configuration, multiple user identifiers from the page can be passed to the plugin which appends them to the ad call. The eid object is an array of objects with properties:

Name Type Description
source String The user identification provider that provides the uids
uids Array of uid objects The array of uid objects provided by the user identification provider (usually, uids.length = 1)
id String The actual value of the user id, provided by the user identification provider
atype Integer The agent type the ID is coming from:
  • 1 - Web; an ID which is tied to a specific browser or device; cookie-based, probabilistic, or other
  • 2 - IDFA
  • 3 - AAID
  • 4 - Windows Mobile Advertising ID
  • 5 - Other Mobile ID

Name Type Description
uid String The top-level string with a 1st-party user identifier
eids Array The top-level array which contains all the extended ids from different providers. Note: This works only with POST ad calls

sas.video.register({
	id: 'myContainer',
	adData:	{ ... }, 
	user: {
		uid: 'user-identification-string',
		eids: [{
			source: 'id5-sync.com',
			uids: [{
				id: 'ID5-abc123',
				atype: 1
			}]
		},{
			source: 'criteo.com',
			uids: [{
				id: '1234',
				atype: 1
			}]
		},{
			source: 'digitru.st',
			uids: [{
				id: 'abcd',
				atype: 1
			}]
		}]
	}
});
		

Add callback functions

You can define one or multiple javascript callback functions that will be executed at a specific time. Some callbacks have a callback parameter. Callbacks should be defined in a sasVideoData object (property callbacks).


// Define your callback function 
var adBreakBeginCallback = function(someCallbackParameter){
	// Do something here
}
var adBreakEndCallback = function(someCallbackParameter){
	// Do something here
}
// Add your callback to the config object
sas.video.register({
	id: 'myContainer',
	adData:	{ ... },
	callbacks : {
		adBreakBegin: adBreakBeginCallback,
		adBreakEnd: adBreakEndCallback
	},
	...
});

// Remove it when it is no longer required
sas.video.removeCallback('adBreakBegin', adBreakBeginCallback);
sas.video.removeCallback('adBreakEnd', adBreakEndCallback);
			

The following table lists the callback keys, the moments when callbacks added to the callback keys are triggered, and the callback parameters.

Callback key Triggered when Callback parameters
adBegin Triggered when an ad begins (preroll, midroll, postroll or overlay). There is one parameter, an object with properties:
  • controllerID, the identifier of the controller instance executing this callback
  • state, identifies the type of ad break ("preroll", "midroll", "postroll" or "overlay")
  • type, the creative type ("linear" or "nonLinear")
adEnd Triggered when an ad ends (preroll, midroll, postroll or overlay). There is one parameter, an object with properties:
  • controllerID, the identifier of the controller instance executing this callback
  • state, identifies the type of ad break ("preroll", "midroll", "postroll" or "overlay")
  • type, the creative type ("linear" or "nonLinear")
adBreakBegin Triggered when a linear ad break (preroll, midroll, postroll) begins. There are two parameters:
  • a string indicating the type of the ad break ("preroll", "midroll" or "postroll")
  • a string indicating the id of the integrated player
adBreakEnd Triggered when a linear ad break (preroll, midroll, postroll) ends. There are two parameters:
  • a string indicating the type of the ad break ("preroll", "midroll" or "postroll")
  • a string indicating the id of the integrated player
adError Triggered when no ad is played due to an error (loading, parsing, timeout errors etc.). This error can be triggered once per ad break, and only, if no ad was displayed in a whole ad break. There is one parameter, an object with properties:
  • controllerID, the identifier of the controller instance executing this callback
  • errorCode, identifies the code of the error that appeared
  • state, identifies the type of ad break ("preroll", "midroll", "postroll" or "overlay")
singleError Triggered when an error appears (loading, parsing, timeout errors, etc.) This error can be triggered several times per ad break, and gives information about all errors that occurs during an ad break. For example, if some format is not supported and a passback ad is used, this callback will be called with errorCode 403. There is one parameter, an object with properties:
  • errorCode, identifies the code of the error that appeared
  • insertionID, the identifier of the insertion which is related to this error. For some errors, there is no appropriate insertion; thus its value will be equal to null
  • pageID, the identifier of the page. Its value also can be equal to null in case the pageID property is not defined in the ad call request
contentEnd Triggered when the content is over. There is one parameter, an object with property:
  • controllerID, the identifier of the controller instance executing this callback
videoEnd Triggered when the video experience is over: when the content is over and there is no postroll or when the postroll ended There is one parameter, an object with property:
  • controllerID, the identifier of the controller instance executing this callback

Add VAST callbacks

For an insertion, you can define javascript callback functions that will be executed at specific VAST tracking events.

The VAST tracking events are available in the VAST 4.0 specifications.
The IAB has defined keys for each event: "start", "firstQuartile", "midpoint", "thirdQuartile", "complete", "mute", "unmute", "pause", etc.

In Manage, go to the Creatives tab of your insertion. In the Customized script field, you can define functions that will be called when Equativ tracks the according VAST events. They should be placed in a script tag and their name should follow this pattern "[tracking-key]InsertionCallback"

When the ad is over, these functions will be removed from the page.