How to insert a visit counter in WordPress

Introduction

The visit counter (the widget that allows you to show visitors to a site how many visits it has made to a page) is a somewhat old-fashioned object, but definitely interesting for many webmasters. Showing visits to your site will be a bit like nineties, perhaps, but it remains a very frequent request from the many webmasters and bloggers of the WordPress community. In Blogger it is provided as a standard widget, while in WordPress it does not exist by default: it must be provided separately with a plugin or by programming it. In this article we will see three plugins that allow you to manually count visits to our site, and a bit of general information on how to make one “by hand”.

I remember that some of these plugins count unique visits (ie the number of visitors), while others count impressions (ie the number of website views).

I remember that this counter is a bit coarse, besides being old: being an internal method it can be falsified by the webmaster, so any advertisers on your site might be wary of your internal counter. Better to use external third-party solutions to count visits, in general, such as Google Analytics.

WordPress Hit Counter

One of the first possible choices for inserting a visit counter on the various WordPress pages is this plugin, which also has a fair amount of support and seems to work fine (it has not been tested with the most recent versions of WordPress, but it should still work). In practice, place a numerical counter with the scrolling figures – in jargon they are called odometer – automatically, by default, inside the footer, showing how many visits your site has made. For a matter of flexibility it is possible to set the starting number of the count by hand – the count is global and unique for all the pages of the site – and you can choose from a fair number of different graphic styles.

Download

ADS-WP SITE COUNT

This plugin serves to show a counter of visits within the site in WordPress, both as an image and as a text. Actively supports English and German as languages, to try.

Download

Hit Counter Max

Quite similar to WordPress Hit Counter, allows you to easily set up a visitor counter and place it on our website, with numerous options to follow: count the number of unique visitors, exclude our IP from the count (find your IP, by the way: open the link and click on “My IP“), Show the counter in the footer, set a starting number from which to count visits and show or not the credits of the authors.

Download

Create a visit counter manually

Creating a visit counter is not difficult: it is a decent programming exercise so it is sufficient to know how WordPress plugins are created. First of all the plugin must be divided into two sections: front-end (ie the part of the website visible from the outside) and back-end (the settings that we will see only ourselves).

To work, you need to understand if we want to count visits or impressions, and if we want to count them punctually on each web page of the site or as a single counter for all pages indifferently. If we want to count impressions it’s easy: just insert a variable that automatically increments with each display, and save the value in a MySQL table. If instead we wanted to count the only ones we should also save the user’s IP (for the current privacy law, only a part of the IP must be saved or must be saved in the form of hash or encrypted) and go to count it by an operation of count in MySQL.

For the backend and frontend part you need to be a decent level WP developer, of course, and go and read some documentation and examples before starting.

Among the basic options of the plugin I would put:

  • the starting number from which to start counting (assuming that one wants to “inflate” the figures or, more honestly, correctly count those that first counted with another external method)
  • a couple of styles CSS to choose from (for example those of the odometer in jQuery, one of the best and most practical plugins of the genre)

You May Also Like

Leave a Reply

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