【问题标题】:Google Analytics and the __utm.gif fileGoogle Analytics 和 __utm.gif 文件
【发布时间】:2010-11-16 16:17:15
【问题描述】:

在使用 Google Analytics 和使用较新的 ga.js 文件时,您的网站根目录中是否需要 __utm.gif 文件?

我确实看到我的浏览器正在调用 google-analytics.com (http://www.google-analytics.com/__utm.gif?...) 上的文件,但过去我被告知它需要存在于网站的根目录中。

这仍然成立吗?

能否提供参考?

【问题讨论】:

  • 更新:如果您还通过 Google Analytics 使用 Urchin 跟踪,则必须修改页面底部的脚本以包含对“pageTracker._setLocalRemoteServerMode()”的调用,这样做需要您将 __utm.gif 文件放在 Web 应用程序的根目录中。脚本现在看起来像这样: 参考:google.com/support/urchin45/bin/answer.py?answer=28710

标签: google-analytics


【解决方案1】:

如果您使用的是新版本的跟踪代码 (ga.js),那么您唯一需要做的事情就是include this snippet of JavaScript

<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">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
</script>

这意味着您不需要在服务器上托管任何 __utm.gif 文件(我不确定这对分析是否有效,因为重点是客户端的浏览器发出请求 Google 的服务器)。

【讨论】:

  • 对。 GA 的工作方式是通过对来自 Google 服务器的 1x1 图像的特制请求。 Google 使用该 url 获取有关当前跟踪事件的数据。
【解决方案2】:

我使用较旧的 urchin.js 跟踪机制,虽然您可以将 .js 文件放在服务器上以提高速度,但不需要在本地托管任何内容。有四张图像被要求提供跟踪; __utma__utmb__utmc__utmz 对应于它们记录的同名 cookie。

来自谷歌; When you first begin implementing tracking in Google Analytics website, you need to install the tracking code on your website pages. The generic tracking code snippet consists of two parts: a script tag that references the ga.js tracking code, and another script that executes the tracking code.

【讨论】:

    【解决方案3】:

    如果您还将 Google 分析数据的副本发送到本地网络服务器,则需要将 _utm.gif 添加到您的服务器根目录。它使您可以选择更长时间地保留数据,因为 Google 只保留 25 个月的免费帐户数据。 Google 也不共享原始数据,获取原始数据的唯一方法是将其发送到您的本地网络服务器日志。要使其正常工作,您需要将以下这一行添加到跟踪代码中:

    _gaq.push(['_setLocalRemoteServerMode']);

    更详细的讨论,请参考 Clifton, Brian (2012-03-30) 的书。使用谷歌分析的高级网络指标(Kindle 位置 4459-4460)。约翰威利父子。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-20
      • 1970-01-01
      • 1970-01-01
      • 2018-10-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多