[support] Google analytics tracking script

Yasen Pramatarov yasen at lindeas.com
Wed Aug 22 07:15:24 UTC 2007


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 ;)

-- 
| Yasen Pramatarov
|        a.k.a. turin
| home: http://yasen.lindeas.com
| jabberID: xmpp:turin at jabber.org
| http://lindeas.com - working on gnu/linux ideas


More information about the support mailing list