友盟Web端统计服务源码分析

本文详细分析了友盟在Web端的实施使用、工作原理和相关源码,包括跟踪代码的嵌入、数据发送过程以及如何实现用户行为统计。通过对源码的深入研究,揭示了友盟如何收集并处理用户数据,如_pageview、_event等事件,以及设置和删除自定义变量。此外,还介绍了友盟如何通过heatmap.gif进行热图分析。
摘要由CSDN通过智能技术生成

友盟是阿里巴巴旗下的一个用户行为统计工具,官方网址为 https://www.umeng.com/

该文章主要描述友盟工具在web端()的实施使用,工作原理,相关源码分析,以及功能分析.

实施使用

1.在友盟中的域名列表中配置好要统计的域名

  1. 在自己网站的HTML页面中嵌入以下友盟提供的跟踪代码:

工作原理

跟踪代码请求 JS文件 http://s4.cnzz.com/z_stat.php?id=1278216955 (源码分析区域有完整的代码)

该JS文件为友盟主要文件里面透出 push 方法:

e = window
p() { this.c = “1278216955”; this.ca = “z”; this.Y = “”; this.V = “”; this.X = “”; this.D = “1574231684”; this.$ = “z3.cnzz.com”; this.W = “”;

this.H = “CNZZDATA” + this.c; this.G = “CNZZDbridge” + this.c; this.O = “_cnzz_CV” + this.c; this.P = “CZ_UUID” + this.c;

this.K = “UM_distinctid”; this.A = “0”; this.J = {}; this.a = {}; this.Ca() }

Ca: function () { try { this.ma(), this.ja(), this.ha(), this.U(), this.ya(), this.S(), this.Ba(), this.w(), this.wa(), this.va(), this.za(), this.o(), this.ua(),

this.xa(), this.Aa(), this.sa(), this.qa(), this.ta(), this.Ga(), e[this.G] = e[this.G] || {}, this.ra("_cnzz_CV") } catch (a) { h(a, “i failed”) } },

Ga: function () { try { if (“undefined” === typeof e._cz_account || e._cz_account === this.c) { e._cz_account = this.c;

if ("[object Array]" === {}.toString.call(e._czc)) for (var a = e._czc, b = 0, c = a.length; b < c; b++)this.L(a[b]); this.Ea() } } catch (d) { h(d, “pP failed”) } },

Ea: function () { try { var a = this; e._czc = { push: function () { return a.L.apply(a, arguments) } } } catch (b) { h(b, “oP failed”) } },

L 方法中包含循环识别如下方法:
_trackPageview

       case  "_trackPageview":  if  (a[1])  {
                  this.a.f  =  q  +  "//"  +  e.location.host;  "/"  !==  a[1].charAt(0)  &&  (this.a.f  +=  "/");  this.a.f  +=  a[1];  
                  if  (""  ===  a[2])  this.a.g = ""; 
                  else if (a[2]) {
            var b = a[2]; "http" !==
              b.substr(0, 4) && (b = q + "//" + e.location.host, "/" !== a[2].charAt(0) && (b &#
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值