Make technology work for you

Using WP Super Cache with Stats

WP Super Cache and Stats are two very useful WordPress plugins. WP Super Cache provides static and dynamic cache functionality to reduce the load on your blog’s server, allowing larger amounts of traffic to visit without slowing the site down. Stats tracks visitors and gives valuable information on how users utilize your blog. If you plan to use both of them together, you should be careful though.

The Problem

The problem arises due to Stats’ behavior of not recording statistics for logged-in users. This is usually desirable, since these users are most likely yourself and other blog authors. This means that when logged in, a visit to your blog does not invoke the necessary JavaScript code to update statistics.

What happens when you have WP Super Cache enabled? If you visit a page that is not cached, a cache will be generated. If you are logged in at that time, the cached page will not have the stat updating code. This page will then be served to future users, whether they are logged in or not, resulting in lost statistics. This is a problem for all statistics tracking that relies on checking if users are guests or not.

The Solution

The solution is to check the option in WP Super Cache called “Don’t cache pages for logged in users.” This will cause cached pages to always be for guests only, and thus contain the stat updating code. Be sure to clear the existing cache after enabling this option to make sure the wrongly cached pages are gone.

Of course, this is not ideal if the blog has a large user community. In such a case, a different stats package should be used anyway. Google Analytics, for example, should work just fine on cached pages as long as the JavaScript is always present.

2 thoughts on “Using WP Super Cache with Stats

Leave a Reply to Brad Cancel reply

Your email address will not be published. Required fields are marked *