szaman
szaman

Reputation: 6756

Two google analytics id on one website

Can two google analytics ids exists on one website?

Upvotes: 0

Views: 302

Answers (1)

CrayonViolent
CrayonViolent

Reputation: 32532

yes. Create two separate objects:

<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 pageTracker1 = _gat._getTracker("[first account id]");
pageTracker._trackPageview();
} catch(err) {}
try {
var pageTracker2 = _gat._getTracker("[second account id]");
pageTracker2._trackPageview();
} catch(err) {}
</script>

However...depending on what the context is, you may be able to achieve the same thing without duplicating tracking code. GA has a lot of ways you can create separate profiles, link GA accounts, etc...

Upvotes: 1

Related Questions