LexiConn Knowledgebase

Knowledgebase Home | Favorites Knowledgebase Home | Favorites
Search the Knowledgebase Browse by Category
Using Urchin in conjunction with Google Analytics
Article Details

Last Updated
31st of December, 2010

User Opinions (31 votes)
45% thumbs up 54% thumbs down

How would you rate this answer?
Helpful
Not helpful

You can use the Urchin software in conjuction with Google Analytics, but you cannot use the standard code for both on a page simultaneously. Instead you need to eliminate the call to '__utm.js', and add in the line ' _userv=2;' to your Google Analytics code. The following code is the complete code that should appear on all of your pages (where xxxxxxx-x is replaced with your actual UA number):

If you are using the old GA code:

<script src="http://www.google-analytics.com/urchin.js"       type="text/javascript"></script>
<script type="text/javascript">
_uacct="UA-xxxxxxx-x";
_userv=2;
urchinTracker();
</script>


If you are using the latest version of the Google Analytics code, then you will need to add in the code 'pageTracker._setLocalRemoteServerMode(); '. Thus, your resultant code should be:


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

If you are using the latest/asynchronous code then you need to add in the code _gaq.push(['_setLocalRemoteServerMode']); Thus, your resultant code would be:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxx-x']);
  _gaq.push(['_setLocalRemoteServerMode']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

Related Articles
Attachments
No attachments were found.

Powered by Interspire Knowledge Manager Knowledgebase Software