Powered By Blogger

Tuesday, May 13, 2014

Two different google analytics code for one website

<script type=“text/javascript”>
var _gaq = _gaq || [];
  _gaq.push(
  [‘_setAccount’, ‘UA-XXXXA-X’],
  [‘_trackPageview’],
  [‘b._setAccount’, ‘UA-XXXXB-X’],
  [‘b._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>
You can just copy the above code and replace UA-XXXXA-X and UA-XXXXB-X with the two account codes that you want to use to track the site.

No comments:

Post a Comment