Unable to add Google analytics code

schwim
schwim's picture

Joined: 2002-10-02
Posts: 80
Posted: Sun, 2010-05-02 20:06

Hi there everyone,

I'm having a problem implementing Google's analytics code into my matrix theme. I've successfully added it to phpBB3, Wordpress and countless other templated systems and have only had a problem with Gallery2.

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-00000000000");
pageTracker._trackPageview();
} catch(err) {}</script>

I have tried adding this code both as you see it and with all of the double quotes escaped to /themes/matrix/templates/local/theme.tpl, but once I clear the template cache, I get the blank page and have to do the emergency cache clear, replace the previous theme.tpl and rebuild the cache to get a working system.

THe same code is being used in the other portions of the site and it's working properly, so it doesn't seem that the code is incomplete or incorrect. I'm just not implementing it into the Gallery2 templating system correctly. I thought maybe the {}'s were causing an unintended conflict.

Any help getting it integrated would be greatly appreciated :)

thanks,
json

 
schwim
schwim's picture

Joined: 2002-10-02
Posts: 80
Posted: Sun, 2010-05-02 20:09

Found the {literal} tag :)

sorry for the interruption :)

thanks,
json

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2010-05-02 20:29

For future searchers:
http://codex.gallery2.org/Gallery2:How_To_Add_Google_Analytics_to_my_Gallery_2

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team