简体   繁体   English

用户代理切换器无法正常工作

[英]User agent switcher doesnt work properly

I use User agent switcher extension for cross browser testing in google analytics. 我使用用户代理切换器扩展程序在Google Analytics(分析)中进行跨浏览器测试。

I am quite surprised to say that tracking test results are not in sync with my results i see in Google Analytics panel. 我很惊讶地说跟踪测试结果与我在Google Analytics(分析)面板中看到的结果不同步。

For example: I emulated safari 9.0 using user agent switcher. 例如:我使用用户代理切换器模拟了safari 9.0。 My actual browser from which i emulated is safari 5.0 我从中模拟的实际浏览器是Safari 5.0

I see a click event is fired in safari 9.0 when used a user agent switcher. 使用用户代理切换器时,我在safari 9.0中触发了click事件。 But there are no end results in Google analytics for safari 9.0 但是Safari 9.0的Google Analytics(分析)没有最终结果

Instead i there is nice tracking for safari 5.0 in google analytics. 相反,我在Google Analytics(分析)中对safari 5.0进行了很好的跟踪。 From which i want to say the User agent switcher is not working as expected. 我想从中说出用户代理切换器未按预期工作。

Can you suggest me an alternative to user agent switcher for my cross browser testing please? 您能否为我的跨浏览器测试建议用户代理切换器的替代方法?

PS: I tried my best to research the issue before posting. PS:在发布之前,我已尽力研究此问题。 I didnt find any answers helpful for my scenario. 我没有找到对我的情况有用的答案。 Please dont say its duplicated. 请不要说它是重复的。 I am actively looking to solve my issue as it quite a priority issue to me. 我正在积极寻求解决我的问题的方法,因为这对我来说是一个非常重要的问题。

I use this one https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj which permits you to edit the request headers. 我使用了一个https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj ,它允许您编辑请求标头。 It works fine for User-Agent switching. 它适用于User-Agent切换。

You can have a look to developer tools under "Network" tab to see if the switching was effective 您可以在“网络”标签下查看开发人员工具,以查看切换是否有效

Hope it helps 希望能帮助到你

(fun fact: I'm on Chrome and when I'm switching my user agent, Google asks me to download Chrome) (有趣的事实:我使用的是Chrome,当我切换用户代理时,Google要求我下载Chrome)

It's probably because GA only checks your UA once. 这可能是因为GA仅检查您的UA一次。 After that it can identify your browser by cookie 之后,它可以通过Cookie识别您的浏览器

https://developers.google.com/analytics/devguides/collection/analyticsjs/cookie-usage https://developers.google.com/analytics/devguides/collection/analyticsjs/cookie-usage

ga.js – cookie usage ga.js – Cookie的用法

The ga.js JavaScript library uses first-party cookies to: ga.js JavaScript库使用第一方Cookie来执行以下操作:

  • Determine which domain to measure 确定要衡量的领域
  • Distinguish unique users 区分唯一用户
  • Throttle the request rate 节流请求率
  • Remember the number and time of previous visits 记住上一次访问的次数和时间
  • Remember traffic source information 记住流量来源信息
  • Determine the start and end of a session 确定会话的开始和结束
  • Remember the value of visitor-level custom variables 记住访问者级自定义变量的值

The line I highlighted suggests that since the cookie already identifies your unique browser it doesn't need to collect that information again for as long as the cookie exists (which is up to 2 years). 我强调的这一行表明,由于cookie已经可以识别您的唯一浏览器,因此只要cookie存在(最长2年),就不需要再次收集该信息。 It probably checks more often than that to identify browser updates. 它可能比检查频率更高,以识别浏览器更新。

I can't be certain of this answer without analysing the GA scripts but it makes sense since it's far more efficient for Google to store your browser profile in their database once and then only update it periodically rather than on every request. 如果不分析GA脚本,就无法确定这个答案,但这很有道理,因为Google将您的浏览器配置文件存储在其数据库中一次更有效,然后仅定期更新它,而不是根据每个请求进行更新。 It would be sufficient for them to record your browser and subsequent activities using a unique key linked to the cookie. 他们只需使用链接到Cookie的唯一键来记录您的浏览器和后续活动就足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM