Programmatic Advertising - 101

The basic GAM ad unit

Make a request to Google Ad Manager for an ad of a certain size and render on the page.


<!-- This goes in the head! -->
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
  window.googletag = window.googletag || {cmd: []};
  googletag.cmd.push(function() {
    googletag.defineSlot('/21830177955/vc_gam_101', [300, 250], 'div-gpt-ad-1637272345107-0').addService(googletag.pubads());
    googletag.pubads().collapseEmptyDivs();
    googletag.enableServices();
  });
</script>

<!-- This goes in the body! -->
<!-- /21830177955/vc_gam_101 -->
<div id='div-gpt-ad-1637272345107-0' style="width:300px;" class="mx-auto mb-10">
  <script>
    googletag.cmd.push(function() { googletag.display('div-gpt-ad-1637272345107-0'); });
  </script>
</div>