Google DFP广告管理系统响应式广告 - 仅限320x50像素广告

时间:2015-11-09 15:18:11

标签: javascript google-dfp

Google DFP广告管理系统生成自己的自适应广告,如下所示:

<script type='text/javascript'>
  var googletag = googletag || {};
  googletag.cmd = googletag.cmd || [];
  (function() {
    var gads = document.createElement('script');
    gads.async = true;
    gads.type = 'text/javascript';
    var useSSL = 'https:' == document.location.protocol;
    gads.src = (useSSL ? 'https:' : 'http:') +
      '//www.googletagservices.com/tag/js/gpt.js';
    var node = document.getElementsByTagName('script')[0];
    node.parentNode.insertBefore(gads, node);
  })();
</script>

<script type='text/javascript'>
  googletag.cmd.push(function() {
    googletag.defineSlot('/XXXXXXX/deutung-sidebar', [300, 250], 'div-gpt-ad-XXXXXXXXXXXX-0').addService(googletag.pubads());
    googletag.defineSlot('/XXXXXXX/deutung-header', [[728, 90], [320, 50]], 'div-gpt-ad-XXXXXXXXXXXX-1').addService(googletag.pubads());
    googletag.pubads().enableSingleRequest();
    googletag.enableServices();
  });
</script>

on Content:

<div id='div-gpt-ad-XXXXXXXXX-1'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-XXXXXXXX-1'); });
</script>
</div>

这样可以正常工作,但有时它会显示728个广告(在全高清显示器上),重新加载页面后它可以正常工作(50%的印象有错误的广告)。我能做什么?

1 个答案:

答案 0 :(得分:0)

看起来您尚未正确实施自适应广告。例如,您从未定义视口大小。请参考此处的示例: https://support.google.com/dfp_premium/answer/4578089