[support] Google analytics

J-P Stacey jp.stacey at torchbox.com
Mon Jul 16 08:43:05 UTC 2007


S.Theyagarajan wrote:
> what would be the ideal place to add google analytics code in a drupal 
> instance ?

Although the module suggestions are the best way to go in an ideal world 
(easier for a non-developer to switch on and off), if you're finding that 
your site is running slow then you could just put the Google Analytics code 
anywhere in your page and disable the module.

The code fragment is only two <script> tags, one of which brings in the 
Google Analytics library, and one of which sets it all running for your 
particular Analytics account. It would be quick to hardcode this, and unless 
your site administrators are turning it on and off on a daily basis for some 
reason (e.g. testing) quick for a PHP programmer not well versed in Drupal 
to find and remove when necessary.

I can't find the website at the moment, but I remember reading that the best 
place to put <script> tags for site performance is just before the end of 
your page content, so inside the </body> tag as someone said the module 
does. That way the page appears in the browser before the script is 
executed, rather than the other way round.

Cheers,
J-P


More information about the support mailing list