Easy iWeb Counter Adds a Free Counter To Your iWeb Site

Since the passing of MobileMe, many iWeb users are having to move their iWeb Sites to New Web Hosting. This can be a bit of a challenge as there is a new learning curve involved in understanding what’s required to get your iWeb site online again. We are busy creating lots of Screencasts and written Tutorials to help our iWeb users and you can check out our Written Guides and Screencasts in the menu on the right.

One of the things that many iWeb users miss, is the counter feature which was a simple widget to include in your iWeb Pages directly within the iWeb app, but is unsupported outside of MobileMe. This means that if you want a counter on your iWeb Site, you need to use an external script to achieve this – or use one of the free counters available on line that will place adds on your site and you don’t want that!

Our Web Hosting Plans at Rediweb Hosting, have many scripts available for you to use with a simple installation process, and one of those is a Hits Counter and Visitor Logger. As well as seeing how many people visit your site in a little counter placed wherever you want it, you can also view some realtime statistics of your sites activity on a separate page.

Within the Web Hosting Control Panel, you have the option to select the ‘Hits Counter and Visitor’ Icon, which when clicked, takes you through to the installation process. Installing the script is very easy, you just need to make sure you install it into the correct directory. You need to install the script into the directory in which your iWeb site lives which is a directory created by iWeb using your Site Name. You can usually see your site name in the url when viewing your iWeb Pages in a web browser. You will probably see www.yourdomainname.com/yoursite/youractualpage.html where the yoursite part is the directory iWeb has created for your iWeb Site files. This is the directory in which you need to install the script. Simple copy and paste that into the directory path during the installation process, then add a forward slash and a name of the directory into which your counter script will live. In the screencast we made to show you how to do this, we used thehits for the script directory name.

When the script is installed, you then need to click the link to the settings view displayed on the page. Choose Image Counter (GD) as the counter type, make your other choices about Digit Style, amount of digits, wether the counter increments on page refreshes etc.. and then click on Generate HTML. This will show you an example of what your counter will look like, and the code you need to use to get the counter to display on your iWeb Site Page. Copy the code between the first pair of angle brackets (including the < >  brackets themselves), and then back in iWeb, drop the HTML snippet widget onto your page. Paste in the code and position the widget where you want it. Now all you need to do is publish your site – Job Done.

You can even change the value of the counter, to match your previous page hits when your site was on MobileMe, or give your site a justified page count to start with. Using the File Manager or another FTP client, navigate through your site directories until you find your hits counter directory. Open that and inside you will wind a data folder, open that on you will see an XML file with your counter name. Open that file to edit it and at the top between the tags, you will see your total site hits. Change this to your new value and save. When you refresh you iWeb site, you will see the new value shown.

Just watch the screencast above and we will walk you through the whole process.

Video Transcript

Hello and welcome to another Screencast from RedIWebHosting.com.
In this Screencast we going to be looking at a solution for one of the most common requests we get from our iWeb users – and that is how to add a Hits Counter to your iWeb site.
A hits counter is available directly within iWeb, but it is unsupported outside of MobileMe and so you now need to look at alternatives. The great thing is that we at RedIWebHosting.com have a Hits Counter and Site visitor logger script available within your web hosting plan, and it’s a very simple process to install this and set it up to work with your iWeb site.
To begin with, you’ll need to be logged in to your Web Hosting Control Panel, so you have this view.. and Ideally, you will also have your iWeb Site open as well.
Back in your Web Hosting Control Panel, you scroll down to the Web Stats and Logs section and you will see the icon for ‘Hits Counter and Logger’. Click on this and you will see the instructions for setting it up.
The most important part about installing scripts like this, Is the directory where you install them.

Now just to make things a bit clearer, a directory is just another name for folder, but on our linux servers, they are referred to as directories.

The path you are shown to begin with is the root level path, which is the upper most level within your web hosting plan where you can upload files to. To make sure that the Hits Counter works perfectly without needing the change the paths to specific files, you need to install it into the directory in which your iWeb site lives. As iWeb creates a new directory using your iWeb site Name, and Publishes all your website files into it, you need to install your Hits Counter into that directory.

Your Site Name, Like mine in this case, may well have spaces and upper and lower case characters, so to be sure we use the correct directory name we are going to need to copy it from within our file manager. Use the Go Back link at the bottom to return to the main page within your Web Hosting control Panel. At the very top you will see the File Manager, click it to open, then clicking on the little disclosure arrow next to your root directory – the public_html folder – will show its contents. In here you will see the directory created by iWeb and in which your iWeb Site lives. When you click on the disclosure arrow for that, you will see all your web files and media. And it is in here that we need to place our hits counter so it works seamlessly with our iWeb Site.

We can see that the directory name is using underscores instead of the spaces I used in the site name back in iWeb, so we need to copy the iWeb Site directory name as it appears here to make sure we install our script in the correct place. The best way to do this is by right clicking in the directory to show the contextual menu, and then clicking on rename. Do not change anything here as your site will go offline, just copy the name and click cancel. Now use the back button to return to the main page and select hits counter once again as we now know where we want to begin installing our script. Paste in the iWeb directory name you copied a moment ago and then add a forward slash. We now need to think of a name for the directory where the script itself will live. I am just going to call it thehits for now, and so I type that in after the forward slash. That’s it, all we need to do now is click on the Install Now button and our servers will create the new directory for us, and install the Hits Counter Script. We can see the path to our new hits counter is shown and if we click on that, we can begin to set up our counter.

The first thing you need to do here is select your counter type. To use this counter on iWeb, you need to select image counter (GD) as this method does not require the page to be processed by the server, which is perfect.

Next you need to give your counter a name. You can have multiple counters running on your site at any one time. Perhaps you may want a different counter on a specific page to see how much traffic that one page gets. For now we are just going to add a counter to the home page and I’m going to call it thecounter. As it says, you can only use alpha numeric characters, so no spaces please.

There are several different options of how your counter will be displayed, and you can select the digit style here. Next you can select how many digits will be displayed, and I’m going to select 4. The last option is to say wether or not the counter increments if a page reloads. I’m going to say yes to this as it makes it easy for us to test it’s all working nicely. Clicking on the Generate HTML button will show us an example of what our counter will look like – though not the exact amount of digits – If we want to change the look of our counter we can simply use the back button in the browser, pick a new style and click on Generate HTML again.

This page also contains the code we need to add to our iWeb page to actually display the counter. You need to copy all the code between the first pair of angle brackets.
Then switch back over to iWeb and select the page you want to display the counter on. I am going to add the counter to the home page of my test site which is called Welcome. Drag the HTML Snippet Widget onto your page and release it. Click into the pop up window that appears, paste in the code we just copied, and position the widget where we want it.

That’s it. Now we just need to publish our site.

When we view our site now in iWeb, we can see the counter displayed in place. When we refresh the page the counter increases.

We can now view the url of our counter statistics to see the results. The address to visit is the path to your hits counter directory, which in this case was www.alittlebirdietellsme.com/My_Super_IWEB_Site/thehits and then add /stats.cgi to see the – well, stats.

The last little trick helps you to re-establish your previous site count that you had when your counter was working on Mobile Me. Hopefully you remember roughly how many hits you were up to and we can set that as a current starting point for our new counter.

Go back to your Web hosting control Panel and click on file manager. Navigate through the directories as we did before, this time opening up the directory for your counter which in this instance was thehits, and then open the Data directory. Inside here you should see the xml file for your hits counter. My counter was called thecounter so we need to right click on this to edit it. If you do not yet see the xml file for your counter, please make sure you have already viewed your sites stats by viewing that stats.cgi file, as the xml file is not created until you view it.

At the top of the open xml file you will see a pair of Total Tags, and in between the total hits for your site. Simply edit this number to your previous hits counter amount and click on Save. When we view the site now our counter will show the new value, incremented by one as we just hit the site again!

Well that’s it for this Screencast from rediWebHosting.com.  If you have any questions or need to know more about our web hosting plans, then please visit us at rediWebHosting.com. See you again soon.

Leave a Comment

Your email address will not be published. Required fields are marked *