Mar 11 2008

How to add Google Analytics to Joomla

Print
Written by David Towers   
Tuesday, 11 March 2008

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...

13 Comments
Rajesh
March 19, 2008
Votes: -1

Hi Nice article.

report abuse
vote down
vote up
David T
March 19, 2008
Votes: +0

Thanks Rajesh!

report abuse
vote down
vote up
raman
March 26, 2008
Votes: +0

Very simple and effective content about joomla. Will be very useful for budding web masters. Thanks

report abuse
vote down
vote up
Prinson
March 29, 2008
Votes: +1

Thanks for your help. I appreciate it very much

report abuse
vote down
vote up
Greg
April 07, 2008
Votes: +0

Thank you very much! I originally downloaded a module that supposedly made this process easy. It didn't make it easy, because there was a lack of documentation, and it only supported the legacy mode of Google Analytics.

In contrast, your post was a simple solution. Thanks again!

report abuse
vote down
vote up
Javier Giron
April 15, 2008
Votes: +0

i added the code exactly as you said, but it still didnt work.
GA doesnt recognize that the code has been added.
Please advice me what to do.

Thanks!

report abuse
vote down
vote up
Tamara
April 16, 2008
Votes: +0

Hi, It takes a day for GA to track info. Try checking tomorrow for your stats

report abuse
vote down
vote up
Rob
April 17, 2008
Votes: +0

The next problem, once Analytics was collecting data, was that all of the page names show up in the reports as:
"index.php?option=com_content&view=article&id=126&Itemid=87..."

Hovering over the names in the reports will add the article ID but good luck working out which page that is off the top of your head! smilies/smiley.gif

Is there a way to make Joomla or Google use the Article name or something more friendly in the report?

report abuse
vote down
vote up
David T
April 17, 2008
Votes: +0

Thanks for posting Raman, Prinson Greg, Javier, Tamara and Rob!

Javier have your stats appeared yet? Tamara's right, there is usually a lag of about a day.

Rob if you use sh404sef to make your URLs search engine friendly, you won't have this problems anymore. Why not try installing the sh404sef extension on your website?

report abuse
vote down
vote up
nitin
June 14, 2008
Votes: +0

thanks the article rocks

report abuse
vote down
vote up
Rakesh
July 04, 2008
Votes: +0

Thanks David T,

For Starting such a nice post on Google Analytics, I also installed GA and waiting for a day as said visitors above to detect code by GA.

report abuse
vote down
vote up
aa
July 22, 2008
Votes: +0

thank you, great article, very helpfull smilies/wink.gif

report abuse
vote down
vote up
ja
July 24, 2008
Votes: +1

Ovo ti je dobar članak lafe. Hvala.
This is good article pal.
Das ist sehr gut Information Kamarad.

report abuse
vote down
vote up

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

busy
 
Ninjoomla

Latest comments

How to add Google An...
Ovo ti je dobar članak lafe. Hvala. Thi...
Sh404sef and Joomla ...
Hey andrie, just figured it out: Set the...
Sh404sef and Joomla ...
Hey andrie, I've got the same problem he...