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

Parse UA on the server-side #28

Open
omBratteng opened this issue Nov 27, 2020 · 7 comments
Open

Parse UA on the server-side #28

omBratteng opened this issue Nov 27, 2020 · 7 comments

Comments

@omBratteng
Copy link

Why is the parsing of the UA done on the client side, and not the server side?
You could potentially save 15kB (~8kB gzip). It's not much, but it can be done server side.

@electerious
Copy link
Owner

electerious commented Nov 28, 2020

The main reason was that Ackee shouldn't process the user agent / shouldn't even receive the user agent when detailed tracking is disabled. This however doesn't make sense, because browsers send the UA anyway.

The seconds reason was that detailed also includes data that isn't part of the UA. This would mean that we need an API that parses the UA + accepts some additional data. That could work, but we would need to make sure that the UA is only parsed on the server when the detailed mode is enabled (for privacy reasons). That's also why the detailed option is part of ackee-tracker and not of Ackee, because the server should never see the detailed data when it doesn't have to.

It could work if we find a good API declaration for it, but it's also not as clean & simple as it is right now.

@electerious
Copy link
Owner

electerious commented Nov 28, 2020

I would like to keep the current API unchanged. It's good for apps where a UA isn't a thing. The UA could be an optional GraphQL query parameter that get's parsed when available.

Data + UA = Parses UA. Fields specified in the data will overwrite fields parsed from the UA. In the case it's like a fallback, but it would allow us to remove the platform library from ackee-tracker.
Data only = Just like it is now.

@omBratteng
Copy link
Author

The main reason was that Ackee shouldn't process the user agent / shouldn't even receive the user agent when detailed tracking is disabled. This however doesn't make sense, because browsers send the UA anyway.

Yeah, most internet capable device sends a User-Agent string to the server on each request. I also understand that Ackee shouldn't process the data, unless the user has given their permission.
My issue is that platform.js is a few kB of unnecessary data, because it has to detect all quirks with different UAs.

@electerious electerious changed the title Question: Why not parse UA on the server-side Parse UA on the server-side Jan 23, 2021
@electerious
Copy link
Owner

The feature didn't made it into v3, but it's something I'm planning for a future release.

@thecodrr
Copy link
Contributor

What if the platform.js library is loaded on demand externally instead?

If a developer turns on detailed mode ackee-tracker can download and load platform.js. This would require little to no change in the tracker and we can shave off a couple of KBs in the process (for non-detailed mode at least).

@omBratteng
Copy link
Author

@thecodrr that would increase load time, as another js file has to be downloaded and parsed

@electerious
Copy link
Owner

electerious commented Feb 14, 2021

My plan is to add an optional userAgent parameter to the createRecord mutation.

Data + UA = Parses UA. Fields specified in the data will overwrite fields parsed from the UA. In the case it's like a fallback, but it would allow us to remove the platform library from ackee-tracker.
Data only = Just like it is now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants