使用 Google Ad Manager iFrame 方式加速广告位加载
2009年12月12日
我爱水煮鱼的所有的广告位都通过了 Google Ad Manager 方式来进行投放,非常方便和快捷,并且统计和报表功能也非常完美,但是唯一的问题就是 Google Ad Manager 的广告位有时候会非常慢,让整个网页都不能加载。我在 Google Ad Manger 官方帮助论坛中咨询中发现,Google Ad Manager 的广告其实可以通过 iFrame 方式来防止这一问题。
Google Ad Manager 的 iFrame 方式使加载的广告独立于加载网页执行,从而提高用户加载网页的速度。当然如果你使用图片重定向的话,问题是由于第三方的广告代码造成的延迟,即使采用 iFrame 的方法,仍然会体会到广告加载延时。但是使用 iFrame 方式投放广告也存在一些问题,在使用了 iFrame 代码之后,富媒体扩展式广告(Flash)将不再能够正常工作。同时,当广告位没有广告展示时,网页的格式可能会出现变形。
启用 iFrame 功能之后,需要重新为我们的的广告位置生成代码。并且不能将新的广告代码和老的广告代码在同一个页面使用。但是可以在不同页面使用不同的代码。现在在只需要 Head 添加如下的 Google Ad Manager 的代码:
<!-- Google AD Manager Begin --> <script type="text/javascript" src="http://partner.googleadservices.com/gampad/google_service.js"> </script> <script type="text/javascript"> GS_googleAddAdSenseService("ca-pub-xxxxxxxxxx"); GS_googleEnableAllServices(); </script> <script type="text/javascript"> GA_googleUseIframeRendering(); </script> <!-- Google AD Manager End -->
然后在广告位的位置放入该广告位定义的代码,如我博客日志左上角的广告位:
<script type="text/javascript"> GA_googleFillSlotWithSize("ca-pub-xxxxxxxxx", "fairyfish_300X250", 300, 250); </script>
Google 的广告最终生成的代码是在一个 ID 为 google_ads_div_广告位名字 的 DIV 中,比如上面的广告位名称为 fairyfish_300X250,那么它的广告位代码最终在 ID 为 google_ads_div_fairyfish_300X250 的 DIV 中,所以我们可以使用这个 DIV 进行排版和样式化。
现在 Google Ad Manger 的 iFrame 功能正在测试中,Google 只提供部分合作伙伴使用,如果需要使用该功能的话,你需要申请之后,获得通过之后才能使用
PS 如果你需要在我爱水煮鱼上投放广告,请联系我,QQ:11497107,MSN/Email:denishua@hotmail.com。
7 条评论 添加你的评论 →

1. 奇客 | 2009:11:13 - 10:54:00 | #
传说中的沙发~
2. 园子 | 2009:11:14 - 09:13:09 | #
目前正在研究 Google Ad Manager
也欢迎大家来我的站上投放广告哈~
3. Denis | 2009:11:14 - 21:09:36 | #
哈哈,加油!
4. shamas | 2009:11:15 - 17:45:05 | #
好像很麻烦的样子
5. kendy | 2009:11:18 - 10:00:38 | #
呵呵,不错,支持下。。这个很方便哈
6. zfoufeng | 2009:12:12 - 23:53:09 | #
7. zfoufeng | 2009:12:12 - 23:53:26 | #