Tuesday, May 27, 2008

Google Analytics in Drupal

Been cracking my head in installing the Google Analytics script in my drupal sites. Have this drupal version 7 site, unfortunately the Google Analytics module available as of this writing is for versions 5 and up only. A dilemma for dynamic sites... Tried posting the script in the following as advised in www.drupal.org forum threads: template pages (page.tpl.php), index and incluldes, etc.

However, I think the best method that work for a test site is perhaps creating a block and publishing the google analytics script in there. To best have accurate analysis reports, publish analytics block accordingly, e.g. excluding the /node/edit* pages or /admin* pages. This way only anonymous visits are logged and recorded. On the other hand, reverse the publishing to determine administrative behaviors. Neat! Worked like a charm!

P.S.

the generated reports didn't come until after 24 hours... or a disclaimer from google that due to technical problems it may not generate some reports at all, somethin' like that... the adage, patience is a virtue... indeed!

No comments:

This blog has been archived and is not maintained any longer. For similar useful posts, please visit www.jeromeesperanza.com

Search

Google