Image Image Image Image Image Image Image

Blogger Post Views Counter Tip

Saturday, July 18, 2009 Things 222
Post views: counter

Some website, such as blogspot.com (Blogger) are not written in PHP and there are no external tools for allowing us to add a post hit counter to this kind of website / blog. By post counter i mean: a visible counter that display (on the website, for every user to see) the number of views (page loads) of each individual post.

But here is a way to do this using an image counter (installation instructions for Blogger, but you can use it on any website):

Go to Layout > Edit HTML, click "Expand Widgets Templates", and copy this code:


Post views: <img alt='counter' expr:src='"http://earthpop.net/counter.php?page=" + data:post.id + "&digit=v88"' />



Where you want it to show up. I can't say exactly where because it depends on your theme, but to have it show when on a post page only (item), make sure it's under a line of code that looks like this:

<b:if cond='data:blog.pageType == "item"'>


And also it would make sense to be somewhere around:
<data:post.body/>


If you do not use Blogger, use this code instead:

Post views: <img alt="counter" src="http://earthpop.net/counter.php?page= + data:post.id + &digit=v88"/>



and replace data:post.id with something that will generate a unique number/text that is always the same for a particular post but different for each post, like I used the post id, or something similar. You can view a demo under my posts. (only when clicking on a post, not on the main page!).

You may even like these posts



0 comments: Blogger Post Views Counter Tip