GPT System Events

Connect GPT events with the Harmony event handler.

var googletag = require('../modules/googletag.js'),
    events = require('../modules/master-event-handler.js');

googletag.cmd.push(function () {

harmony.on('slotRenderEnded', callback)

Params
callback function(googletag.events.SlotRenderEndedEvent) Called each time any ad call completes.
See
types/event-handler.js
See
    googletag.pubads().addEventListener('slotRenderEnded', function (event) {
        events.trigger('slotRenderEnded', event);
    });

harmony.on('impressionViewable', callback)

Params
callback function(googletag.events.ImpressionViewableEvent) Called each time any slot registers a viewed impression.
See
types/event-handler.js
See
    googletag.pubads().addEventListener('impressionViewable', function (event) {
        events.trigger('impressionViewable', event);
    });

harmony.on('slotOnload', callback)

Params
callback function(googletag.events.SlotOnloadEvent) Fired when the creative's iframe fires its load event.
See
types/event-handler.js
See
    googletag.pubads().addEventListener('slotOnload', function (event) {
        events.trigger('slotOnload', event);
    });

harmony.on('slotVisibilityChanged', callback)

Params
callback function(googletag.events.slotVisibilityChangedEvent) Fired whenever the on-screen percentage of an ad slot's area changes.
See
types/event-handler.js
See
    googletag.pubads().addEventListener('slotVisibilityChanged', function (event) {
        events.trigger('slotVisibilityChanged', event);
    });
});