Closed (fixed)
Project:
Google Analytics
Version:
6.x-2.0
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Jan 2009 at 01:45 UTC
Updated:
18 Mar 2009 at 07:30 UTC
Hello everyone,
First, this is a WONDERFUL module, thank you for all your hard work.
Second, Google now recommends inserting a try/catch around the google analytics code, per the specification on this page.
http://code.google.com/apis/analytics/docs/gaTrackingOverview.html
Note the try/catch wrapping in the sample, below. I'm wondering if we could add this try/catch block into the module so it uses Google's recommendation.
Thanks!
<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-xxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}</script>
Comments
Comment #1
hass commentedThank you very much for this hint. This seems to be a *very* new update to this documentation pages... As it's an official recommendation now - I will add this.
Comment #2
trumpcar commentedThank you for the quick reply and action. Please let me know where I could grab and test. :)
Comment #3
hass commentedComment #4
trumpcar commentedSo quick.. thanks team for making these changes so quickly. I just tested and it looks great.
Comment #5
hass commentedUps, I missed the onclick tracking in googleanalytics.js...
Comment #6
Tiaan commentedIn addition to the remaining update on the "googleanalytics.js" file, you might also want to change the code for the "segmentation variable" in the "googleanalytics.module" file. My own patch a while back looked something like the following for the two files, but I haven't verified the "onclick tracking" yet...
Comment #7
hass commentedFixed the JS files.