Advanced adsense targeting for your post content Pt.1

Adsense is a great way making money from your blog. It also allows content targeting for ad units. Here i will give you a little trick you can use on your wordpress blog to target your ads using your post content. You can easily target your ads putting your content inside <!-- google_ad_section_start --> and <!-- google_ad_section_end --> tags. This is simple but not handy. Let’s automate it for all our wordpress blog posts using a simple content filter. Here we go..

1. Open your functions.php file in your theme folder.
2. Insert this code:

function insert_ad_targeting($<span class="hiddenGrammarError" pre="">content) { 
	$content</span> = "<!-- google_ad_section_start -->".$content."<!-- google_ad_section_end -->"; // Wrap the content with targeting tags
	return $content; // Return it
add_filter('the_content', 'insert_ad_targeting');

3. Save your file & upload it to your server. And you are done.

Now all your pages & posts will be wrapped for ad targeting generating relative ads only for your post contents.
I will show you how to ignore certain parts from ad targeting in the second part.

Hope you like it.

Related Posts

NS Weight Release

WP-Backgrounds Lite by InoPlugs Web Design and Juwelier Schönmann 1010 Wien