UseBB Community

UseBB support, discussion and development

Google Analytics

Post Reply

Page: 1

Author Post
Member
Registered: Jul 2008
Posts: 1
Google new code won't work :(

<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">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._initData();
pageTracker._trackPageview();
</script>


Need some help please.
« Last edit by Dietrich on Thu Jul 10, 2008 5:02 pm. »
Developer
Registered: Apr 2004
Posts: 2248
Please explain what you are doing.

Moved to customizations.
Member
Registered: Apr 2005
Posts: 22
He means that the newer google analytics code which is supposed to be inserted just before the closing body tag of the HTML. Produces an error like this when you load your board -

Quote
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /hsphere/local/home/jasidog/boxers.jasidog.com/talk/templates/boxers/global.tpl.php on line 173


I guess it involves unescaped bits of code or something. Any ideas what to change?

Line 173 looks like this by the way -

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
« Last edit by jasidog on Sun Oct 12, 2008 3:54 pm. »
Developer
Registered: Apr 2004
Posts: 2248
Templates are encapsulated into strings (surrounded by single quotes), thus any single quotes need to be escaped.
Member
Registered: Apr 2005
Posts: 22
Thank you for helping with what I'm sure seems like an idiot question Dietrich.

Works fine now, appreciated! :)

Post Reply

Page: 1

UseBB Community is powered by UseBB 1 Forum Software