Orchard CMS Module for Page View Statistics

Orchard CMS Module for Page View Statistics

I developed an Orchard website for a client that wanted a quick and easy way to see trends in page views for routable content types like Pages, Products, Blog Posts, etc. The website was already backed with various hard core analytics. This request was more for casual use when managing store products or blog posts. They just wanted a simple bar graph that showed X days of page view statistics right within Orchard as they were managing various content types. As I have come to love, anything is possible in Orchard CMS.

Simple Page View Statistics in Orchard CMS

With a bit of client-side JavaScript and a server using a Redis backend we were able to capture page views on the website. It is lightweight, amazingly accurate, and working well. Now for the fun part. Displaying this in Orchard was very simple and perfect for their needs. A lightweight bar graph was generated while they browsed various content types from within Orchard. Again, these stats show up on anything of their choosing that is routable and displayed to the user. Here I am showing an image of what it might look like if I added it to my own blog.

Custom Orchard CMS Module to Display Page View Statistics

Orchard Web Developers will know this view as the standard summary admin view when displaying a list of content types. The bar graph is a simple daily total of views for that particular content type. The number of days and other settings are completely configurable. The graph is specifically meant to be lightweight and simple to just show a trend. Of course, hovering over a particular bar will show the number of views for that day. You get the idea. Simple yet informative.

Using It for Orchard CMS Training

When I was first building the custom module I used Orchard CMS to capture the page view statistics. You wouldn't use Orchard in a real website to capture these statistics, but it was perfect for testing. Now I am able to add this module to my Orchard CMS Training. This custom module shows off a lot of neat extensibility and developer techniques for new Orchard Developers.

  • Use the code generation tools in Orchard CMS for Orchard module development.
  • Create migration files to create custom content parts and attach those parts to content types in Orchard CMS.
  • Leverage NHibernate and IRepository interfaces in Orchard to store and retrieve data from Orchard Database.
  • Leverage dependency injection in Orchard.
  • Use ASP.NET MVC Web API within Orchard CMS.
  • Cache in Orchard to improve Orchard performance.
  • Use various shapes and the shape factory in Orchard CMS to dynamically display shapes on the fly.
  • etc...

Conclusion

I love creating Orchard CMS Themes, Modules, and Websites :)