Assuming I've correctly defined a google ad:
googletag.defineSlot(adUnitPath, size, "ad-id-goes-here")
If I use multiple instances of the following code (googletag.display()
with the same id) on one page:
<div id="ad-id-goes-here" style="width: 728px; height: 90px">
<script type="text/javascript">
googletag.cmd.push(function() {
googletag.display('ad-id-goes-here');
});
</script>
</div>
Will the ad only display once (the very first instance), or will it fail to display at all?
According to the reference:
Each ad slot should only be displayed once per page.
However this says nothing about failure, any thoughts?
If you attempt to call googletag.display('ad-id')
twice on the same ID, the ad will only display the first time and you will get the following exception for the second call:
"Div element ad-id is already associated with another slot."
You can see this output if you append ?google_console
to the URL that contains the ad units, then press ctrl+F10 to display the google publisher console.