Skip to content

Instantly share code, notes, and snippets.

@Grynn
Created May 15, 2020 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grynn/ffeac75db058050ab8ec2aa97edddcad to your computer and use it in GitHub Desktop.
Save Grynn/ffeac75db058050ab8ec2aa97edddcad to your computer and use it in GitHub Desktop.
Backup House Creatives
googletag.cmd.push(function() {
googletag.pubads().addEventListener('slotRenderEnded', function(e) {
let node = document.getElementById(e.slot.getSlotElementId());
if (e.isEmpty)
{
node.innerHTML = `
<p>NO CREATIVE</p>
<ul><li>Fade background?</li>
<li>Put a fake creative / hardcoded?</li>
</ul>
`;
node.style.outline = "2px solid blue";
} else {
//all good, adding green for debug.
jQuery(node).css('background-color' , 'lightgreen');
}
console.log('slotRenderEnded', ({ empty: e.isEmpty, node, slot: e.slot }));
return;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment