image2 image3 image1

Analitycs
How to add Google Analytics to Joomla
Written by David Towers

Joomla Google Analytics Today we're going to answer a very straight forward question that we have been asked: "How can I add Google Analytics to Joomla?"

Google Analytics is a free website tracking tool which helps you understand your website's visitor. We highly recommend it, and in this post will run you through how to add Google Analytics to either Joomla 1.5 or Joomla 1.0.1x.

We have broken down the answer of this question into two steps:

1. Create a Google Analytics account
2. Add the Analytics code to your Joomla template

Create a Google Analytics account

Go to the Google Analytics website and sign up for account.

Once you've followed the registration process you will come to a page where you are given a tracking code to add to each page of your website. If you are given the choice to choose between the new tracking code (ga.js) or the old tracking code (urchin.js) choose the new tracking code.

Keep this webpage open with the tracking code on as we're going to need it in a few minutes.

Add the Analytics tracking code to your Joomla template

Adding the analytics tracking code to your Joomla website is really easy. We're going to show you how to do this through logging in to the administrator backend and editing your template's HTML.

In Joomla 1.0.1x

If you are using Joomla 1.0.10, 1.0.11, 1.0.12, 1.0.13, 1.0.14 or 1.0.15 do the following:

  • Log on to: www.yoursite.com/administrator/
  • In the top menu select: "Site" > "Template Manager" > "Site Templates"
  • Then select the template which is marked as default and click "Edit HTML"

In Joomla 1.5

If you are using Joomla 1.5, 1.51 do the following:

  • Log on to: www.yoursite.com/administrator/
  • In the top menu select: "Extensions" > "Template Manager"
  • Now select the template which is marked as default and click "Edit"
  • In the template edit page click "Edit HTML"

Adding the code within the template

If you have followed the steps above you should now be looking at your template's HTML.

  • Scroll right down to the bottom of all this code
  • On the second to bottom line you should see the tag </body>
  • You need to paste your Google Analytics tracking code just before this tag
  • Now press "save" and Google Analytics is installed on your website!

Here is a screenshot of the HTML of a template before we added the Google Analytics code:

Joomla HTML template

And here is the HTML after we added Google Analytics code:

Google Analytics in Joomla

Now you've installed Google Analytics, why not track file downloads automatically using our Google Analytics download tracking Javascript?

We look forward to answering your questions and reading your comments...