当前位置:首页 > 电脑网络 > 网站建设 > Google的adsenser广告能不能使用js调用?如何调用?
网站建设
/ 电脑网络

Google的adsenser广告能不能使用js调用?如何调用?

发布:2007-10-27 22:26:26 | 编辑: zhaozhishi.com |

摘要:


 

听说在2006年7月以前,google的adsense广告是不允许使用javascript调用的,因此,在会收到GG的警告信件。

但是,7月以后,adsense广告已经可以使用js调用了,请看google广告小组的回信:

=========google的回信==========

我们允许发布商将 AdSense 广告代码置入 .js 档案,不过请不要因任何原因修改代码或手动影响广告的定位,因为这有违反我们的计划政策。

请注意,我们会监视所有显示 Google 广告或 AdSense for search 框的网站,以确保其符合我们的计划政策。我们将会联络任何违反我们政策的网站并要求该网站将 Google 程序代码移除。

如果您有其他疑问,请访问我们的 AdSense 支持页面 https://www.google.com/support/adsense 。若您在我们的网站上找不到您问题的答案,请回复此电子邮件。


有人问起这个问题,现在根据google官方的答复,可以使用javascript调用adsense代码。

这个举措看来很有必要,因为将广告和内容分离,使得我们每次修改的时候不用重新生成html文件。

js调用广告的方法很简单,在需要插入广告的位置,把原有的javascript改为嵌入的代码,例如

<script src="/ads/adsense.js" type="text/javascript"></script>   

一般的adsense代码如下:

<script type="text/javascript"><!--
google_ad_client = "pub-************************";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>


但是在调用的时候需要进行一些改变==========================================

document.writeln("<script type=\"text\/javascript\"><!-- ");
document.writeln("google_ad_client = \"pub-************************\"; ");
document.writeln("google_ad_width = 234; ");
document.writeln("google_ad_height = 60; ");
document.writeln("google_ad_format = \"234x60_as\"; ");
document.writeln("google_ad_type = \"text_image\"; ");
document.writeln("google_ad_channel = \"\"; ");
document.writeln("\/\/--> ");
document.writeln("<\/script> ");
document.writeln("<script type=\"text\/javascript\" ");
document.writeln("src=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\"> ");
document.writeln("<\/script>");
document.writeln("")

========================================

使用http://www.hao123.com/haoserver/jstohtm.htm进行这个转换。

怎样使用js调用google adsense             -www.aspxuexi.com

除非特别注明,所有文章由找知识百科和信息网 www.zhaozhishi.com 原创,可转载,必须注明去处,否则可能追究侵权责任。

本文关键字: Google,js
相关知识
无相关信息