Google Analytics 并非从零诞生。它的前身是 1995 年成立的 Quantified Systems,后于 1999 年更名为 Urchin Software Corporation。2005 年,Google 收购 Urchin,并于同年 11 月发布第一版 Google Analytics。此后,Google Analytics 经历了 urchin.js、ga.js、analytics.js、gtag.js 四个主要代码阶段,产品形态也从 Urchin 自托管分析工具,演进为 GA Classic、Universal Analytics 和 Google Analytics 4。
起源:Quantified Systems(1995—1999)
1995 年,Quantified Systems 成立于美国圣迭戈,最初提供网站开发与服务器托管服务。公司创始团队包括:Brett Scrosby、Scott Crosby、Paul Muret和ack Ancone。
当时Quantified Systems发现他们客户在处理自身网站数据的时间通常需要长达一天甚至更久,所以他们希望能够有一个分析功能能够在15分钟内处理完一天的数据,这也是Urchin出现的原因。
1997年,Paul Muret 开发出 Urchin 首个版本,并将其作为公司服务的一个卖点。此后,Urchin 逐渐成为公司主营业务。
1999年,公司正式更名为 Urchin Software Corporation。
Urchin 时期(1999—2005)
Urchin 是 Urchin Software Corporation 开发的网站分析工具。由于市场反响良好,公司逐步从网站开发和托管,转型为以 Urchin 为核心业务。
2003 年,Urchin 发布 Urchin Tracking Module,即后来广为人知的 UTM。UTM 参数至今仍是数字营销中标记广告系列、来源和媒介的重要方式。
2005 年,Google 收购 Urchin Software Corporation,Urchin 一度以 “Urchin from Google” 的名义存在,随后演变为 Google Analytics。
早期的Urchin的界面如下:
Urchin 2.0:
Urchin 3.0:
Urchin 5.0:
2008年,谷歌发布Urchin 6.0,默认的会话时长设置是30分钟,Urchin 6.0:
2009年2月,谷歌发布了Urchin 6.5,增加了与Adwords的集成。
2010年9月,谷歌发布Urchin 7,支持64位,之所有会有64位版本,是因为Urchin是私有化布署的,布署到自己服务器的,价格在1万美元左右。
2012年3月28日,Urchin产品被停止。
在前两年,我看到仍有国内的网站布署有Urchin。
GA1:Urchin Analytics Code(2005—2007)
2005 年 4 月,Google 完成对 Urchin Software Corp 的收购。
2005 年 11 月,Google 基于 Urchin 发布第一版 Google Analytics。这一版加载的js仍然是使用urchin.js,这时期的跟踪代码是这样的:
<!— Sample Urchin Analytics Code -> <script src=”https://www.google-analytics.com/urchin.js” type=”text/javascript”></script> <script type=”text/javascript”> _uacct = “UA-XXXXXXX-X”; _userv = 2; urchinTracker(); </script> <— Sample Urchin Analytics –>
这一阶段的跟踪代码仍使用 urchin.js。免费版 Google Analytics 虽然有一定限额,但已能满足大部分需求,因此极受欢迎。发布后一周内注册用户超过 10 万,数据量达到 Google 预期的四倍,服务器压力过大,Google 不得不暂停注册,改为邀请制。
2006 年 8 月,Google Analytics 停止邀请注册,重新向所有用户开放。
GA2:Google Analytics Classic(2007—2012)
这一阶段的核心代码是 ga.js,并分为同步加载和异步加载两个时期。
Google Analytics Synchronous Code(同步加载)
2007 年 4 月,Google 发布同步加载代码,使用 ga.js 和 PageTracker 跟踪器,这一时期的跟踪代码是这样:
<—Sample GA Synchronous Code –>
<script type="”text/javascript”">
var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “https://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-xxxxxx-x”);
pageTracker._trackPageview();
} catch(err) {}
</script>
- 2007年5月,新版Reporting Interface
- 2008年10月,增加Custom Reports 和 Advanced Segments
- 2009年4月,增加APIs
- 2009年6月,增加Event Tracking
- 2009年11月, 增加Custom Alerts
Google Analytics Asynchronous Code(异步加载)
2009 年 12 月,Google 发布异步加载代码,用于取代同步加载对页面的限制。其关键特征是 _gaq.push 和 ga.js,这本版本个的跟踪代码如下:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXXXX-X’]);
_gaq.push([‘_trackPageview’]); (function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘https://www’) +
‘.google-analytics.com/ga.js’; var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);})();
</script>
- 2011年8月,增加MCF
- 2011年9月,增加Google Analytics Premium和Real-Time Reports
- 2011年10月,增加Flow Visualisations
- 2012年7月,增加Content Experiment和GA for mobile applications.
- 2012年9月,增加Display Advertising Code和Enhanced Link Attribution
- 2012年10月,增加Data Import和Google Tag Manager(GTM)
GA3:Universal Analytics(2012—2023/2024)
2012 年 10 月,Google 发布 Universal Analytics,使用 analytics.js。这一版本增加了跨站跟踪、Custom Dimensions 和 Custom Metrics 等能力,这一时期的跟踪代码是这样:
<!-- Google Analytics --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXX-Y', 'auto'); ga('send', 'pageview'); </script> <!-- End Google Analytics -->
- 2013年3月,增加Measurement Protocol
- 2013年6月,增加Attribution Models
- 2013年9月,谷歌的搜索由于http升级到加密的https,Google Analytics中不再获得自然搜索关键字,变成了“(not provided)” 。
- 2014年5月,增加Enhanced Ecommerce
- 2016年3月,谷歌发布Google Analytics 360, 给企业提供一站式的数字营销解决方案,Google Analytics 360包含Analytics, Tag Manager, Optimize, Data Studio, Surveys, Attribution和 Audience Center.
- 2016年9月,谷歌发布Google Analytics Solutions,包含Google Analytics, Google Tag Manager, Google Optimize, Google Data Studio, Google Survey, Google Attribution, 和 Google Audience Center.
GA4:Google Analytics 4(2017/2020—至今)
GA4 的推出背景,一方面是欧盟在数据传输和用户隐私方面对 GA 施加了更大监管压力;另一方面,苹果 ITP 等规则对现有数据跟踪和广告归因造成巨大影响。Google 需要一个新版本满足隐私合规与跨平台衡量需求。
过渡阶段:Global Site Tag
2017 年,Google 发布 Global Site Tag,让 AdWords、DoubleClick 和 Google Analytics 使用同一套写法。此后,GA的代码逐渐转向 gtag.js,这一时期的跟踪代码如下:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-69988360-20');
</script>
- 2018年6月,谷歌发布Google Marketing Platform,它包含谷歌的两大产品:DoubleClick Digital Marketing 和Google Analytics 360。
- 2018年8月,谷歌发布Google Signals
- 2019年8月,谷歌发布 APP+Web Property用于取代Google Analytics For APP,将APP和Web的数据汇总到同一个媒体资源,一起跟踪,这个版本的报告页面做了很大的升级,跟踪代码也不一样:
<!-- Global site tag (gtag.js) - Google Analytics --><script src="https://www.googletagmanager.com/gtag/js?id=G-XJGBFSLMD8" async=""></script><script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XJGBFSLMD8');
</script>
需要注意,这里的跟踪代码用的是测量ID,结构是G-***,这是混合版的跟踪代码特征。
- 2019年10月,Attribution Module做升级,进入测试阶段。
- 2019年12月,增加电商功能。
GA4 正式发布
- 2020年10月,APP+Web改名为Google Analytics 4正式发布
- 2021年8月,内部推出GA4付费版,采用固定价格和阶梯定价的方式,更灵活
- 2021年9月:服务端跟踪(Server-Side Tagging)从测试版转为全面可用
- 2022年4月,GA4 360 版本定价公布,5 万美元起
- 2022年11月,公布GA4 API限额,影响API和Looker Studio,引导用户去使用BigQuery
- 2023年7月,所有免费版Universal Analytics 媒体资源都将停止处理新匹配
- 2024年7月,所有付费版Universal Analytics 媒体资源都将停止处理新匹配
- 2024年7月,推出第一方模式(First-Party Mode,简称 FPM)
- 2025年5月,First-Party Mode更名为Google Tag Gateway(Google代码网关)
- 2026年5月,Google Tag Manager和Google Tag合并
版本与代码对照表
| 阶段 | 代表代码 | 时间 | 关键特征 |
|---|---|---|---|
| GA1 | urchin.js | 2005—2007 | 基于 Urchin,首版 Google Analytics |
| GA2 同步 | ga.js + PageTracker | 2007—2009 | 同步加载 |
| GA2 异步 | ga.js + _gaq.push | 2009—2012 | 异步加载,功能快速扩展 |
| GA3 | analytics.js | 2012—2023/2024 | Universal Analytics,跨站跟踪、自定义维度与指标 |
| GA4 过渡 | gtag.js,UA- | 2017—2020 | Global Site Tag,统一 Google 产品代码 |
| GA4 | gtag.js,G- | 2020—至今 | 跨平台、事件驱动、隐私合规 |









