我们有一个正在运行的项目,客户要求在其中实施 Google DoubleClick for Advertising。客户给了我们来自 DFA 的示例代码,我们试图在我们的类别页面中实现它,但它根本不起作用。任何人都可以看看下面,让我知道可能是什么广告根本没有显示并且只抛出错误。
标题部分:
<script type='text/javascript'>
vargoogletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
varuseSSL = '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('/2408346/Asociacion_bottom', [728, 90], 'div-gpt-ad-1340819095858-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
文件正文部分:
<div id='div-gpt-ad-1340819095858-0' style='width:728px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1340819095858-0'); });
</script>
</div>
抛出错误并且根本不显示任何广告(即使在所有浏览器中):
错误列表:
googletag is not defined
[Break On This Error] vargoogletag = googletag || {};
googletag is not defined
[Break On This Error] googletag.cmd.push(function() {
googletag is not defined
[Break On This Error] googletag.cmd.push(function() { goog...y('div-gpt-ad-1340819095858-0'); });