Skip to content

Instantly share code, notes, and snippets.

@cvazac
Last active March 18, 2016 18:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cvazac/60638b56df8543a685eb to your computer and use it in GitHub Desktop.
Save cvazac/60638b56df8543a685eb to your computer and use it in GitHub Desktop.
(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