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.
In Word, you can also use the Special Characters pane of the Symbols dialog. Choose Insert > Symbol to display the dialog and click the Special Characters tab or button. Scroll down to find the character you want (they’re listed at the bottom of the list) and double-click the one you want to insert it. This is a rather cumbersome way to get the job done, but it does work.
Fortunately, Word offers a better, automated way. You can set an option in the AutoFormat as you Type pane of the AutoCorrect dialog that will automatically convert every straight quote you type to the corresponding smart quote. Choose Tools > AutoCorrect and click the AutoFormat as You Type tab or button in the dialog that appears. Then turn on the “Straight quotes” with “Smart quotes” check box. (As you can see, that’s the only feature I have enabled in this pane on my copy of Word; I don’t like Word messing with the formatting of what I type, as I discuss in “
First double check to make sure that the “Straight quotes” to “Smart quotes” feature is enabled as discussed above. Then choose Edit > Replace to display the Find and Replace window. Type the same plain old double quote character in the Find What and Replace With boxes. Then click Replace All. Word will replace the dumb double quotes with the correct smart quotes and tell you how many it replaced. Click OK to dismiss the confirmation dialog. Then type the same plain old single quote character in the Find What and Replace with boxes and click Replace All. Word replaces all the dumb single quotes with smart single quotes. Click OK to dismiss the confirmation dialog and close the Find and Replace window.