Convert Google Analytics cookies to Local/Session Storage

前端 未结 3 1928
借酒劲吻你
借酒劲吻你 2020-12-04 17:25

UPDATE http://jsfiddle.net/musicisair/rsKtp/embedded/result/


Google Analytics sets 4 cookies that will be sent with all requests to that domai

3条回答
  •  悲&欢浪女
    2020-12-04 17:50

    Yes it can be done. You only have to request the __utm.gif with the parameters. The rest of the data is just used for keeping track of the source, session start time and/or previous visits.

    You can easily transfer the cookies both ways, so your first approach should work fine.

    If your second approach works... not sure. I don't know the ga.js code good enough to estimate wheter that would or would not be easily possible.

    There is also a third option, run your own version of ga.js. You are not required to use the Google version.

    Can it be done as described above? Yes

    Why hasn't it been done?

    1. the cookies are small, there isn't that much benefit if you use cookieless domains for all your static content
    2. it's less convenient since a lot of browsers don't support it yet

提交回复
热议问题