Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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

share|improve this question
    
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. –  paulmorriss Sep 17 '12 at 13:53

1 Answer 1

up vote 0 down vote accepted

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']);
  _gaq.push(['_trackPageview']);

  (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);
  })();    
</script>

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

share|improve this answer
    
yes this is how i did it anyway. thank you –  miako Sep 29 '12 at 18:55
    
you are welcome –  Yannis Dran Sep 29 '12 at 20:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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