- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 DFP 广告管理系统 (DFP) 的广告。这是页面:http://www.ifly.com
我在页面加载事件后通过 jQuery AJAX 加载 DFP 广告,以使我的各种搜索小部件尽快可供用户交互。该过程看起来像这样。
将初始 DFP header 调用放入文档 header 中。
<head>
...
<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('/9358962/HP-300x250', [300, 250], 'div-gpt-ad-1353002461867-0').addService(googletag.pubads());
googletag.defineSlot('/9358962/HP-460x60', [468, 60], 'div-gpt-ad-1353002461867-1').addService(googletag.pubads());
googletag.defineSlot('/9358962/HP-728x90', [728, 90], 'div-gpt-ad-1353002461867-2').addService(googletag.pubads());
googletag.defineSlot('/9358962/HP-LAF-160x600', [160, 600], 'div-gpt-ad-1353002461867-3').addService(googletag.pubads());
googletag.defineSlot('/9358962/HP-RAF-160x600', [160, 600], 'div-gpt-ad-1353002461867-4').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
....
</head>
创建一个空 div 作为占位符。
<div id='horizontalTANBanner'></div>
页面加载后,使用 jQuery AJAX 插入代码来获取广告。
<div id='horizontalTANBanner'>
<!-- HP-728x90 -->
<div id='div-gpt-ad-1353002461867-2' style='width:728px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1353002461867-2'); });
</script>
</div>
</div>
Google 会加载更多 JavaScript 来实际调用广告。我看到它是使用 Firebug 插入的。
<div id="horizontalTANBanner">
<div id="div-gpt-ad-1353002461867-2" style="width:728px; height:90px;">
<iframe id="google_ads_iframe_/9358962/HP-728x90_0" width="728" scrolling="no" height="90" frameborder="0" name="google_ads_iframe_/9358962/HP-728x90_0" marginwidth="0" marginheight="0" style="border: 0px none;">
<html>
</iframe>
<iframe id="google_ads_iframe_/9358962/HP-728x90_0__hidden__" width="0" scrolling="no" height="0" frameborder="0" name="google_ads_iframe_/9358962/HP-728x90_0__hidden__" marginwidth="0" marginheight="0" style="border: 0px none; visibility: hidden; display: none;">
</div>
</div>
我看到广告在除 Firefox 之外的所有浏览器(IE、Chrome、Opera、Safari)中显示。我已与其他用户确认,他们在 Firefox 中看不到广告。如何让广告在 Firefox 中显示?
我在 DFP 论坛上提出了这个问题,但这些问题不是技术性的,他们的最佳答案是“停止使用 AJAX”,但访问者体验要好得多,我希望 Google 会因不加载而对我的网页进行更好的排名,因此慢慢地,所以我讨厌停止使用它。
最佳答案
我认为您的 DFP 广告位加载可能过于复杂化了。
我认为这个代码块是不起作用的部分。
/*** Populate DFP ads ***/
var _pageID=$("body").find_class("pageID-");
$.get('/common/modules/ajax-get-list.php',{pageID:_pageID},function(_data){
//alert('data='+_data);
if(_data!=''){
var _arrDFPList=_data.split(',');
for(var i=0;i<_arrDFPList.length;i++){
//alert('DFP id = '+_arrDFPList[i]);
$.get('/common/modules/ajax-get-one.php',{id:_arrDFPList[i]},function(_oneData){
var _arrDFPOne=_oneData.split('<<<>>>');
//alert('id = '+_arrDFPOne[0]+' and content = '+_arrDFPOne[1]);
$("#"+_arrDFPOne[0]).append(_arrDFPOne[1]);
//$("#"+_arrDFPOne[0]).html(_arrDFPOne[1]);
});
}
}
/*
if(_data!=''){
var arrDFPList=_data.split(',');
$.get('/common/modules/def-get-one.php',{},function(_oneData){
});
}*/
});
/*** END Populate DFP ads ***/
我认为 Firefox 可能只是附加了广告位显示代码,但未能对其进行评估。
几个月前,我遇到了类似的问题,我们希望在加载后引入广告,并保持一切都非常快速而简单......我想出的解决方案是创建 jquery.dfp.js 。该插件允许您完全推迟 DFP 广告管理系统的加载,直到您希望加载它为止,您也不需要像当前所做的那样预先定义所有插槽...
例如,这是您当前的主页,其中仅包含使用我的插件展示广告所需的基本要素:
<html>
<head>
<title>DFP TEST</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="https://raw.github.com/coop182/jquery.dfp.js/master/jquery.dfp.min.js"></script>
</head>
<body>
<div class="adunit" id="HP-300x250" data-dimensions="300x250"></div>
<div class="adunit" id="HP-460x60" data-dimensions="460x60"></div>
<div class="adunit" id="HP-728x90" data-dimensions="728x90"></div>
<div class="adunit" id="HP-LAF-160x600" data-dimensions="160x600"></div>
<div class="adunit" id="HP-RAF-160x600" data-dimensions="160x600"></div>
<script>
$(function () {
$.dfp('9358962');
});
</script>
</body>
</html>
我认为这是一种更好的做事方式。如果您有任何疑问,请告诉我。
关于jquery - 使用 AJAX 加载的 DoubleClick 广告 (DFP) 不会在 Firefox 中显示广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14188263/
看这里: 从一个页面显示该元素有双击“dblclick”事件 但是当我尝试从控制台执行它时: 最佳答案 dblclick 不是一种方法,它是一种事件。假设您有一个按钮,并且您想手动触发该事件。你可以这
我正在使用 PropertyGrid 控件来编辑我的应用程序中的一些对象。我正在使用自定义 TypeConverter 和 TypeEditors 以获得更好的用户界面。 我对 bool 属性的自定义
The documentation for the MouseDoubleClick event州 Important DoubleClick events are logically higher-
DoubleClick 交换是否支持 openRTB 协议(protocol)? 最佳答案 Google Ad Exchange 在 HTTP Post 上使用 protobuf,并且有自己的模型。
我正在尝试为可编辑的 JTable 实现撤消(和重做)功能使用默认组件。 JTable有一个额外的类来指定其名为 SpecifiedJTable 的属性. 为此,我想捕获双击单元格的时刻(即选择/标记
是否有 ToolStripStatusLabel DoubleClick曾经工作吗? Private Sub myToolStripStatusLabel_DoubleClick(ByVal send
我有 html 表,里面有 tr 和 td。现在我所有的 Td 都在上不同的课。我想执行操作,就像每当我调用一个函数时,具有特定类的特定 td 自动执行双击功能,并且我传递的一个值将存储在该 td 中
我有一个来自广告网络的广告代码,其结构如下 api_key = X; param1 = Y; param2 = Z; ... 标
是否可以向广告素材的目标网址添加网址参数? 示例: 我在 DFP 广告管理系统 www.mysite.com 中具有目标链接的网站上加载横幅 页面上的 JavaScript 强制 DFP 广告管理系统
我是新来的,我正在尝试做一些理论上简单的事情,但我就是做对了。我需要在点击事件中触发 DCM Floodlight 代码。我遇到的问题是 href 元素中已经包含了一个 Google Analytic
有谁知道如何使用 Google sizeMapping 对象定位页外广告位以转换自适应广告? 我试过使用“页外”作为尺寸,但它不起作用。 var outOfPageMapping = googleta
我正在尝试将以下代码转换为“onClick”事件以添加到 HREF 标记。我的 JavaScript 经验有限,但我知道这是可以做到的。任何形式的指导将不胜感激。 var axel = Math.r
我有一个名为 listView 的 QListView。它是 MainWindow 中唯一的小部件。我想跟踪 listView 上的双击。所以,我这样做了: #include "mainwindow.
我遇到异常: '{0}' is not a Visual or Visual3D. 我发现唯一类似的问题:WPF: System.ArgumentException => {"'{0}' is not
我一直在尝试让 Doubleclick 广告代码加载我的动态内容。我有一个网站,当您向下滚动时,它会加载更多内容,而不必转到下一页、后退一页等。但是,我未能成功加载每 2 到 3 页上的广告。 有人知
我是网站 legiaodosherois.com.br 的所有者,在使用 Google DFP 开始我的第一个付费广告系列后遇到了问题。我所有的广告块都设置为 Adsense 回退,直到两天前我的所有
有没有一种方法可以在控件 DoubleClick 事件中获取鼠标光标的 (x, y) 坐标? 据我所知,位置必须从全局获取: Windows.Forms.Cursor.Position.X、Windo
WPF, Shapes 我有一个自定义 Shape ,并尝试实现 MouseClick和 MouseDoubleClick上面的东西。 通过例如。我需要打开一个关于 MyShape OnClick 的
我在 XAML 中有一个 ListView 控件。 这些项目由一个模板控件定义,该控件在网格内具有一个 TextBlock。 现在我想在双击 TextBlock 时触发一个 Action 。 令我惊讶
我在窗口上有一个带有 DataGrid 的 WPF/MVVM 应用程序。当用户双击 DataGrid 中的一行时,我想调用一个方法。 如何将 DataGrid 的 DblClick 事件绑定(bind
我是一名优秀的程序员,十分优秀!