HOW TO: Adsense Section Targeting In Thesis


Adsense section targeting should be adopted by any publisher serious about earning bucks from the Google Adsense advertisements program on their Thesis site. Targeting basically means telling Adsense which sections of your content should be considered for displaying contextual ads. For example, on a site like Niponwave where I display the OS of the users leaving comments here and a lot of people use Windows, if I were running Adsense, the word ‘Windows’ would have been picked up and many of my visitors would see advertisements related to the Microsoft OS. Get the drift? But if you want to show only relevant and contextual ads to your visitors then adsense section targeting is what you should be after. In fact, this is a recommended practice. Without further ado, let me type out the following few lines of code that will let you have Adsense Section Targeting enabled on your Thesis site in a few seconds.

// Adsense Section Targeting for posts
function start_adsense(){
echo "<!-- google_ad_section_start -->";
}
function end_adsense(){
echo "<!-- google_ad_section_end -->";
}
add_action('thesis_hook_before_post','start_adsense');
add_action('thesis_hook_after_post','end_adsense');

Most people want to target only the posts – the post means the entire content of your post and just that, cutting out all the garbage info like Related Posts, Comments, Author Byline and so on – which is pretty cool. The above code fully achieves that.

However, if your site has an active community and there are always engaging conversations then you will for sure get comments that add more value to the posts, in which case it certainly makes sense to target the comments as well. Enter Adsense Section Targeting for Thesis Comments. Of course I am targeting purely the comment text and not the commenter’s name, the datestamp and other such unnecessary info.

// Adsense Section Targeting for comments
function start_adsense(){
echo "<!-- google_ad_section_start -->";
}
function end_adsense(){
echo "<!-- google_ad_section_end -->";
}
add_action('thesis_hook_after_comment_meta','start_adsense'); add_action('thesis_hook_after_comment','end_adsense');

Finally what about Thesis Teasers? If you are using Teasers on the homepage and archive pages then you will want to target the text contained in the teasers. So here is the code for Adsense Section Targeting for Thesis Teasers.

// Adsense Section Targeting for teasers
function start_adsense(){
echo "<!-- google_ad_section_start -->";
}
function end_adsense(){
echo "<!-- google_ad_section_end -->";
}
add_action('thesis_hook_before_teaser','start_adsense');
add_action('thesis_hook_after_teaser','end_adsense');

Summing it all up, here is the entire code for the ultimate Adsense Section Targeting in Thesis.

// Adsense Section Targeting
function start_adsense(){
echo "<!-- google_ad_section_start -->";
}
function end_adsense(){
echo "<!-- google_ad_section_end -->";
}
add_action('thesis_hook_before_post','start_adsense'); // Adsense targeting for posts
add_action('thesis_hook_after_post','end_adsense');
add_action('thesis_hook_before_teaser','start_adsense'); // Adsense targeting for teasers (optional)
add_action('thesis_hook_after_teaser','end_adsense');
add_action('thesis_hook_after_comment_meta','start_adsense'); // Adsense targeting for comments (optional)
add_action('thesis_hook_after_comment','end_adsense');

Warning: Direct copy-pasting of code from this page may give you invalid characters.


3 responses to “HOW TO: Adsense Section Targeting In Thesis”

  1. Victor, adsense is a contextual ad program and it shows related ads only by default that means if you write a review of your latest gadget people will see gadget related ads on that page. That is how Adsense works with section targeting enabled or not.

    By targeting you specifically tell Adsense bot to consider particular sections from your webpage.

Leave a Reply

Your email address will not be published. Required fields are marked *