Google Analytics is a fairly popular tool to gather statistics about websites (visitors, visitor trends, search words used, incoming links…). So, obviously, if you’ve built – or are planning to build –a website using Joomla, you might be considering to use Google Analytics. If you’re thinking “Yes, sure, but what’s the best way to do so” this is just the post for you.
Note: This will be a brief summary. I will not be explaining how to create a google account, or how to sign up for Google Analytics. Google can explain that way better than me.
Before you start
1. Make sure that you’ve got a Google Analytics account (http://www.google.be/analytics) You’ll need a google account to create one. If you’ve got a Gmail adress, you can use that one.
2. Create the “profile” for your website in Google Analytics. Make sure to use index.php as your “default page.”
3. Copy the code Google Analytics will provide you. Maybe it’s a good idea to paste it somewhere, e.g in notepad
On your Joomla website
We’re not going to be using any modules or plugins for the Google Analytics code. They’re a pain in the ass to configure, and most of them don’t work. Since your Google Analytics code should be added to every web page of a website (or to a dynamic page), the easiest and best way is to add the code to the html file of the template you’re using. This html page is loaded with every page you open, so it meets Google Analytics’s requirements perfectly.
1. login to the administrator panel (http://somesitename/administrator)
2. Once logged in, navigate to Extensions > Template manager
3. Select the template you’re using.
4. In the window that opens, choose “edit html”.
5. A window will open, which shows the html code. Scroll all the way down to the bottom, until you see the following tags:
6. Paste the code you copied right before </body>
7. Click “Save”.
If you wait a minute or two and then return to the Google Analytics webpage, check the status of the website. Everything should be working fine now, and you’ll see your first data 24 hours later.