22 August 2007 - 06:55 (where I live) support@drupal.org
Hello list members,
Ive just set up a Google analytics account for my first Drupal site using the abac template.
I have to include a tracking script on pages that I want 'tracked' but Google says to place the script just above the closing 'body' tag.
I'm at a loss to translate this instruction when dealing with PHP - can somebody point me in the right direction, please.
Many thanks.
Hi,
Install the corresponding module: http://drupal.org/project/google_analytics
On Wed, 22 Aug 2007 07:00:38 +0100 The Janitor wrote:
I have to include a tracking script on pages that I want 'tracked' but Google says to place the script just above the closing 'body' tag.
I'm at a loss to translate this instruction when dealing with PHP - can somebody point me in the right direction, please.
In your theme folder find file named page.tpl.php. Open it for editing and scroll down to find something like:
</body> </html>
And then paste the given script right above the "</body" line.
That's the easiest and lightest decision. There is also a module dedicated to Analytics, but in my opinion it is overhead and unneeded for such a small feature.
You may then decide to exclude yourself from tracking. Then, if your username is, say "admin" you wrap the analytics code this way:
<?php global $user; if($user->name != 'admin') { ?>
....here goes the analytics code......
<?php } ?> </body> </html>
And there it is ;)