简体   繁体   中英

User agent switcher doesnt work properly

I use User agent switcher extension for cross browser testing in 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.

For example: I emulated safari 9.0 using user agent switcher. My actual browser from which i emulated is safari 5.0

I see a click event is fired in safari 9.0 when used a user agent switcher. But there are no end results in Google analytics for safari 9.0

Instead i there is nice tracking for safari 5.0 in google analytics. 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. 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. It works fine for User-Agent switching.

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)

It's probably because GA only checks your UA once. After that it can identify your browser by cookie

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

ga.js – cookie usage

The ga.js JavaScript library uses first-party cookies to:

  • 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). 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. It would be sufficient for them to record your browser and subsequent activities using a unique key linked to the cookie.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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