Hi,

I'm working on a site and need to add the code for a commercial web statistics tool (like Google Analytics). The code is supposed to go right before the closing body tag. I tried adding the code to page.tpl.php in my theme but somehow that didn't work.

I'd be glad for any advice with this!

Thanks
RPK

Comments

steve hanson’s picture

But why not just use the excellent Google Analytics module instead?

Steve Hanson
Publisher Eye On Dunn County
https://eyeondunn.com

rpk’s picture

I need to implement a different statistics tool.

RPK

mcsolas’s picture

>I tried adding the code to page.tpl.php in my theme but somehow that didn't work.

Did you clear the site cache?

What happened to the output source code: does it disappear completely or become modified ( ie filtered ) in some way?

rpk’s picture

Oh, the site cache - That was it!

Great, thanks for your help!

RPK

manop’s picture

You might consider adding your statistics codes to a block as an alternative instead of adding directly to the template file . Then place the block into the footing area.

I use this approach, so the code will not be overwritten when I upgrade/update a theme.

Don't forget to use FULL HTML instead of FILTERED HTML too.

rpk’s picture

That's an interesting approach I hadn't considered! Thanks for the advice!

RPK

mcsolas’s picture

>I use this approach, so the code will not be overwritten when I upgrade/update a theme.

This makes sense.. I did this once with some analytics code. I upgraded the template and still haven't put it back...