最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to have a single google analytics account for multiple domains - Stack Overflow

programmeradmin5浏览0评论

I have a Google analytic account which I'm using to track analytic of the domain a. Now I want to add b statistics to the same account. Given that they don't allow free Google analytic account creation anymore.

What I have done is according to this article and this. Both are the same.

Code are below here.

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-35089154-8']);
  _gaq.push(['_setDomainName', 'www.a']);
  _gaq.push(['_setAllowLinker', true]);
  _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/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

In the b domain I have below code

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-35089154-8']);
  _gaq.push(['_setDomainName', 'www.b']);
  _gaq.push(['_setAllowLinker', true]);
  _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/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

But statics of b is not show in Google analytic account? How can I fix this?

I have a Google analytic account which I'm using to track analytic of the domain a.. Now I want to add b. statistics to the same account. Given that they don't allow free Google analytic account creation anymore.

What I have done is according to this article and this. Both are the same.

Code are below here.

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-35089154-8']);
  _gaq.push(['_setDomainName', 'www.a.']);
  _gaq.push(['_setAllowLinker', true]);
  _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./ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

In the b. domain I have below code

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-35089154-8']);
  _gaq.push(['_setDomainName', 'www.b.']);
  _gaq.push(['_setAllowLinker', true]);
  _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./ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

But statics of b. is not show in Google analytic account? How can I fix this?

Share Improve this question edited Jul 15, 2013 at 12:47 Chris Morgan 91k28 gold badges216 silver badges220 bronze badges asked Jul 15, 2013 at 3:23 TechieTechie 45.1k44 gold badges164 silver badges247 bronze badges 1
  • Google Analytics is free. – MXMLLN Commented Apr 30, 2015 at 15:23
Add a ment  | 

2 Answers 2

Reset to default 4

Create a new property in the account (which will give you a new Account ID) and use that for domain b.

What is described in the article is cross domain tracking - that is needed only when you want to track two different domains so that they appear as one domain in your account (so you can for example track movements between the domains without losing campaign information).

@Eike's answer is correct. Below are the steps how it should be done.

https://support.google./analytics/answer/1042508?hl=en

发布评论

评论列表(0)

  1. 暂无评论