Using javascript, I need to display a DIV but only if it contains a Google Ad. Here's the code I'm working with via Google:
<div id='div-gpt-ad-1346196436229-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1346196436229-0'); });
</script>
</div>
The DIV ID in the above code was generated by Google for the ad slot.
Any thoughts or directions I can get? Admittedly I'm pretty weak in the javascripting world so please be gentle. :)
Just include this tag in your header code like so.
<script type='text/javascript'>
googletag.defineSlot('AdSlot-name', [AdSize],
'div-gpt-ad-1346196436229-0').addService(googletag.pubads());
googletag.pubads().collapseEmptyDivs();
</script>
The tag you add is:
googletag.pubads().collapseEmptyDivs();