Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update detect-browser method for Browser Meta Data in Client Logs #71

Open
poorejc opened this issue Mar 24, 2021 · 6 comments
Open

Update detect-browser method for Browser Meta Data in Client Logs #71

poorejc opened this issue Mar 24, 2021 · 6 comments
Labels
enhancement maintenance package updates and the like

Comments

@poorejc
Copy link
Contributor

poorejc commented Mar 24, 2021

current method is 'detect-browser'. Adds run-time dependencies (overhead).

explore more modern fingerprinting methods as alternative:

example of such a library:
fingerprintjs

@poorejc poorejc added enhancement maintenance package updates and the like labels Mar 24, 2021
@UncleGedd
Copy link
Contributor

The detect-browser library currently sits at 25 kb, while fingerprintjs is 256 kb. Is the goal of this ticket to swap detect-browser with something more modern or to roll our own browser detection to remove our one and only runtime dependency?

@confusingstraw
Copy link
Contributor

i think they offer two different things. detect-browser tells us which browser we're running in (mostly via a set of User-Agent regexs), fingerprintjs tries to identify the individual computer that is running the page. it does this by gathering a bunch of runtime info about the browser (which APIs/hardware are available, how do they look, etc.) and generating a fingerprint.

my suggestion before was that we could probably just do our own detect-browser work, and remain dependency-free. the fingerprintjs mention was a bit tangential, as user identification has been of interest to the project before.

@UncleGedd
Copy link
Contributor

Trying a couple of things here:

  1. Using a duck-typing feature detection method to detect the browser (see this SO post). This is fancy and all but it's not accurate on my version of Chrome 90

  2. Basically replicating what detect-browser is doing by looking at the user agent

@Jyyjy
Copy link
Contributor

Jyyjy commented Feb 19, 2024

Anyone opposed to replacing detect-browser with logging the raw user agent?

  1. Most user agent strings are pretty human readable.
  2. There are no edge cases of unconventional user agent strings that may be parsed incorrectly.
  3. Eliminates a dependencies.
  4. There's more info in a user agent string than just browser and version.

@UncleGedd
Copy link
Contributor

Hey @Jyyjy that sounds fine and good. If you didn't want to introduce a breaking change (ie. removing detect-browser) we could create an option (something like rawUserAgent) that could be set in userale.options()

@Jyyjy
Copy link
Contributor

Jyyjy commented Feb 23, 2024

Hey @Jyyjy that sounds fine and good. If you didn't want to introduce a breaking change (ie. removing detect-browser) we could create an option (something like rawUserAgent) that could be set in userale.options()

How about adding the user-agent field to the logs, and marking the detect-browser field as deprecated? Assuming that's what we want in a future release.

If it's important to have the option for a parsed browser field, then I think ua-parser-js is better than detect-browser because it parses all user agent fields.

Also, shouldn't detect-browser as it is now be a dependency, not a devDependency? It's required for the package to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement maintenance package updates and the like
Projects
None yet
Development

No branches or pull requests

4 participants