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?

Bob Smith
  • 349
  • 2
  • 5
  • 15

3 Answers3

3

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

SpoiledTechie.com
  • 10,515
  • 23
  • 77
  • 100
  • 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 Oct 29 '10 at 18:55
1

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.

Scott Marlowe
  • 7,915
  • 10
  • 45
  • 51
1

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
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • 1
    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 Apr 22 '09 at 15:49
  • 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 Apr 22 '09 at 22:19
  • 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.master Just 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

    tag and paste the javascript right before the .

    – Rafe Apr 26 '09 at 18:12
  • 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 Aug 22 '09 at 23:13