Repository navigation
fix(analytics): detect browser for Chromium-based browsers - #2648
creeperkatze wants to merge 6 commits into
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Browser metadata now uses Bowser, and additional Chromium browsers map to Security Architecture Review
🚥 Pre-merge checks | ✅ 4 | ❌ 1
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
I've been trying to reproduce this I think button in It looks interesting, but i need to test it manually before any approval. And resolve conflict with Thanks |
|
Thanks! I pushed the branch
Before, |
|
Also resolved the |
| chrome: 'chrome', | ||
| edge: 'edge', | ||
| firefox: 'firefox', | ||
| chromium: 'other_chromium', | ||
| brave: 'other_chromium', | ||
| opera: 'other_chromium', | ||
| vivaldi: 'other_chromium', | ||
| yandex: 'other_chromium', | ||
| naver: 'other_chromium', | ||
| }; |
There was a problem hiding this comment.
@creeperkatze Thanks a lot, now i see difference.
But there's unknown for safari, because it isn't listed there.
Another problem is all browsers below chromium is other_chromium, IMO this should be named 'opera': 'opera' and etc.
But i've been wondering if it's possible and good solution to use Bowser.BROWSER_MAP there, instead of our BROWSER_MAP, what do you think?
There was a problem hiding this comment.
Glad you could reproduce it!
I kept Moderok's values in line with their own SDK, which only sends chrome, edge, firefox, other_chromium and unknown (Safari and others end up as unknown). Not sure if their API accepts more than that, if it does, happy to pass the browser through directly.
There was a problem hiding this comment.
As for Bowser.BROWSER_MAP, it just maps Bowser's IDs to display names (e.g. edge becomes "Microsoft Edge"). Moderok still needs its own values.
Overview
The
browseruser property was always empty for Chromium-based browsers when built, sinceua-parser-jscouldn't read the user agent in MV3 service workers. It also couldn't tell browsers like Brave apart from Chrome.This PR replaces it with bowser, which also reads client hints.
browsernow reports IDs likechrome,edge,braveandfirefox.Also:
optimizeDeps.includeentry forua-parser-js.ua-parser-jsfrom the excluded packages inupgrade-deps.ts.other_chromiuminstead ofunknown.Manual Testing
bun run dev:buildinpackages/analyticsand load.output/chrome-mv3in Chrome and Edge.trackevent should showuser.properties.browseraschrome/edge. Before this change it wasundefined.