Google analytics tracking script
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. -- Best regards, The Janitor mailto:thejanitor@fastmail.fm Flying with The Bat! Professional version 3.99.3 Privileged and/or confidential information and/or copyright material may be contained in this e-mail.If you are not the intended recipient or the person responsible for delivering it to the intended recipient you must not copy it,deliver it to anyone else or use it in anyway whatsoever.To do so is prohibited and may be unlawful. Instead, kindly destroy this message and notify the sender by reply e-mail. Fe all fod gwybodaeth freiniol a/neu gyfrinachol a/neu ddeunydd dan amodau hawlfraint y neges e-bost yma. Os nad y chi sydd i fod gael y neges, neu'r un sy'n gyfrifol am ei throsglwyddo, rhaid i chi beidio a'i chopio na'i throsglwyddo i neb un arall na'i defnyddio mewn unrhyw fodd o gwbl. Mae gwaharddiad ar i chi wneud hynny ac efallai y byddech chi'n torri'r gyfraith trwy wneud hynny. Dinistriwch y neges yma ac anfonwch neges e-bost at y sawl a'i hanfonodd i roi gwybod iddo fe. The author recommends NOD32 (www.eset.com) as the most effective and efficient anti-virus software.
Hi, Install the corresponding module: http://drupal.org/project/google_analytics -- # Vasileios Lourdas, # Informatics Engineer, Thessaloniki (Greece) # http://www.lourdas.name
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@jabber.org | http://lindeas.com - working on gnu/linux ideas
participants (3)
-
The Janitor -
Vasileios Lourdas -
Yasen Pramatarov