How To Add a Hit Counter from Google Analytics to your Website
It’s reader question time again and this time it’s about Google Analytics. The full question was, ‘Can I add a hit counter from Google Analytics onto my website?’ A hit counter displays the number of unique hits, or views, of your website. It’s used to be a way to show visitors how popular your site was. It is used less now but it is still possible to add a hit counter.
It is not really practical to add your Google Analytics data to your website though. You can use an app called Google Analytics SuperProxy but it has a tendency to slow the page down as it performs the query. As PageSpeed is now such a deciding factor in SEO, I wouldn’t suggest using it. Instead, I suggest using third party counters or adding your own.
Adding a hit counter to a website
Even though adding data from your Google Analytics account isn’t very practical, you can still display unique hits in other ways. Before you do, you might like to read the section on ‘Why would you need to display a hit counter on your website?’ It might save you a little effort!
However, TechJunkie is about enabling people through reliable information so here are some ways to add a hit counter to a website.
Use your web host
Some web hosts offer a hit counter feature for free as part of their offering. If your web host uses CPanel or other UI with a list of available features, check it out to see if a hit or visitor counter is one of them. With my web host, it is listed under Analytics and once enabled, provides a piece of code you add somewhere on your page to display unique visits. Not all web hosts offer this kind of feature but yours might.
Use a plugin or extension
If you use a CMS such as WordPress, Drupal, Joomla or something else, there may be a plugin or extension you can use to display hit counts. There are dozens of counters for WordPress and many for Joomla. There are a few for Drupal and likely will be counters for other CMS too.
All you need do is search for a hit counter within your CMS extension dashboard and install it. Enable the counter and place it on your page where you want to display it.
Create a hit counter in PHP
I am not a programmer and never will be. Thankfully much brighter people are and are happy to share their knowledge. This page shows you how to build your own hit counter in PHP. As many websites use PHP anyway, it makes sense to use that language for your counter. You can create counters in PERL and likely other programming languages too.
There is more work in creating your own counter but you then have full control over it.
Use a website or third party counter
There are a number of websites that offer free web counters that you can add to your website. I have never used one but they work in a similar manner as these others. You select a counter, add the generated code to the position on the page you want it to appear and watch the number gradually increase.
Why would you need to display a hit counter on your website?
I haven’t seen a hit counter on a modern website in years. They used to be everywhere, just like those graphs and counters for skills, features and other metrics designers used to think looked cool. Like many other web technologies, they have kind of died away now.
Hit counters were a neat idea but had one major flaw. If your website was new, niche or not very popular, it told the world that in no uncertain terms. Not only was it bad for your confidence as a website administrator, it could also create a negative feedback loop. Genuinely interested people would close the page when they saw a low hit count as they assumed as nobody else visited, it wasn’t worth them visiting either.
Plus, those who used it as social proof before shares, likes or Disqus offered better analytics, knew that the counter could be gamed. There was nothing stopping a website administrator adding a couple of thousand to the count without ever having that many visitors so they were viewed as essentially worthless.
So yes you can add a hit counter to your website. Yes you can add a counter from Google Analytics but you shouldn’t. Before you do either of those, you really should consider whether you should add one at all. It is entirely up to you of course but I would vote no!