Better AdSense Targeting

by Chris K

About the “Better Adsense Targeting”:
This is a WordPress Plugin that will allow you to choose which sections of your page Google’s Adsense service will use when determining what ads to display, allowing more relevant ads to display based off your content. The included shortags [ignore] and [/ignore] allow you to have content within your post or page ignored as well.

View My Posts about AdSense and WordPress:

Download version 1.1

This is tested on the most recent version of WordPress. The minimum for this plugin is WordPress 2.7.1.

To install this plugin within WordPress
1. Login to your WordPress admin area
2. From the Plugins menu choose “Add New”
3. Search for ‘better adsense targeting’
4. Verify that it’s the ‘Better Adsense Targeting’ plugin and click ‘Install’
5. You should now have ‘AdSense Targeting’ as an option in the Settings menu, go there and set up the plugin to your liking.

To install this plugin manually:
1. Download the .zip archive
2. Unzip and upload the “better-adsense-targeting” folder to your “wp-content/plugins/” directory
3. Then simply Activate the Plugin
4. Use the ‘AdSense Targeting menu option to configure your settings.

Taken from the Google Section Targeting page:

You can use section targeting to make suggestions about as many sections of a page as you like. However, please be aware that we can’t guarantee results, and that it may take up to 2 weeks before our crawlers take into account any changes you’ve made to your site.

In order to properly implement this feature, you’ll need to include a significant amount of content within the section targeting tags. Including insufficient content may result in less relevant ads or PSAs. In addition, please keep in mind that this feature should only be used to emphasize significant sections of your site’s relevant content. It is against our program policies to manipulate the ad targeting to result in ads that are not relevant to the content of your pages.

Change Log:
-Version 1.1-
Corrected issue when the loop is entered in the sidebar
Am now using the Shortcode API for the and tags in posts
Removed option for Comments as there is not valid way to know the start/end of comments loop yet.
Added check for W3 Total Cache and warn to allow comments when minifying

-Version 1.0-
Added the ability to include ‘In-line’ ignore statements. If you wish for Google to ignore specific sections of your post just wrap it in the and tags.

-Version 0.1-
Initial release.

{ 11 comments… read them below or add one }

Chris K September 6, 2010 at 6:06 am

The version was committed to WordPress and should be available shortly in the plugin repository.


Elizabeth September 17, 2010 at 2:35 pm

How do you get the adsense ads to show up in the post? I’ve followed all the instruction but don’t see where to input any adsense information or see the ads. What am I missing?


Chris K September 17, 2010 at 3:53 pm

You would need to add the AdSense code manually into your post or use the AdSense Manager plugin. This plugin does not manage ads, it only assists in targeting the ads once they are displayed. Sorry for the confusion.


Wendy December 3, 2010 at 7:36 pm

This is a great plugin, however I’m have one problem. When I tell it to ignore the content in my sidebar, it only ignores the very top part of my sidebar, but not the whole sidebar. How can I get it to ignore the entire sidebar.



Chris K December 4, 2010 at 8:04 am

The issue is being caused by the Recent Posts widget. In order to insert the code at the right sections I have to use what are called Hooks. The problem comes in your first sidebar….

The section that contains your ‘Follow/Friend Me’ content uses the proper hook for starting the sidebar. The ‘Recent Posts’ section is using what is called ‘The Loop’ in WordPress. In order to hook the post content in the main section of the page I have to hook ‘The Loop’, since recent posts widgets (and all the widgets that pull X number of posts) use ‘The Loop’ as well, it will follow the same rule as post content. The other issue is that the ‘Footer’ of your site isn’t actually a ‘Footer’ it’s simply another sidebar.

The important part here is though that it’s determining your ads based on the Post Titles, which isn’t all that bad. I will see what I can do to help mitigate issues with recent posts widgets in a future version. Unfortunately, I’m not sure when I’ll have that done but keep looking for an update and hopefully I can get something to you soon.


Wendy December 4, 2010 at 8:43 pm

Thank you so much for the explanation and helping to fix the issue. I will definitely look for the update in the future! Great plugin!!!


Dennis Francis August 6, 2011 at 1:43 pm

I love this plugin. I’ve just started using it in my latest article directory. It works like a charm. My old directory needs something like that. The old one is a PHP architecture from a script called article friendly. If you can create a similar plug in for that directory, I’ll pay you for the service. Let me know if it can be done.

Dennis Francis
DiD Publishing


ferry August 15, 2011 at 11:25 am


I installed your plugin over a week ago and still having issues pulling the correct adsense adverts, could you please give me some advice?


Chris K August 15, 2011 at 7:25 pm


There are a few things to keep in mind, you installed it but did you make sure to properly configure your settings? Also, if you are logged into your Google account, it may be pulling some of your ads based of what they call ‘Interest’. You can modify your ad units to use ‘Context’ ads only and ignore ‘Interest’ ads within your AdSense settings. The other thing to remember is that it can take up to 2 weeks to take effect. One thing I do is use SEO Ultimate to keyword each article and my homepage. The Ads use your keyword tags to help determine as well. There are many factors to getting relevant ads, this plugin simply helps with the contextual part of things.



Maria October 15, 2012 at 11:34 am

I have just installed your plugin but it did not resolve the issue I have with my front page. I need something that will help me target the ads specifically in the homepage of my site. All the other posts are fine but my problem is limited to the homepage. Can you help me stop getting generic ads on the homepage?


Chris K October 15, 2012 at 4:45 pm


If you have just activated this plugin, it can take up to 2 weeks to get results sometimes. Google’s ad crawler will need to re-crawl your site with these HTML comments in place before it can know what to ignore and what to use.

If you are still having the problem then, let me know and I’ll look further into it. This plugin is merely an attempt to fix generic ads, unfortunately it’s up to Google to choose them and in some cases, targeting may not help.

Thanks for the comment!


Leave a Comment

{ 5 trackbacks }