How to Add a Hit Counter to a WordPress Template

How to Add a Hit Counter to a WordPress Template
Page content

WordPress Hit Counters

Adding a Hit Counter to your WordPress Template is probably easier than you may think. In order to add the hit counter to the template, you will have to go into the theme editor and insert it in one of the templates on that page. Before we get started, go ahead and find a hit counter you want to use. Then get the code of the hit counter. Copy the code and leave it in your clipboard.

Locating the Template in WordPress

First, step is to locate the template in WordPress. Login to your admin panel and click Design > Theme Editor. This is where all of the files are stored that are in the theme you are using for WordPress.

Choosing the Theme File in WordPress

Now that you are in the Theme Editor panel, you will need to decide where you want to place the hit counter. For this tutorial, let’s say you want to paste the hit counter at the bottom of each page. In that case, we would paste the code in the footer file. Placing the code in the footer file will place the hit counter at the bottom of each page.

So, that means we will need to select the footer file. On the right side of the box you are looking at, you should see the Footer (footer.php) file. Click that file to load the footer file in the theme editor window. Now you will need to look for the closing div tags. There will probably be at least two closing div tabs. There may even be more. You will want to paste the code you copied right before the first closing div tag.

Saving the File

Now you will need to save the file to add the hit counter to your WordPress Template. At the bottom of the editor, you will see the Update File button. Click that file to save the changes you just made to your template. Now you can view your website to see your new hit counter.

You are free to add the hit counter to any part of your template. If you mess the template up when you paste the code and save it, simply go back to where you pasted the code and delete the code. Then save the file. The template will go back to normal. Some hit counters use large ads that will throw your template out of whack. So, try to go with some simple ones.