Developer Guide Javascript API Reference Developer Tools Release Notes

Ad Event Verification

Use JW Player's API to detect and verify when advertising events occur.

(no ad impression yet) The ad impression was fired.
(no ad progress yet) The ad completes in seconds.
(no ad click yet) The user clicked the ad.
(no ad skip yet) The ad was skipped.
(no ad complete yet) The ad was completely watched.
const playerInstance = jwplayer('player').setup({
  playlist: '',
  advertising: {
    client: 'vast',
    tag: 'assets/preroll.xml'

const adImpression = document.getElementById('impression');
playerInstance.on('adImpression', function() {
  adImpression.checked = true;

const adSkipped = document.getElementById('skip');
playerInstance.on('adSkipped', function() {
  adSkipped.checked = true;

const progress = document.getElementById('progress');
const remaining = document.getElementById('remaining');
playerInstance.on('adTime', function(event) {
  const { duration, position } = event;
  if (!progress.checked) {
    progress.checked = true;
  remaining.value = Math.ceil(duration - position);

const adClick = document.getElementById('click');
playerInstance.on('adClick', function() {
  adClick.checked = true;

const adComplete = document.getElementById('complete');
playerInstance.on('adComplete', function() {
  adComplete.checked = true;
This player implementation is a Proof of Concept only provided to show the possibilities of the JW Player and Platform and should not be taken as an offer to create, edit or maintain custom integration or development.