adding tracking code

SwissMountainLeader

Joined: 2010-05-20
Posts: 7
Posted: Wed, 2010-05-26 11:40

is there a good way to add the sort of tracking code like google analytics and similar? I know there's a module specifically for analytics but I've some other tracking code so I was looking for a generic way to add it. If it's just a case of editing the template which template is it exactly?

 
inposure
inposure's picture

Joined: 2010-04-23
Posts: 304
Posted: Wed, 2010-05-26 13:25
 
SwissMountainLeader

Joined: 2010-05-20
Posts: 7
Posted: Wed, 2010-05-26 15:33

thanks, that looks just what I needed. I had seen code_block already but it wasn't quite what I wanted.

custom_header looks exactly the right thing but unfortunately it doesn't seem to work as described. For example this :

[script type:\"text/javascript\" src:\"/slimstat/?js\"][/script]

gets rendered as

<script type:\"text/javascript\" src:\"/slimstat/?js\"></script>

and if you do try to save it as :

[script type:"text/javascript" src:"/slimstat/?js"][/script]

then the quotes just get escaped again. So there's some hookiness between mysql_real_escape_string and addslashes etc

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Wed, 2010-05-26 15:50

Just edit your theme's page.html.php file. You can put straight HTML code in there

http://codex.gallery2.org/Gallery3:Tutorials:Themes

So much easier than loading and relying on a custom module that may or may not work on a future upgrade, especially while G3 is still in development. Where if your theme stops working on a future upgrade, simply switch to the default, wind, theme and reapply your changes.

BTW, you may also want to install the purifier module if you haven't done so already. Without that, yes, anything that looks like HTML gets sanitized.
http://codex.gallery2.org/Gallery3:Modules:purifier

____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
inposure
inposure's picture

Joined: 2010-04-23
Posts: 304
Posted: Wed, 2010-05-26 19:33

@SwissMountainLeader: I've added a stripslashes command to the output, see if that helps.

@nivekiam: This module doesn't need the purifier, it bypasses it.

And theme pages are updated once in a while, too, making changes hard to track.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2010-05-27 01:06
SwissMountainLeader wrote:
google analytics

http://codex.gallery2.org/Gallery3:Modules:google_analytics

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
SwissMountainLeader

Joined: 2010-05-20
Posts: 7
Posted: Thu, 2010-05-27 07:46
floridave wrote:
SwissMountainLeader wrote:
google analytics

http://codex.gallery2.org/Gallery3:Modules:google_analytics

seriously? could you not read at least the first sentence before replying?

SwissMountainLeader wrote:
is there a good way to add the sort of tracking code like google analytics and similar? I know there's a module specifically for analytics

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2010-05-27 13:23

Perhaps you go adapt this module to the way you desire? But perhaps you don't want to or did not mention that you can't or won't.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team