开发者

how does google analytics generate a unique id?

is it done through javascript? or is it making a request somewhere with some info and ga sends back a r开发者_如何学Cesponse that is saved in the cookie?


I'm not sure what you're asking, but an ID, Google Analytics or not, is generated on the server.

From a security perspective, the general rule of thumb about Client-Server applications is that you should never trust the user. Same in this case. Logically, it doesn't make sense to generate some ID and then bind with it on the server.


It must be done in the JavaScript because there's no additional request made for an ID between the ga.js request and the __utm.gif beacon being sent. It looks like a combination of a random number and the current date but I can't confirm if that's correct.

One thing I used in a tracking script before was to generate an ID on the server and inject it into the initial JavaScript but I don't see anything like that in ga.js. However, ga.js is quite hard to read so I could be missing something.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜