Most of our clients want to track the performance of their Joomla website – and what better way to track that performance than with Google Analytics? Google Analytics provides the website owner with a wealth of information about his website: how many visitors the websites gets per day, where these visitors are coming from, and what kind of devices these visitors are using. Google Analytics is also ideal for tracking conversions in conjunction with Google Adwords.
Google Analytics is a very easy tool for what it does, installing it, on the other hand, can be a bit tricky for those who are new to Joomla. Some try to add it in a custom HTML module which is placed in the footer of the website and assigned globally. They’re shocked to see that when they save the module, the code disappears! And they start wondering, “why did this happen?”
The reason why the code disappears is that the custom HTML module in Joomla does not accept JavaScript as input. It filters JavaScript out for security reasons. So, where does someone add Google Analytics code to his website?
There are three places where the Google Analytics code can be added:
- In a 3rd party module
There are many modules in the JED (Joomla Extension Directory) that can be installed in order to add the Google Analytics code on a Joomla website. All one needs to do is to download one of these modules, install it on his Joomla website, set its parameters to reflect his Google Analytics account number, enable it on the website, and he’s good to go!
This is probably the easiest and the most common way to add Google Analytics code, but you’ll be installing an extension (usually developed by a little known programmer) that may or may not be hacker proof! Additionally, the placement of the Analytics code may not be where you want it to be.
-
In the template
Adding the Google Analytics code to the website’s template is very easy: all you need to do is to go to the template manager, open the index.php file of the template that you’re using, and add the code there (near the end of the page). That’s it!
The flip side of this is that if you change your template, you will have to copy back the code. Additionally, you (or your developer) might forget a template or two to add the code to if you have several active templates on your Joomla website.
-
In a in-house developed system plugin
This is our favorite way for adding Google Analytics code. It consists of developing a configurable system plugin that will automatically add the Google Analytics code to every page on the frontend of the Joomla website (in a specific place in your HTML code, just before the <body> tag). What makes it better than the previous two methods is that it’s quite easy to develop, and that it works in all conditions as long as it’s enabled. Additionally, you will be using a trusted code, which is your code, or the code of someone trustworthy! (maybe us, at itoctopus, perhaps?)
Now, if after reading our guide, you are still having problems installing the Google Analytics code on your Joomla website, then feel free to contact us. Our rates are inexpensive, our work is professional, and we are confident that we can help you!