Skip to content

Instantly share code, notes, and snippets.

@cvazac
Last active Mar 18, 2016
Embed
What would you like to do?
(function() {
//https://developers.google.com/doubleclick-gpt/reference
var slots = ["ad_bnr_atf_01", "ad_bnr_btf_02"],
slotCount = window.performance && performance.mark ? slots.length : 0;
var boomr_ready = false;
BOOMR = window.BOOMR || {};
BOOMR.plugins = BOOMR.plugins || {};
BOOMR.plugins.GPT = {
init: function() {
boomr_ready = true;
},
done: function(slotElementId) {
if (window.performance && performance.mark && slots.indexOf(slotElementId) != -1) {
performance.mark(slotElementId);
slotCount--;
}
if (boomr_ready) {
BOOMR.sendBeacon();
}
},
is_complete: function() {
return slotCount == 0;
}
};
googletag = window.googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(
function() {
googletag.pubads().addEventListener('slotRenderEnded',
function(e) {
BOOMR.plugins.GPT.done(e.slot.getSlotElementId());
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment