WordPress hit counters powered by Google analytics

It have recently added the Google Analytics Post Pagesviews plugin to the WordPress site here.

This means that the WordPress site can now show some of the statistics that Google Analytics is collecting on behalf of the site. Neat… The plugin uses API call to the Google Analytics service and extracts the number of visitors to a given post that Google believes to be unique (properly a good estimate). The counters is of course only as good as the underlying Google Analytics, which means it has only been counting since this was setup…

Installing the plugin required a little more effort than usually for plugins as both the SAML authentication needed to be setup, as well as manually placing the counter code in the relevant page of hte theme which in my case is currently MH Newsdesk (it was the content.php).

I actually needed to call two functions from the content.php.

echo gapp_get_post_pageviews();

Being no expert on WordPress I recon that the first function is necessary in order for The Loop to populate the ID variable (though not really documented in the plugin).

I did consider it twice whether or not to include statistics for ordinary users to see, but in the end decided for it, as I guess it could potentially be interesting for people to see how many have had similar interest in a given post.

Be the first to comment on "WordPress hit counters powered by Google analytics"

Leave a comment

Your email address will not be published.