Plugin Configuration Reference
Plugin Configuration Reference
This page covers the shared configuration options, custom events, custom fields, and ignored events that apply to all Watching That browser plugins. For player-specific setup, see the relevant page under Video Players.
Supported players: Brightcove, JW Player, VideoJS, Bitmovin, Akamai AMP
Configuration Options
When calling wtAdTracer to start the plugin, pass an options object. Only apiKey is required.
Retrieve your API key from Watching That app > My Account > Settings > Player plugin setup or from your account team.
Option | Required | Description |
|---|---|---|
apiKey | yes | Identifies your plugin in our system |
debug |
|
|
sendAllCustom |
|
|
sendDebug |
|
|
Browser-only debug: Enter localStorage.setItem('wtDebug', 1) in devtools console and refresh. To stop: localStorage.removeItem('wtDebug').
wtAdTracer({
apiKey: '12345',
debug: true,
sendAllCustom: true,
sendDebug: true
})Custom Events and Data
All plugins check for window.wtatCustom. Define it before the player is ready.
window.wtatCustom = {
fields: { /* custom data fields */ },
events: { /* custom player events */ },
ignoredEvents: [ /* events to filter out */ ]
};Custom Data Fields
Send additional data alongside default plugin data:
window.wtatCustom = {
fields: {
userCity: 'London',
source: 'direct',
},
};Fields can be functions (evaluated per event):
window.wtatCustom = {
fields: {
mySite: (dataSoFar) => {
if (dataSoFar.type === 'init') {
return document.location.host;
}
},
},
};CAUTION: Always return a value from functions. Heavy functions may affect user experience — cache where possible.
Static fields are sent with init only. Function fields are sent with all events. Set sendAllCustom: true to send everything with every event.
CAUTION: Let us know your custom field names so we can expose them in the UI.
Custom Events
Capture player events we don't track by default:
window.wtatCustom = {
events: {
play: true,
loadedmetadata: true,
},
};Custom type names:
window.wtatCustom = {
events: {
play: { type: 'jw:play' },
},
};The type field is mandatory. For complex logic, use a function:
window.wtatCustom = {
events: {
time: (e) => {
if (e.position % 5 === 0) {
return { type: 'keepalive', custom: { position: e.position } };
}
},
},
};CAUTION: Extra fields must go inside the custom object as shown above.
Ignored Events
Filter out events you don't want captured:
window.wtatCustom = {
ignoredEvents: [
{ type: 'error', err: 'INVALID_ASSET_CUSTOM_ID' },
{ playerId: 'foo', idx: 1, per: 50 },
]
}Match custom fields with custom. prefix:
window.wtatCustom = {
ignoredEvents: [
{ type: 'error', 'custom.foo': 'some value' },
]
}CAUTION: Broad filters can ignore critical events. Be specific.
Still Need Help?
Email: support@watchingthat.com
Collector API details: Collector API Reference