UPDATE: The proper way to add Google Analytics to your iWeb site is either through iWeb SEO Tool or SEIntelligence. Please click on the links to watch the proper way of adding Google Analytics using these tools.
Google Analytics is a fantastic tool for getting every sort of statistic for your site that you could ever dream of. It is so much more than number of visitors to your site, and if you are serious about your iWeb site you need the sort of information Analytics can provide.
Why is Google Analytics such a good idea? I hear you ask. As I mentioned above it will give you the number of visitors to your site, but it can give you a lot more. It will tell you which browser, operating system, screen size and resolution of your visitors which is information vital to you when considering the design of your site. It will break down your most popular pages and, of course your least popular so you know what sort of imformation visitors come to your site for.
You can find out where the majority of your visitors are coming from in the world to help you tailor a page or 2 toward them. Analytics is also slowly but surely intergrating adsense so you can check your revenue at the same time. There’s loads it will do and it will all help you to make your site better.
You should really check out what Google Analytics can do for your site, and adding it is so easy you will wonder why you hadn’t bothered before.
All you have to do is sign up for a Google account, if you don’t already have one, then head over to the Analytics homepage. You enter your site details and Google will give you a bit of code to insert on every page you want analysised. Highlight the code, copy it and then paste it into a new Text Editor page. At the end of the code add ‘</body>’ (without speech marks) Save it. You will need it again everytime you create a new page.
Now open your site in iWeb and then publish to a folder. Now open MassReplaceIt (you must have this app already, if not visit HexMonkey Software and download it).
In the ‘find’ window insert </body> then open up that Text Editor file you saved earlier. Copy all of the code from TextEditor and paste it into the ‘Replace with’ window of MassReplaceIt.
Switch to the ‘file’ tab and drag an drop your web folder onto the space provided. Hit ‘Replace’ and confirm all the changes.
Publish your site as normal. That’s it, job done. All you have to do now is resist the urge to check your stays every 5 minutes.
If you don’t want Analytics on every page you can just select the individual pages and add them to MassReplaceIt rather than the whole folder. Remember to save the query to use again later.
What about MobileMe hosted sites ?
As I don’t have a MobileMe account I am not 100% certain; but can’t you publish to a folder as I mentioned above, make the changes and then copy the web-site folder to your iDisk?
I am curious to know if the iDisk solution worked. I am in the same predicament as Karl and would like to add google analytics to my MobileMe hosted site.
Thank you for all the info you offer up on your Iweb site.
Thanks for this tutorial Karl.
Analytis work on idisk but take care for code changes in blog pages because you ll lost comments
Thanks for the tutorial, it totally worked!
Actually, it didn’t work…. after I inserted the code last night all my pages turned red in iWeb so I thought it must’ve worked – published it as normal and when I checked the code off firefox it’s the same as before ( is still just that, no additional codes are found). Suggestions?
Thanks for your comment. Are you publishing to MobileMe or your own host? Once you have made the changes with MassReplaceIt you shouldn’t have to go back in to iWeb. If it is your own host you should use an FTP application such as Cyberduck. If you are publishing to MobileMe you have to open your iDisk in Finder and copy/Paste the pages across.
Give that a try and let us know if it worked.
I realize that iWeb 09 works differently than previous iWeb in that you can directly FTP your site to the server using iWeb’s internal FTP outlet. Since I’m spoiled with iWeb 09 I haven’t had a chance to publish the site with a normal FTP app. Let me try that.
FYI… it works with MobileMe… publish the changes to your iDisk files/site following the steps above, and then DO NOT republish within iWeb. If you do, iWeb will overwrite the changes you have just made. The iDisk is the “guts” of your site, so once you do the find/replace, your site is already updated. Check the code using “view source” within Firefox, and check for yourself. Worked great for me! Thanks for the tutorial!!!
Hi, I have added the google tracker to my pages, and I want to publish. The newly coded pages are in a folder on my desktop, do I have to publish via a third party client now ? i.e. firefox ftp or similar. Or can I move the pages/folder to the place where iWeb places/uses them so that I can publish via the iweb ftp. I am on iWeb ’09 and it has performed flawlessly up until now and has allowed publishing on a regular basis as the site has changed.
Shaun, thanks for your comment. To publish your site now you will have to use a 3rd party app such as Cyberduck to upload to your web space.
Hope that helps,
This looks as if I have to remember to add the GA code every time I make changes to my iweb site ie each time I publish to a folder before I upload. Would it be ok to add the code using the html snippet in iweb to avoid this?
Thanks – your site is fab!
Sadly you cant use a HTML snippet with Google Analytics as it doesn’t place the code in the right place in your web page. If you use a separate FTP application such as CyberDuck you can choose to upload only the pages that have been updated.
I followed your instructions, but I’m not sure if it worked. I looked at the source on my site and I do see the code, but when I go to Google Analytics there’s no information. So…did it work or not?
Thanks for your comment. It doesn’t appear straight a way. If i remember correctly mine took a day or 2.
I hope iWeb 2010 has a HTML editor build in I love iWeb but the main thing that its lacking is the HTML editor its a pain to do SEO on it.
Rage’s iWeb SEO Tool makes adding meta-tags simple. Have you tried it?
Thanks a lot ! you are great and generous, your site is great, and I really appreciate all your simple, effective and smart advices !
A big fan
Great web site my the way. Best web site I have found for iweb, keep up the good work.
I have installed GA on my site, but just copied the html in the html wizard and it seems to work.
Am I missing any functionality if I do not use MassReplaceIt?
A big fan of the site,
Hi all: I added the iweb seo tool to a blog on iweb and, when I published it to mobile me. all my comments disappeared! I have written Rage Support. They simply tell me not to use the tool on any Blog. They have not been able to tell me how or if i can ever get all the comments back on my two year old Blog. Rage should let people know about this problem and do so IN BOLD LETTERS.
Anyone with a fix, please e-maill me at firstname.lastname@example.org. I have given up on Rage Support.
Same problem. I lost all the comments in my personal Blog because of iWeb SEO tools. Don’t use it. Or backup all you can.
Hi all. Feel a bit late to the party on this one, but I’m having a little trouble here.
Ben (message 20) says that his html widget worked for him? Is it possible he’s using a newer version of iweb that allows for this? (since he posted in Sept and most of the comments here come from April) Would it work if you added the phrase into the widget code? or do you not need that?
Secondly, i have trouble finding my iweb file? Am i looking in the right place if i go to user > library > application support > iWeb ? Cause then i can’t seem to pick individual files if i want to add to only certain pages.
Finally, when i try to massreplace as instructed in this file, it doesn’t find anything to replace, am I looking in the wrong place or am i just an appalling typist?
Thank you for your time.
And this fantastic website has made my steep learning curve in learning all this, immeasurably smoother. Thank you
Just have to say your site is AMAZING!
Question: You say that you need to do this every time a new page is created, but whatabout if a page is modified? For example, if I have a gallery page containing 5 albums and I want to add a 6th, to get analytics for the new album I would need to do this process again. But do I need to redo this for the gallery page? When I republish to my local folder after making this modification, does iWeb replace all the files, therefore removing analytics from the Gallery page?
Thank you very much!!!!