I want to insert google analytics tracking code in my joomla site.

so i registered in the official site of google and saw there is an advanced tab with three more options than standard.

Do i have to check "i want to track dynamic pages" and "i want to track php pages"? Do these options provide me better results or they are necessary for a dynamic site based on php like joomla? Does anyone know the process of installing? because i didn't manage to make it work by following this

Also where do i place the tracking code? Because of some bugs some say it is better just after the tag <body> whereas other say just before the tag </body>.

Thank you

  • You've lost a couple of words - "after the tag". If you put in the missing word (I'm guessing it's either head or body) then highlight it and press ctrl-K then it won't get swallowed up. Sep 17, 2012 at 13:53

1 Answer 1


In my case I didn't bother with any additional details and I recommend that your don't either based on your experience. Best to just go with the default options.

Copy and paste the following snippet on the last line just before </body>.

<script type="text/javascript">    
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXX-X']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

Also ensure that you fill UA-XXXXX- with the user-id issued by Google Analytics.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.