使用两个单独的帐户 ID 进行跟踪

发布于 2024-10-17 11:36:07 字数 1373 浏览 4 评论 0原文

我在主网站 www.example.com 上有跟踪代码 A,在 www.example.com/blog 上有跟踪代码 B,这是一个基于 wordpress.com 的博客(该网站本身是纯 PHP)。 毫不奇怪,来自博客的流量不会显示在主网站上,反之亦然。

我还想在博客上使用跟踪代码 A 来创建“汇总”配置文件,同时维护我当前使用跟踪代码 B 拥有的配置文件。

我认为正确的方法是使用以下代码:

<script>
  var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXX-1']);
    _gaq.push(['_trackPageview']);
    _gaq.push(['t2._setAccount', 'UA-XXXXXX-2']);
    _gaq.push(['t2._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);
    })();

但我在这里读到: http://www.google. com/support/forum/p/Google%20Analytics/thread?tid=640080c650f67bd1&hl=en

,它会导致访问者数量成倍增加等。

这样做的正确方法是什么? 我是否应该显式指定域并使用上面链接文章中所述的 _setAllowLinker() 方法,尽管事实上它是同一个域?

任何帮助将不胜感激。

谢谢, Alexander

P.S

我读过 Google Analytics - 使用两个帐户进行异步跟踪,但我仍然没有确定的答案。

I have tracking code A on the main site www.example.com and tracking code B on www.example.com/blog which is a wordpress.com based blog (the site itself is plain PHP).
Not surprisingly, traffic from the blog is not shown on the main site and visa versa.

I would like to use tracking code A on the blog as well to create a "roll-up" profile while maintaining the profile I currently have with tracking code B.

I thought that the right way to do it is using the following code:

<script>
  var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXX-1']);
    _gaq.push(['_trackPageview']);
    _gaq.push(['t2._setAccount', 'UA-XXXXXX-2']);
    _gaq.push(['t2._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);
    })();

but I read here:
http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=640080c650f67bd1&hl=en

that it causes a multiplication in visitor numbers and such.

What is the correct way to do this?
Should I explicitly specify the domain and use the _setAllowLinker() method as described in the linked post above despite the fact that it's the same domain?

Any help will be much appreciated.

Thanks,
Alexander

P.S

I read Google Analytics - async tracking with two accounts but I still don't have a definite answer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀞厅☆埖开 2024-10-24 11:36:07

实现您想要的结果的最简单方法是在站点范围内使用单个帐户/配置文件 ID,并使用配置文件过滤器创建“仅博客流量”配置文件。

您可以在全站范围内调用:

<script>
  var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXX-1']);
    _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);
    })();

然后,登录 Google Analytics,选择您的帐户(如果您有多个帐户),在 UA-XXXXXX-1 配置文件编号下添加新的配置文件(针对现有域),然后调用标签“博客流量'。

创建配置文件后,单击“编辑”您刚刚创建的配置文件。滚动到“应用于配置文件的过滤器”,然后单击“添加过滤器”。 Google Analytics(分析)为子目录的流量提供了预定义的过滤器(仅包括等于“^/blog.*”或仅“/blog”的子目录的流量)。

现在,您将拥有一个包含网站所有流量的配置文件和仅包含博客子目录流量的第二个配置文件。

有关使用数据过滤器的更多信息:
http://www.google.com/support/analytics/bin /answer.py?answer=55496

The easiest way to achieve the results you're looking for is to use a single account/profile ID site wide and use profile filters to create a 'Blog Traffic Only' profile.

Sitewide you would call:

<script>
  var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXXX-1']);
    _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);
    })();

Then, log in to Google Analytics, select your account (if you have more than one), add a new profile (for an existing domain) under the UA-XXXXXX-1 profile number, and call label it 'Blog Traffic'.

Once you create the profile, click to 'Edit' the profile you just created. Scroll to 'Filters Applied to Profile' and click 'Add Filter'. Google Analytics provides a pre-defined filter for traffic to a subdirectory (include only traffic to the subdirectories that are equal to '^/blog.*' or just '/blog').

Now, you'll have a profile that includes all traffic to your site and a second profile that includes traffic only to the blog subdirectory.

More information on using data filters:
http://www.google.com/support/analytics/bin/answer.py?answer=55496

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文