Rabu, 09 Juni 2010

Adding Adsense in a single post

This trick may be you already know, but I try to write back again. You already know how to display adsense in the post, now I try to give a few tips how to display adsense into post, but on a single post only. Before you already know that display adsense in the post will improve the CTR (click through rate) that will more generate income adsense to you. 

well now that I want to share is, how to display adsense in the post only on the posting of the selected course, adsense will not appear in the main page (home page) and pages in the archive (archive).

Well if so, we further tips that hopefully useful to all

Showing Adsense In Posts On A Single Post

I didn't want this ad unit to appear on the home page or on archive pages.

It would be easy enough to do this in WordPress / PHP, but I had no idea how to customize a Blogger template. I consulted Blogger's Help facility and found a list of Layouts Data Tags, which let me see what could be done. Despite the options being fairly limited, I found the answer I needed: The pageType tag, which can have a value of 'item', 'archive' or 'index'.

My XML coding skills are a little rusty, but thankfully it wasn't hard to work out how to include some HTML based on the type of page:

This says: If it's a single post, include the HTML (obviously you have to put it in). So single posts (pageType of item) will display the HTML, but the home page (pageType of index) and archive pages (pageType of archive) will not.

Applying this to our Adsense problem, here is the full code you need (with the publisher specific information removed). Use this instead of the code in the Adsense Within Posts section above. The first and last lines should already exist in the template, the rest is what you're adding. 



Of course, this means that only two Adsense units will be shown on the home page. If you're doing things properly, most of your visitors should arrive on single posts, via the search engines, so this solution's good enough for me.

Tidak ada komentar: