Posts Tagged ‘ Google Analytics

google analytics 的cookie值 utmz 的生命周期分析

google analytics 使用 utma utmb utmc utmz 来做分析,其中 utmz记录了访问的来源 对于市场分析来说非常重要,

有的时候 会出现这个问题 从a网站来的顾客 来到网站 没有买任何东西就走了  后来通过b网站来下单 最后从下单的情况来看 到底是a网站 来的流量还是b (其实对于referral网站 类型 都是以第一次的为准)

有的时候还会碰到这个问题 从百度搜索一个关键词 ,没有没任何东西,又从google搜索一个关键词,买了东西 最后算那个词的转换(其实对于搜索引擎来说是最后一次)

还会碰到更复杂的问题

来一个顾客 从百度搜索一个词 来了网站 没买东西, 然后去别的网站逛 看到别的网站上挂的广告,于是点击这个banner广告来购买了 最后问是在google analytics里 是算那个流量来源的转换  (其实是算搜索的转换)

以上都是经过我多次测试的结果

附上试验表格

结论就是

在金字塔上面的来源的cookie值 ,越能覆盖下来的

文字描述就是 直接来源和推荐来源是算老的, 搜索的是看新的

Google Analytics 原理与实例分析[zt]

最近在做Web统计相关的工作,在查资料的同时,顺手找到了GA的原理分析:)

# 发统计包

GET http://www.google-analytics.com/__utm.gif?utmwv=1&utmn=1261523910&utmcs=gb2312&utmsr=1400×1050&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=-&utmhn=www.mydll.com&utmr=-&utmp=/gg.htm&utmac=UA-2789145-1&utmcc=__utma%3D251296922.1430927915.1192194210.1192194210.1192194210.1%3B%2B__utmb%3D251296922%3B%2B__utmc%3D251296922%3B%2B__utmz%3D251296922.1192194210.1.1.utmccn%3D(direct)%7Cutmcsr%3D(direct)%7Cutmcmd%3D(none)%3B%2B HTTP/1.1
Accept: */*
Referer: http://www.mydll.com/gg.htm
Accept-Language: zh-cn
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Connection: Keep-Alive
Host: www.google-analytics.com
Pragma: no-cache

HTTP/1.1 200 OK
Pragma: no-cache
Cache-Control: private, no-cache, no-cache=”Set-Cookie”, proxy-revalidate
Expires: Fri, 04 Aug 1978 12:00:00 GMT
Content-Type: image/gif
Server: ucfe
Content-Length: 35
Date: Fri, 12 Oct 2007 13:04:04 GMT
Via: 1.1 HttpSpy

# 发出统计的请求详细分析

http://www.google-analytics.com/__utm.gif?

utmwv=1& # 常量 1
utmn=1261523910& # Math.round(Math.random()*2147483647);
utmcs=gb2312& # charset
utmsr=1400×1050& # screen
utmsc=32-bit& # screen.colorDepth
utmul=en-us& # navigator.language.toLowerCase();
utmje=1& # navigator.javaEnabled() ? 1 : 0;
utmfl=-& # _uFlash
utmhn=www.mydll.com& # JsUrlEncode(location.hostname)
utmr=-& # document.referrer
utmp=/gg.htm& # location.pathname+location.search; 或者优先是 用户输入的 page 页面
utmac=UA-2789145-1& # 站点ID,用户输入的 _uacct = “UA-2789145-1″;
utmcc=__utma%3D251296922.1430927915.1192194210.1192194210.1192194210.1%3B%2B__utmb%3D251296922%3B%2B__utmc%3D251296922%3B%2B__utmz%3D251296922.1192194210.1.1.utmccn%3D(direct)%7Cutmcsr%3D(direct)%7Cutmcmd%3D(none)%3B%2B
utmcc=__utma=251296922.1430927915.1192194210.1192194210.1192194210.1;+__utmb=251296922;+__utmc=251296922;+__utmz=251296922.1192194210.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none);+
utmcc=
__utma=251296922.1430927915.1192194210.1192194210.1192194210.1;+
__utmb=251296922;+
__utmc=251296922;+
__utmz=251296922.1192194210.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none);+
其中的 251296922 是根据当前页面的根域名计算出来的 HASH 值,例如本次请求是用 mydll.com 计算出来的值 251296922
__utma 的第二个数值 1430927915 是随机数字,用函数 Math.round(Math.random()*2147483647) 生成出来的
__utma 的第三、四、五个数值 1192194210 是随机数字,是用函数 _ust=Math.round((new Date()).getTime()/1000); 计算出来的
__utma 的第六个数值 1 是固定的常量
__utmz 的第一个数是域名的 HASH 值
__utmz 的第二个数值 1192194210 是随机数字,是用函数 _ust=Math.round((new Date()).getTime()/1000); 计算出来的
__utmz 的第三个数值 1 其实就是 __utma 的第六个固定常量
__utmz 的第四个数值 1 在第一次请求的时候是 1,我们就暂时不考虑第二次的请求
__utmz 的最后一个参数 utmccn=(direct)|utmcsr=(direct)|utmcmd=(none) 是表示来源等信息,默认就是这个

当链接是从其他网站点入时,其 __utmz 参数如下:
__utmz=251296922.1192220231.1.1.utmccn=(referral)|utmcsr=yx8.com|utmcct=/temp/togg.html|utmcmd=referral;+
utmccn – 的值表示有来源
utmcsr – 表示来源的跟域名
utmcct – 表示来源页面的 PATH
utmcmd – 表示一个命令好像,这里设置了 referral,可能是为了配合签名的

# 外部链接导入包

GET http://www.google-analytics.com/__utm.gif?utmwv=1&utmn=1389663121&utmcs=gb2312&utmsr=1400×1050&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=-&utmcn=1&utmhn=www.mydll.com&utmr=http://www.yx8.com/temp/togg.html&utmp=/gg.htm&utmac=UA-2789145-1&utmcc=__utma%3D251296922.1389663121.1192220231.1192220231.1192220231.1%3B%2B__utmb%3D251296922%3B%2B__utmc%3D251296922%3B%2B__utmz%3D251296922.1192220231.1.1.utmccn%3D(referral)%7Cutmcsr%3Dyx8.com%7Cutmcct%3D%2Ftemp%2Ftogg.html%7Cutmcmd%3Dreferral%3B%2B HTTP/1.1
Accept: */*
Referer: http://www.mydll.com/gg.htm
Accept-Language: zh-cn
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Connection: Keep-Alive
Host: www.google-analytics.com

HTTP/1.1 200 OK
Pragma: no-cache
Cache-Control: private, no-cache, no-cache=”Set-Cookie”, proxy-revalidate
Expires: Fri, 04 Aug 1978 12:00:00 GMT
Content-Type: image/gif
Server: ucfe
Content-Length: 35
Date: Fri, 12 Oct 2007 20:17:14 GMT
Via: 1.1 HttpSpy

# 参数分析

http://www.google-analytics.com/__utm.gif?

utmwv=1&
utmn=1389663121&
utmcs=gb2312&
utmsr=1400×1050&
utmsc=32-bit&
utmul=en-us&
utmje=1&
utmfl=-&
utmcn=1&
utmhn=www.mydll.com&
utmr=http://www.yx8.com/temp/togg.html&
utmp=/gg.htm&
utmac=UA-2789145-1&
utmcc=__utma%3D251296922.1389663121.1192220231.1192220231.1192220231.1%3B%2B__utmb%3D251296922%3B%2B__utmc%3D251296922%3B%2B__utmz%3D251296922.1192220231.1.1.utmccn%3D(referral)%7Cutmcsr%3Dyx8.com%7Cutmcct%3D%2Ftemp%2Ftogg.html%7Cutmcmd%3Dreferral%3B%2B
utmcc=__utma=251296922.1389663121.1192220231.1192220231.1192220231.1;+__utmb=251296922;+__utmc=251296922;+__utmz=251296922.1192220231.1.1.utmccn=(referral)|utmcsr=yx8.com|utmcct=/temp/togg.html|utmcmd=referral;+
utmcc=
__utma=251296922.1389663121.1192220231.1192220231.1192220231.1;+
__utmb=251296922;+
__utmc=251296922;+
__utmz=251296922.1192220231.1.1.utmccn=(referral)|utmcsr=yx8.com|utmcct=/temp/togg.html|utmcmd=referral;+

# 再次刷新页面时发现 Cookie 已经设置上

GET http://www.mydll.com/51la.htm HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*
Accept-Language: zh-cn
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: www.mydll.com
Connection: Keep-Alive
Cookie: __utma=251296922.1389663121.1192220231.1192220231.1192220231.1; __utmb=251296922; __utmc=251296922; __utmz=251296922.1192220231.1.1.utmccn=(referral)|utmcsr=yx8.com|utmcct=/temp/togg.html|utmcmd=referral