Sending ping events

Last update: 2022-11-11
  • Created for:
  • User
    Admin
    Developer

For main content, you must fire ping events every 10 seconds, beginning after 10 seconds of playback, regardless of other API events that you have sent. For Ad tracking, you must fire ping events every 1 second.

The ping events are literally the “heartbeat” of Media Analytics. The only required parameters for a ping call are eventType: ping along with the playerTime object (playhead position and timestamp).

The following code snippet shows one way to implement a timed pinging mechanism for main content (10 second interval):

...
Pinger.init(10000);
...
Pinger.kill();

var Pinger = {
    init: function(interval) {
        this._timer = window.setInterval(function() {
                $.event.trigger({type: "onPing", _data: ""});
            }, interval);
    },

    kill: function() {
        window.clearInterval(this._timer);
    }
}

On this page