Google Analytics is a powerful and free tool for analising traffic coming to your site. When running a website it is often crucial to understand where your traffic is been sourced from and how your traffic behaves once they reach your site. For this Google Analytics is the ideal solution.

To obtain this information Google Analytics uses some tracking code loaded in to every page of your site. Before we start you will need to retrieve this code from your Google Analytics account. For details on doing so may I suggest the following article here.

Here we will describe two methods of adding this code to your template.

The first method uses the Custom Code field found in some of our more recent template releases and couldn't really be much easier. From your Joomla administration navigate to Extensions -> Template Manager -> J51_[YourTempate] -> Custom Code and simply paste your tracking code in to the Head Custom Code field, click Save and that's it. It is important to note that if you are using multiple template styles across your site that you repeat this process for each of them.

The second method describes how to add your tracking code directly to your templates index.php file. This method can be used with any Joomla template, in particular if the Custom Code field is not available to you.

  1. Navigate to Extensions -> Template Manager -> Template -> [YourTemplate] -> Edit main page template
  2. Source the closing head tag of the template </head>
  3. Just before the closing </head> paste your Google Analytics tracking code
  4. Click Save

You have now successfully added the Google Analytics tracking code to your template.


Join Our Newsletter

* indicates required
We respect your privacy and do not tolerate spam and will never sell, rent, lease or give away your information (name, email, number, etc.) to any third party. Nor will we send you unsolicited email.
Joomla51 - Mullaghmore, Co. Sligo, Ireland is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by
Open Source Matters
the trademark holder in the United States and other countries.

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.