Thesis Tutorial – How to Add Adsense Section Targeting

Post image for Thesis Tutorial – How to Add Adsense Section Targeting
Michael Gray

By Michael Gray
In Blogs  

Print Post Print Post Email Post Email Post    ADD TO STUMBLEUPON Sphinn It ADD TO DEL.ICIO.US  Tweet This

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.

2222009_62728-pm

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.

Related posts:

  1. Thesis Tutorial – Adding Date Based Triggers to Your Posts There are a lot of times when you are working...
  2. How to Add a Carousel to Your Thesis Blog If you’ve spent any time visiting blogs lately chances are...
  3. How to Add a Visual Slider to Thesis The following is a tutorial on how to add a...

Crazyegg Link Tracking

{ 21 comments }

Pål February 23, 2009 at 9:38 am

Hi, good to be reminded of the importance of section targeting – but do you really need to add functions to get it rolling? I’ve always just dumped the ad_section_start/end tags on either side of the content in the single page template?

Michael Gray February 23, 2009 at 11:17 am

that’s how thesis works, you create the functions and tell it where to put them, you NEVER EVER touch the core files. I was really skeptical that it was actually better in the beginning, but now I totally see the benefits.

Everett February 23, 2009 at 2:23 pm

MG

Your affiliate link didn’t work. Hope that’s not affecting all of your link redirects from the /go/ folder.

“You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ at line 5 on line: 2659″

Cheers,

E.

Michael Gray February 23, 2009 at 3:10 pm

thanks, weird it works for me but no one else, sometimes i hate plugins …

Benson February 25, 2009 at 1:34 pm

Make sense, thank you :) *Works

luca February 25, 2009 at 2:11 pm

Nice post. One question: the final result I get is:

- adsense code
- adsense start tag

post

- adsense close tag
-adesense code

Do both adsense codes need to be between the tags? or it doesn’t matter?

Thanks

Michael Gray February 25, 2009 at 2:50 pm

I don’t think it matters, but I’ve never tried it that way

john February 25, 2009 at 2:11 pm

I prefer to use before_content and after_content, which brings in the post title and comments respectively. If you want the post title included but do not want the comments included then you could use before_content and after_post.

Michael Gray February 25, 2009 at 2:51 pm

if you do you have to make sure your titles are KWD focused not “clever and witty” ;-)

Kelly from Almost Frugal February 26, 2009 at 10:54 am

I have Thesis and LOVE it. I’d just like to add that if you do use it, you should then install Rick Beckman’s Thesis Open Hook plug-in, as you can then add the hooks you want directly into a plug-in, without going into the template. An even more graceful and sophisticated solution for a graceful and sophisticated theme.

rikin February 26, 2009 at 2:17 pm

First time here and a really informative post and site in general. The link to section targeting seems broken and I’m kind of a noob so would really like to learn more about it.

Thanks!

Michael Gray February 26, 2009 at 3:22 pm

weird try it now

Jeet February 26, 2009 at 9:37 pm

I have been using adsense for years now, but never knew about section targeting :( Good information here, I don’t use thesis on my sites and they are hand-coded but I will definitely try this on a blog and see if improves the kind of advertisements that are shown on my blog.

Erin February 27, 2009 at 10:10 pm

This is a great tip!

Is there any way to check that I installed it correctly? I’m relatively code-illiterate.

Thanks for the great info!

Michael Gray February 28, 2009 at 9:18 am

View source after you are done and look for the open and close tags. Make sure you turn off any caching software like WP-Cache

Erin March 1, 2009 at 11:14 am

Thanks Michael! Looks like I did it right, thanks to your fabulous instructions.

Erin

Milan March 1, 2009 at 11:34 pm

I added these lines to my custom functions file.

I will definitely be keeping an eye on my eCPM during the next few days.

Kristi March 3, 2009 at 12:48 am

Just wanted to say thank you! That was a perfect tutorial.

ipanks March 5, 2009 at 8:17 am

its to know how to add adsense for better place so we can gain much benefit and of course we can gain much money.thank you very much

seobro March 6, 2009 at 6:19 pm

I stqand with you bro! People need to find things fast. Any help to make their job easier will make them more contented.

Chris March 6, 2009 at 6:24 pm

Thanks for this–I need to get better returns on Adsense ads.

Comments on this entry are closed.