views:

908

answers:

3

I am setting up a new blog and looked for a widget I could add that would give me the total number of views for a blog post (and it would be nice to find out the number of views in the last X days) and didn't find any.

Is there a quick way of setting this up?

+1  A: 

If it is for you to see (i.e. not an on-screen counter, but something you can look at separately): Google analytics, perhaps with feedburner if you have an atom/rss feed.

Adding google analytics is simply a case of adding a few lines of script (that it generates for you); and it gives so much information (not just how many hits, but a proper usage history, referring sites / search terms that people used to find you, physical location by IP, etc). And it is free.

Marc Gravell
Google analytics is great
JoshBerke
Cool, will check out google analytics. Do I need to add the script for EVERY blog post? Also, to get the stats, I need to check using my google account?
Bob Smith
If your blog framework allows you to add script to the page template, that would be simpler. Yes, you use your google account to check the stats.
Marc Gravell
Bob, you'll want to add the GA javascript code to the main master page of the theme you are using. You can find it here: /themes/YOURTHEMENAME/site.masterJust edit the site.mater file w/ a text editor like notepad, and you will see that it is very similar to regular html page. You just find the closing </body> tag and paste the javascript right before the </body>.
Rafe
Once you have your GA script, go to the blog's admin page and click on the "Settings" tab. There's a section part-way down the page called "Tracking script". Paste your GA script in there, save, and you're ready to go.
Eric King
+3  A: 

Bob,

Got something for you here. I created it a while back, just never made a post for it. It should be EXACTLY what your looking for.

Top Posts / Top Comments Widgets

Scott
I guess you took Al Nyveldt's code base for this widget. But you modified it in a good way. Very handy. thanks Scott.
Kamyar
+1  A: 

Check out Al Nyveldt's post Most Popular Posts Extension and Widget. It does what you want in terms of counting. If you're willing to extend BlogEngine.NET, you can fairly easily consume the file his extension produces to display all posts and the number of times they've been viewed. Remember to make it accessible to admins only, if that's what you want.

scottmarlowe