Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Drupal Statistics 2.0

Parent Feed: 

Since February 2012 I have been the maintainer of the Statistics module in Drupal core. Since then I have overseen two pretty big changes to the module.

Admittedly this was after in 2011 I tried to get the module removed from Drupal core.

The first big change was to remove a good chunk of the module, the access log. This tracked things like referrers and visitors, which most people do in a service like Google Analytics. This was committed by Dries to Drupal 8 in early 2013.

The second big change was to use an AJAX call to count a node view. This allowed the module to work even when a site was using a reverse proxy cache such as Varnish. As well as getting committed to Drupal 8, this was also back ported to Drupal 7.

Now I am on a mission to breath new live into the module.

A patch I’ve been working on for the last 3 years is to give the statistics module a swappable or overridable backend. Since July 2014 it has been possible to define a service as being “backend_overridable”, and this is exactly what I’m proposing for the statistics module. The patch waiting to be committed creates a service and moves all database queries to there, this can (and already is) be overridden by a contrib module.

This will bring a huge performance boost of allowing statistics to be written to CouchDB, MongoDB, Redis or anywhere.

The next step then is to get the statistics module to count views for all entity types and not just nodes. This is a legacy feature that is left over from Drupal 6 which didn’t have entities. Hopefully this can be committed to Drupal 8.1.x.

If you want to help out, please join the issue queue.

Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web