最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】已获得Google Adsense中的广告代码如何投放广告

Google Adsense crifan 3787浏览 0评论

【背景】

折腾:

【记录】Google Adsense申请通过:您的Google AdSense申请已获得批准

期间,已经获得了广告代码了:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- left_right_side_per_page -->
<ins class="adsbygoogle"
     style="display:inline-block;width:300px;height:250px"
     data-ad-client="ca-pub-xxxxxxxxxxxxx"
     data-ad-slot="yyyyyyy"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

现在接下来要去搞懂,如何投放广告。

【折腾过程】

1.点击打开对应的:

广告代码使用入门 – AdSense帮助

去搞懂,如何让广告生效。如何投放。

2.另外有空再好好看看:

AdSense合作规范 – AdSense帮助

如何向帐户添加更多网站 – AdSense帮助

3.看了指南才知道,原来除了:

广告代码

还有:

搜索代码

4.参考:

应将 AdSense 代码粘贴到 HTML 代码中的哪个位置 – AdSense帮助

去搞清楚,广告代码应该放到哪个位置。

说是放在BODY中即可。

5.另外参考:

在 PHP 网站上使用的 AdSense 代码 – AdSense帮助

去搞清楚,对于我的wordpress的php网站,需要如何使用。

但是没看到任何内容。。。

6.现在就是去试试,通过cpanel打开自己的网站的php,然后找到当前主题retina中对应的内容:

但是看了下自己的网站的单个post页面的源代码后,发现貌似目前自己只会找地方放在单个post页面内,

还不清楚如何放在页面的左侧或右侧等位置。

所以,暂时就先放在post的主题内容之前,看看效果如何。

后来终于找到:

【记录】尝试Google的Webmaster Tools去管理网站

的源码中:

crifan single post html src div class entry-content

所对应的retina主题中的php文件是:

retina\content-single.php

中的:

  <div class="entry-content">
  	<?php the_content(); ?>
	<div class="clear"></div>				
  </div> <!-- end .entry-content -->
  

所以尝试改为:

  <div class="entry-content">
	<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
	<!-- left_right_side_per_page -->
	<ins class="adsbygoogle"
	     style="display:inline-block;width:300px;height:250px"
	     data-ad-client="ca-pub-xxxx"
	     data-ad-slot="yyyyy"></ins>
	<script>
	(adsbygoogle = window.adsbygoogle || []).push({});
	</script>

    <?php the_content(); ?>
    <div class="clear"></div>
  </div> <!-- end .entry-content -->

然后去看看效果。

7.另外从:

创建广告单元 – AdSense帮助

看到,对于广告生效时间,说只有几分钟:

“保存对网站所做的更改后,广告将会在几分钟之内开始展示。如果日后您需要更改此广告单元的设置,可以从我的广告标签下的内容广告列表中对其进行修改。”

然后此处就是:

稍微几分钟后,重新打开页面

【记录】尝试Google的Webmaster Tools去管理网站

结果为:

的确可以正常显示广告了:

把该页面刷新了下,就可以看到出现对应的一个京东的广告了:

retry open the crifan single post show adv for jd com

再刷新一下,就可以显示出对应的华为手机的广告了:

retry open the crifan single post show adv for huawei g730-u00

至此:

终于是可以正常的投放Google Adsense广告了。

 

【总结】

有空再去好好优化Google Adsense中的广告。

 

一些注意事项:

1.请不要点击您网站上的广告,即使您只是为了测试它们。AdSense 合作规范不允许发布商点击自己网站上的广告。

转载请注明:在路上 » 【记录】已获得Google Adsense中的广告代码如何投放广告

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.176 seconds, using 22.12MB memory