Google Analytics(分析) - 升级到异步代码 [英] Google Analytics - Upgrading to Async Code

查看:111
本文介绍了Google Analytics(分析) - 升级到异步代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个旧网站,仍然使用古老的gatAnalytics(分析)跟踪代码(预异步);我们想将其升级到当前的gaq异步代码。

We have an older site which still uses the ancient "gat" Analytics tracking code (pre asynchronous); we would like to upgrade it to the current "gaq" asynchronous code.

如果任何人做同样的转换,一对夫妇的问题...

If anyone has done the same switch, a couple questions ...

1)切换,用户cookie会从旧代码继承下来吗?或者Analytics(分析)现在会忘记已访问我们网站的访问者,并考虑所有获得更新的异步代码段的用户全新访问者?

1) Once we make the switch, will the user cookies carry over from the old code? Or will Analytics now "forget" visitors that have already visited our site and consider everyone that gets the updated asynchronous code snippet a brand new visitor?

2)网站很复杂;我们可能需要搜索网站上包含旧跟踪代码的所有版块。当我们做这个代码清理,旧的gat代码和新的gaq代码是否兼容?这意味着他们会正确计算网页浏览量,不会丢失引荐来源网址信息,并且只计算一次访问,即使用户在访问期间点击了包含旧代码的网页和包含新代码的网页。

2) The site is pretty complex; we'll probably have to "hunt" for all the sections of the site that have the old tracking code on them. While we do this code cleanup, will the old "gat" code and the new "gaq" code be compatible? Meaning they'll both count pageviews properly, will not lose referrer info, and count just one visit even if the user hits both pages containing the old code and those containing the new code during their visit?

谢谢!仅供参考,以下是我们当前的(旧的)代码:

Thanks! And just for reference, here's our current (old) code:

<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 pageTracker = _gat._getTracker("UA-#######-#");
pageTracker._trackPageview();
} catch(err) {}</script>


推荐答案

如果您的实现与跟踪网页浏览一样简单, - 或者换句话说,如果您没有大量使用弃用的GA方法,自定义跟踪用户操作或浏览器功能或其他任何方式,那么这里是您的答案:

If your implementation is as simple as tracking the pageviews -- or another way, if you aren't heavily using deprecated GA methods, to do custom-tracking of user-actions, or browser-features or whatever else, then here are your answers:


  1. GA会记住访问者。

    这背后的原因很简单:您在网页上的代码不是GA用来跟踪people - 他们在 document.write(); 部分中调用的.js文件是用于跟踪人员和设置Cookie以及所有休息。

    他们已经更新了该文件数十次,没有你注意到,因为他们如何分离他们的逻辑(在该文件中),从你使用的跟踪界面(它保持不变所有的时间)。

  1. GA will remember the visitors.
    The reasoning behind this is simple: the code you have on the page isn't what GA uses to track people -- the .js file that they call in the document.write(); portion of the script is what they use to track people and set cookies and all of the rest.
    They have updated that file dozens of times, without you noticing, because of how they've separated their logic (in that file), from the tracking-interface that you use (which has stayed the same all that time).

在旧代码上有一些页面不会有任何问题(再次,只要你不做任何基于非常新的或非常旧的功能,比跟踪自定义变量更高级,跟踪购买和跟踪网页浏览),从页面到页面的高级跟踪)。

这里的一个规定是,您

这将导致同时触发和收集相同的数据,

There won't be any problems with having some pages on the old code (again, as long as you aren't doing any advanced tracking from page to page, based on very-new or very-old features that are more advanced than tracking custom variables, tracking purchases and tracking pageviews).
The one stipulation here is that you DO NOT LEAVE THEM BOTH ON THE SAME PAGE.
That would result in both firing, and both collecting the same data, and you'd basically be doubling your metrics.

这篇关于Google Analytics(分析) - 升级到异步代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆