1

I have some adunits that not are shown on every pages. Can I use both the standard-implementation and inline.

Is this code ok?

In head-element:

 googletag.cmd.push(function() {
   googletag.defineSlot('/34352841/ad1', [[250, 480], [250, 250]], 'div-gpt-ad-1474380277357-0').addService(googletag.pubads());       
    googletag.pubads().enableSingleRequest();
    googletag.pubads().collapseEmptyDivs();
    googletag.enableServices();


    });

In body:

  <!-- /34352841/ad1 -->
            <div id='div-gpt-ad-1474380277357-0'>
                <script>
                    googletag.cmd.push(function () { googletag.display('div-gpt-ad-1474380277357-0'); });
                </script>
            </div>

<!-- /34352842/ad2 -->
  <div id='div-gpt-ad-1474381227986-0'>
                <script>
                    googletag.cmd.push(function () {
googletag.defineSlot('/34352842/ad2', [[250, 480], [250, 250]], 'div-gpt-ad-1474381227986-0').addService(googletag.pubads());
 googletag.display('div-gpt-ad-1474381227986-0'); });
                </script>
            </div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.