Thesis Tutorial – How to Add Adsense Section Targeting

Using Adsense on your blog usually isn’t the most profitable way to monetize it, but it is fairly quick and easy, which makes it a popular choice for many website owners. Last week I moved one of my commercial blogs to Thesis, and was reminded of the importance of using section targeting on your blog.

Section targeting is an adsense approved method of telling the ad serving algorithm which parts of your websites to pay attention to and which parts to ignore. Because blogs sometimes have a lot of extraneous info, non essential keywords, or low profit keywords on them, Adsense isn’t always as profitable as it could be. However by telling Adsense to use only the contents of the post for determining which ads to show AND (that’s a big and) putting the ads in that section, you usually get the combination of on target ads that are going to generate the most profit.

Is section targeting worth doing … the graph below shows Adsense CPM for the month of February, the three days in the box are the days the blog didn’t have section targeting enabled.


Once the section targeting was added back in you can see the earnings returned to normal. I’m pretty sure you aren’t allowed to show actual dollar amounts, CPM, or CTR rates from your Adsense account, but since this is sanitized I think I’m ok.

Now on to the real part of the tutorial, we’re going to be using hooks to add Adsense section targeting. If you aren’t familiar with how to add thesis hooks, you should read Thesis Tutorial – Hooks for Dummies.

Inside of your custom_functions.php file you want to add the following code:

//adsense targeting functions
function open_adsense_targting(){
echo "<!-- google_ad_section_start -->";
function close_adsense_targting(){
echo "<!-- google_ad_section_end -->";

That adds the functions to open and close the section targeting tags. You could use shorter names but I’m a big proponent of easy to understand programming, and if you come back 6 months from now it’s going to be really easy to tell what that programming is and what it’s used for.

Next we need this code:

add_action('thesis_hook_before_post','open_adsense_targting' );
add_action('thesis_hook_after_post', 'close_adsense_targting');

This uses the hook locations to tell it to open the tag before the post and close the tag after the post. If you are looking for a list of all hooks here’s a nice reference. That’s it that’s all there is to it.

I’m a big proponent of thesis, and and am going to move my blog onto it as soon as I stop being so lazy busy. The real benefit of thesis is it acts like a management layer for your design, so you don’t have to go into the template files to make your changes.  You don’t have to worry about messing up and breaking tinkering with core wordpress functions. It also makes it easy and painless for people who aren’t exceptionally skilled with programming to make changes. If you do know your way around the code it just makes it easier to get things done. It’s $87 for a personal copy or $164 for the developers license (which for me was a no brainer) if you were thinking of buying it feel free to use my thesis aff link 🙂 or you can go straight.

Thesis has an incredibly powerful and helpful community of supporters so it’s something I have no problem reccomending.

tla starter kit


  1. Text Link Ads - New customers can get $100 in free text links.
  2. - Get a premier listing in the internet's oldest directory.
  3. Need an SEO Audit for your website, look at my SEO Consulting Services
  4. TigerTech - Great Web Hosting service at a great price.