Keeping count of visitors.
Ever wonder how many visitors your site or blog attracts? While you may have access to site statistics software that tracks and reports site visitors and hits, you may not. Or you may prefer a simple, old-fashioned visitor counter that’ll make this information easily available to visitors.
I use the free visitor counter offered by SiteMeter on my wickenburg-az.com Web site. And, for illustrational purposes, I’ve just added the same kind of counter to the sidebar of the WordPress book support Web site site. (Let’s see if Miraz lets me keep it there.)
Here’s how you can add a counter like this to your site or blog.
- Sign up for a SiteMeter account. It’s pretty straightforward and easy to do, so I won’t provide step-by-step guidance. Go to www.sitemeter.com, click the appropriate link, and provide the required information. You’ll get an e-mail message from the SiteMeter webmaster with login information for future use. You’re already logged in.
- Click the Manager link near the top of the page on the SiteMeter site. Then click the HTML Link on the left side of the page. You’ll see a list of links for adding code to various sites and blogs.
- Click the link labeled “Adding Site Meter to a WordPress blog hosted on your server.” (If you have a WordPress.com blog, you can click the link for that. Then follow the instructions there. These instructions assume you’re setting this up on a sever-installed WordPress blog.)
- Scroll down in the page that appears and select the contents of the edit box that displays the code for the counter. Use your browser’s Copy command to copy the code to the clipboard.
- Now open the
sidebar.phporfooter.phpfile for your theme with your favorite text editor or WordPress’s built-in theme editor. - Position the insertion point where you want the counter to appear.
- Use your text editor’s or browser’s Paste command to paste in the code you copied.
- Save the file.
- View any page of your blog that includes the sidebar or footer (whichever file you modified) to make sure the page isn’t messed up. You should see a counter similar to the one shown in the sidebar of this page.
A few things to keep in mind:
- You can set options on the SiteMeter site for your account to modify the appearance of the counter. If you want more options, you can pay for a premium account that gives you more control over the appearance.
- You can also set option on the SiteMeter site to prevent the counter from including your computer, based on its IP address, to restart the counter, or even to count by an increment other than 1 (which is cheating, of course).
- You should always back up a theme file before editing it, just in case you mess up the editing and need to go back to the original.
- You can put the code in any theme file for your site, but it’s best to use a file that is accessed by all pages. That’s why I suggest
sidebar.phporfooter.php. - Depending on the theme and the file you modify, you may have to add additional HTML formatting codes for the counter to appear correctly. For example, you may have to surround the counter code with
<li>and</li>codes to display it in the sidebar properly. Experiment with coding until you get it just right.
Of course, you can learn more about editing theme files for your site in Chapter 6 of our book, WordPress 2: Visual QuickStart Guide.
SiteMeter offers reports for activity on its site. Wait until you have some statistics and then use your login information to check it out. I think it’s cool — but then again, I love stats.
Might want to try out W3Counter too. You might like it better than SiteMeter. Integrates with your FeedBurner account to provide feed stats as well as live public or private web stats.
I checked out W3Counter and liked what I saw. Nicer, more mellow formats available for my site. (I’m not into flashy graphics.) I installed it on this site (SiteMeter is on the WordPress VQS site) and will try it out, at least for a while. Thanks for suggesting it — are you the programmer?
W3Counter sounds better, glad i came across this!