Adding a Hitcounter to your iWeb Site
This tutorial will show you how to add an invisible Statcounter to your iWeb site! Yeah thats right! invisible Statcounter. For visible ones you can just use the HTML snippet box that iWeb provides!
Hey, although it says “Statcounter” right at the top - you can use this tutorial for any other hitcounter, like Google Analytics or Crazy Egg!
Also note that this tutorial is binary! This means that the whole tutorial will work for both iWeb 1.X and iWeb 2.X (iLife ‘08).
Looking for cool iWeb Templates? Go here!
So let’s get started with the Tutorial:
- First thing is to download iTweak which is a free application built by myself and James which will make this tutorial a hugely easier! So thank me for saving your time!
- Sign up for Statcounter or with whatever hitcounter service you want (i.e Google Analytics). In any case, set up a project with them and follow their steps until you get a code. That is where you stop!
- Open iWeb Expander and navigate to the “Hitcounters” tab and tick the option to “Integrate invisible Hitcounter.” Then copy the code you got in step 2, and paste it into the text-box. You can post several counters in the box as well.
- Then hit the “Choose Published Site” button and select your Site. If you publish to a folder, then you should know where your site is. On the other hand, if you publish to .Mac (MobileMe), you might not know. It is on the iDisk, in the “Web” folder, then in the “Sites” folder and then select the folder named after your site.
- Now, the hardest thing … click the “Create” button.
- That’s it! Be sure to do this everytime you publish your site because iWeb overwrites the files everytime it publishes!
If you run into any problems, then please contact me via email and do NOT use the comments form below.

Additional Note
Looking for cool iWeb Templates? Go here.
If you enjoy my Tutorial and wish to make a small Donation, then feel free to do so by clicking here.
28 Nov 07 at 8:31 am
The StatCounter webpage gives me an option to choose HTML only code, and it tells me this:
t is not recommended to choose this option as it will not be possible to record the referring link, page title and other information. Only choose this if you web host does not allow you to insert javascript into your webpage. We recommend you move to a web host that will give you proper access to your website.
So do I check it or do I stick with the java code? Thanks
28 Nov 07 at 8:56 am
do not choose the html code!!!!1
07 Dec 07 at 1:07 am
Trying to use the hitcounter section I receive a “Applescript Error - Finder got an error: AppleEvent timed out. (-1712)” error after pressing the Add Hitcounter button. It takes some time for the message to come up.
Thought?
Appreciate the effort you have put into this little application!
07 Dec 07 at 8:52 am
i presume you are using dotMac dayold?
try it with a ethernet cable and with a fast internet connection. same goes for the mac, try it with a intel one with 2 gigs of ram.
the problem is dotMac and its slowness. imap gets timed out because dotMac is not responding
max
21 Dec 07 at 7:51 am
I can’t get the Hitcounter section to work for me. When I click the “Choose iWeb Site” and try to select my .Mac account folder under /Web/Sites, the /Web folder is showing up as a shortcut and not letting me select it. In Finder it also has the little arrow on the icon indicating it is a shortcut, but when I double-click on the /Web folder, it shows me /Sites. Any way to deal with this?
Thanks!
21 Dec 07 at 10:07 am
if you get that arrow, it means that you have idisk syncing activated. you need to deactivate that.
max
21 Dec 07 at 6:01 pm
I’m sorry Max, I’m a bit confused here. If I don’t have idisk syncing on, then I don’t have access to my idisk on my desktop so that I can choose that /Web/Sites directory. I still have access to it via my account at mac.com, but I can’t point to that with your iWeb Expander program. So if I turn syncing off, how DO I point to that folder? Thanks…
21 Dec 07 at 7:40 pm
send me a screenshot of your system prefs of dotMac. also send me screenshots while you are trying to choose your site.
use the contact form. comments here are going to get crazy
max
26 Dec 07 at 6:51 pm
Thanks Max for helping. It’s now working great. A couple of suggestions for future updates that would be really helpful for the Statcounter area of the program include:
1. Have the program automatically save your last statcounter code, so you don’t have to re-paste it in every time you run it.
2. Have the program do some sort of “if/then” check before it pastes the code into the iweb pages. Currently, when you update a page in iWeb it overwrites the iWeb Expander code. But when you publish the updates to one page, it doesn’t republish all of the other unchanged pages. Then when iWeb Expander runs, it appends the code again to those pages a second time. The only way around this is to republish the entire site every time you update (”Publish All to .Mac”), so that when iWeb Expander runs after that, each page has only one set of iWeb Expander code at the end. This of course is much more time consuming.
Thanks for the great program! Keep up the good work!!
27 Dec 07 at 9:45 am
i am already working on these two feature requests
they will come soon
15 Jan 08 at 8:17 pm
Max,
The app seems to freeze up every time I attempt to “add hitcounter,”
16 Jan 08 at 10:06 pm
bryan and to the rest with this freezing timeout error
i have solved it an i will release the update of iwebexpander (and imap) next week!!!
check the front page for updates (blog)
thanks,
max
16 Jan 08 at 10:08 pm
UPDATE:
everyone and to the rest with this freezing timeout error
i have solved it an i will release the update of iwebexpander (and imap) next week!!! ( so jan 21st)
check the front page for updates (blog)
thanks,
max
16 Jan 08 at 11:03 pm
Hi Max,
When trying to use the stacounter app. I get the following error:
Applescripterror
Can’t make every file of “clasS ects” of class “cfol”"kraenkel:Web:Sites:iWeb:MMBP.”of applicatio”Finder”whose name extension of it = “html”into type alias. (=1700)
Any help on this?
Appreciate your help.
Roberto
17 Jan 08 at 1:50 pm
I get the same message as above (XIV. Roberto)
17 Jan 08 at 7:41 pm
do you have idisk syncing activated?
max
17 Jan 08 at 8:07 pm
Max,
I turned syncing off and it worked!
Thanks for your great program.
R.
21 Jan 08 at 5:09 pm
Hi I’m gettinf the following error when I try to select folder:
Can’t make every file of «class ects» of «class cfol» “stevenpatterson:Documents:ConcertGuitars:” of application “Finder” whose name extension of it = “html” into type alias. (-1700)
Ant ideas what I’m doing wrong> iDisk sync off
Thanks
Steve
21 Jan 08 at 8:45 pm
@steve,
it appears that there are no html files in that folder that you have selected!
could you tell what there is inside that folder?
max
22 Jan 08 at 2:48 am
Yes there are .html files in the folder along with folders associated with each .html file, in iWeb’s usual manner.
Many thanks, Steve.
23 Jan 08 at 6:49 pm
Delete the iWebExpander preference file. also try to publish to another place and see if it works from there.
26 Feb 08 at 12:10 am
I used the Google analytics code and it seemed to add smoothly, but then I checked the Google Analytics page and it says ‘tracking not installed: the code cannot be detected on your website’.
I pasted the Google Analytics (New Tracking) code in the Hitcounter area of iWeb Expander, then I selected my website folder in iDisk. I added the code to my site and then I got an alert noise, when it seemed to have finished. I published my site and checked Google Analytics and I got the above message. I also tried checking it without publishing the site. What am I doing wrong?
I’m also confused - am I supposed to add the code before or after I publish my site?
26 Feb 08 at 8:32 am
does the sound more sound like a funk sound or a glass (bling) sound?
14 Mar 08 at 1:30 am
Great work Max!!
17 Mar 08 at 5:23 pm
Hi– the statcounter didn’t seem to be working at first, so i tried it a few times, and now I seem to have few statcounters only 1 or 2 #s apart….how do I get rid of 2 of them?
thanks so much! I am new at all this.
Kate
19 Mar 08 at 10:12 pm
Kate,
simply republish your site.
Max
25 Mar 08 at 3:42 am
Does iweb expander work with leopard? My web folder on my idisk won’t let me choose it. I still have to use MassReplaceIt and drag the folder over to add a favicon. Haven’t figured how to add stat counter that way.
Thanks,
Lisa
16 Apr 08 at 6:05 am
My post didn’t seem to post.
I’m not getting my site counter to work but I can’t figure out why. I’ve pasted the the default code into iweb expander, found my page via idisk and pushed add hitcounter but the statcounter shows no activity.
Can you help me figure why it’s not working yet?
Thank you,
nancy
20 Apr 08 at 8:50 am
I was hoping I might be able to win the ‘Dumb question of the year’ award.
I have pasted the code into my published file to activate stat counter. I chose the invisible to visitors option. Now here’s the dumb question. How do I view the stat counter?
Cheers….Scotty
20 Apr 08 at 9:15 am
award won!
You can view the stats in your statcounter account… 
13 May 08 at 8:43 pm
Hi Max. iTweak adds the code to all html pages in the site’s folder, including widget pages; This means I’m getting skewed statistics on Statcounter as it’s registering a hit every time someone mouses a rollover button or a page loads an embedded movie. Would it be possible to include an option to skip widget pages in the iTweak interface for a future release?
Many thanks,
Alnoor
15 May 08 at 9:10 pm
Alnoor - good you’ve told me about that bug. I’ll see what I can do and you can expect an update soon.
Max
18 May 08 at 1:34 am
I have my site saved to my desktop in a folder named “New Site.” When I click the folder, it shows the index.html file and a folder with the website name. All my .html files are gray and hence cannot be selected. I never even get to the point where the box gives you the option to “Add Hitcounter.” I use iWeb and do not use .Mac, so my iDisk is never on. I feel really dumb because this is supposed to be a 1-2-3 kind of app….. Help?
Phillip
08 Jun 08 at 6:24 pm
Attempting to add invisible Hit Counter (STAT COUNTER). I’m getting the following error when I attempt to CHOOSE PUBLISHED SITE from within iDisk folder.
AppleScript Error: Finder got an error: Can’t get name of alias “sortagolf:Web:Sites:Mudlooney_Revisions”. (-1728)
FYI. I’m using the Private Domain feature available in iWeb ‘08.
Thanks
09 Jun 08 at 6:43 pm
Donn - make sure iDisk syncing is deactivated.
18 Jun 08 at 5:04 am
Gentlemen,
I followed your instructions - written so even an amateur like myself can understand - but an having this outcome: I copy the code into the iWeb expander, and then hit “choose website.” Then I choose the folder to insert (in iWeb) from Sites/My Folder/aaaamusic. However when I publish - the next step for me is to publish (upload?) to GoDaddy - the code has, 1) first disappeared, and 2) now always returns to the “Apple Start Pag” when the Statcounter button. In iWeb I checked the Inspector button for the link code and it indicates “Apple Start PAge” instead of the Statcounter code.
Am I placing the code in the wrong place? (Is there anywhere else I can place it, i.e. I use Fetch to publish to GoDaddy - could I place the code in Fetch)
Suggestions? (I know I’m in the running for that dumbest question award, but I’ll take it if I can get this thing to work!
Many thanks,
Wayne
18 Jun 08 at 5:06 am
Correction re: above: I publish from iWeb to a folder which is then viewed in Safari.
18 Jun 08 at 4:20 pm
Good Morning!
Back at it again for another try. Unfortunately I am getting the same (unsuccessful) results. I am confused at the moment by your last instruction:
“That’s it! Be sure to do this everytime you publish your site because iWeb overwrites the files everytime it publishes!”
If I do all of this BEFORE I publish, my statcounter code is then erased/overwitten when I publish. Correct?
I remain confused.
RWB
19 Jun 08 at 10:55 pm
Gentlemen,
Sorry for the trouble. I finally figured it out. The hang up for me was getting into the html code in Safari after I had published my site from iWeb to a folder in Safari. Once that little step was solved (through Text Wrangler), it all fell into place.
Thanks again.
Sincerely,
RWB
20 Jun 08 at 8:32 am
Glad you got it solved Wayne! I would have helped you out earlier - but I didn’t have any time to do so, up until now. Now, it seems like you have already figured it out. If you ever have future questions, don’t hesitate to ask.
Max
05 Aug 08 at 5:14 am
I am getting the following error when I attempt to select my site from iDisk. It says” Finder got an error Can’t get name of alias KarenHelena:Web:Sites: Curls_Like_Us (-1728) I have turned off iDisks auto syncing. Please advise
05 Aug 08 at 8:07 pm
Karen - send me a email about it.
Max
11 Aug 08 at 2:44 pm
Hi there, I have tried using iTweak on my iMac 2.8Gb intel machine, (OS 10.5.4) and whenever I get to the step in the backup or hitcounter windows where I direct the “choose published site” button to my site folder on my iDisk the program freezes and has to be force quit. Also, any attempt to adjust the window size tab on the bottom right corner of the iTweak interface immediately and irrevocably collapses the window into a narrow horizontal strip, and once again I have to re-start the application. I assume that iTeak is not yet Intel Mac compatible, do you have any plans to make it so in the future?
All the best, Steve Jones.
11 Aug 08 at 5:07 pm
Steve,
The freeze is because iTweak is not receiving any uplink to your .Mac account. Try using a ethernet cable or with a faster internet connection. In most cases, that solves it.
For the window resize, that seems to be a bug. I will fix that later today and bring out an update.
Max
12 Aug 08 at 12:05 am
Thanks Max, not many developers are as quick to respond as you, thank you for your suggestion. My wireless internet connection is running at around 4M per second, is that too slow? I don’t think I can get it any faster than that without moving closer to my telephone exchange to improve ADSL speed. I hope I can get it working, iTweak looks like it fills in all the things that Apple left out.
All the best, Steve.
13 Aug 08 at 10:06 am
Steve,
Your internet should be totally fine. It is just, that most users have reported that iTweak doesn’t work of wireless. As soon as they plug it into their dusty and old cable, it works fine. I don’t know why that is … but I suggest you go ahead and try it.
Many have been having problems recently with MobileMe/.Mac. Maybe it’s an issue with them as well…
Max
20 Aug 08 at 2:53 pm
Hi Max,
First thank you and great job with this software!
I’ve run everything smoothly for Google Analytics add up and I can now see Google Tracker code on my Welcome page the iTweakHitCounters Begin and End code insert. Nevertheless Google Analytics doesn’t seem to find it?
I’ve got a similar message than David (XXII. above) when checking the Google Analytics page it says ‘tracking not installed: the code cannot be detected on your website’
NB: I’ve heard a glass noise.
Any idea?
Thanks
Damien
21 Aug 08 at 12:38 am
Hey Max,
I think MobileMe recently changed their iDisk so that you dont have a local copy. Now iWeb publishes directly onto the MobileMe server so we dont get a chance up update our code and sync.
I think what we need to do now is publish to some other folder and manually copy files over to our iDisk.
21 Aug 08 at 10:28 am
Max,
I’ve found the solution to the problem highligted yesterday. After specifying in Google setting the Default page as : SiteFolderName/Welcome.html tracking start to work.
Now I can donate
Thanks
Damien