Adding Google Analytics code to your Joomla template

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.

 

  • Tuesday, 13 August 2013

Who's Online

We have 341 guests and 3 members online

Join Our Newsletter

Free Classic Template

Sign up to our Newsletter and receive news on template releases and discount coupons along with free access to our 'Classic' Joomla template.

Joomla51 - Mullaghmore, Co. Sligo, Ireland
Joomla51.com 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.