其实谷歌广告联盟早就推出了区段定位代码用来突出重要内容或者忽视某些内容,这样一来我们就可以通过加上区段定位代码来让谷歌广告显示与我们的文章内容更相关的广告,从而提高广告匹配度和广告点击率。
谷歌区段定位广告(突出某些内容)
- <!– google_ad_section_start –>
- 如文章页标题和内容
- <!– google_ad_section_end –>
谷歌区段定位广告(忽略某些内容)
- <!– google_ad_section_start(weight=ignore) –>
- 如评论内容
- <!– google_ad_section_end –>
举例说明
我们以Nana 主题为例,直接编辑 single.php 文件,找到以下代码:
- <h1 class=“entry-title”><?php the_title(); ?></h1>
在它上方添加以下代码:
- <!– google_ad_section_start –>
继续找到以下代码:
- <?php the_content(); ?>
在它下方添加以下代码:
- <!– google_ad_section_end –>
即可让谷歌链接广告重点匹配文章标题和文章内容。
如果我们想让谷歌广告忽略评论内容,那么只需要编辑 single.php 文件,找到以下代码:
- <?php comments_template( ”, true ); ?>
修改为
- <!– google_ad_section_start(weight=ignore) –>
- <?php comments_template( ”, true ); ?>
- <!– google_ad_section_end –>
即可。