Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Analytics code changes from New to Legacy Urchin Format


Go to End


3 Posts   2358 Views

Avatar
Gringa

Community Member, 11 Posts

3 February 2009 at 4:23pm

Does anyone else have this problem? I'm copying/pasting the New Google Analytics Code (ga.js) but when I hit "Save", the code automatically changes to the Legacy Urchin format. I'm using Analytics, not Urchin. Is it possible for the program to insert the new format instead?

Code pasted:

<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-5974966-6");
pageTracker._trackPageview();
} catch(err) {}</script>

Upon Hitting Save code changes to the Urchin format, but with the next-to-last line of code missing :

<script src='http://www.google-analytics.com/urchin.js' type='text/javascript'></script>
<script type='text/javascript'>
_uacct = "UA-5974966-6";
urchinTracker();
/*code missing: "} catch(err) {}" */
</script>

Avatar
BuddhaSource

Community Member, 57 Posts

3 February 2009 at 7:57pm

Is Page.SS the right place this code ?

Its better to hardcode it rather than copy pasting to each page from admin.

Avatar
Gringa

Community Member, 11 Posts

5 February 2009 at 8:29am

Thanks for your response. I'm not sure I follow your response.

Using the Google Analytics module, I did copy/paste the code from Google Analytics. Google gives two versions of the code: Analytics and Urchin. I pasted in the Analytics version. When I hit "save", it changed to the Urchin version automatically.

Since this is happening, I will copy/paste the code into the html. It would be nice if the extension worked.

Thanks!