开发者

Two google analytics id on one website

开发者 https://www.devze.com 2023-02-04 00:27 出处:网络
Can two goog开发者_开发技巧le analytics ids exists on one website?yes.Create two separate objects:

Can two goog开发者_开发技巧le analytics ids exists on one website?


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消