Since I’ve been asked, here’s a short recipe for adding a site counter to WordPress.
All the freely available site counters give you a piece of JavaScript. I personally used one from SiteMeter, but all the other sites work pretty similarly.
With WordPress, you can’t simply put it into index.html – it’s template based. You need to embed this code in a template that is always displayed – for most WordPress themes, that’s the SideBar.
So how do you edit it? Log in as site adminstrator. In the Administration page, go to the Presentation Page and select the Theme Editor. Select the Sidebar template. It will show up as a PHP file – but don’t worry. It really is HTML with a bit of PHP thrown in for good measure.
The whole sidebar is usually embedded in a single <div> tag – find the end of that tag. Right before the end of that tag, paste your javascript that you got for the side counter. That’s all there is too it.
On some WP installations, you might not be able to edit your themes through the web interface – in this case, below the textbox, you will see the string “If this file was writable you could edit it.“
That means you need to actually log into the shell for your account and modify the file there. Thankfully, the web page gives you the path to the file relative to the WP installation directory as a title above the text box – so just cd to there, and edit the file. Et voila, your site counter is active!
How would I survive on the blogosphere without you? Thanks for the tip!
I can’t find the sidebar to edit it. I want to add a counter but I haven’t been able to. HELP!
And how do you do it on wordpress.org?
Or how do you set it up under google analytics? Google Webmasters? Hmmm… all those questions?
I’m afraid these are a few to many to answer in a single blog post
(If you need help with any specific one, let me know. I’ll be happy to do a small screencast if I can)
I’m stuck with wordpress.org too. Any ideas?
nevermind, you just select footer instead of sidebar and put it above the tag
thanks for your tips!
1 have 24 images and want a counter on each to see which image is most popular. any suggestions?