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

Logged incorrect android version #46

Open
BelkinVadim opened this issue Jul 25, 2024 · 2 comments
Open

Logged incorrect android version #46

BelkinVadim opened this issue Jul 25, 2024 · 2 comments

Comments

@BelkinVadim
Copy link

I recently noticed that the wrong Android versions are being registered for Chrome users. As far as I understand, this is the problem https://developers.google.com/privacy-sandbox/blog/user-agent-reduction-android-model-and-version. Tell me how this can be fixed?

@toddhgardner
Copy link
Member

Hey @BelkinVadim , Thanks for pointing this out! We'll look into this and let you know.

@toddhgardner
Copy link
Member

Hey @BelkinVadim,

It looks like there are a few things that need to happen to fix this issue. First, you need to add the Sec-CH-UA headers when serving your website that allow these values to be read. I believe they need to be:

Accept-CH: Sec-CH-UA-Mobile, Sec-CH-UA-Platform, Sec-CH-UA, Sec-CH-UA-Model

Additionally, if you reference our agent from cdn.trackjs.com you'll need to add the appropriate Permissions-Policy header as well. However, I'd recommend you bundle our agent with your code via npm instead.

Once you've done that, we should be able to get access to the data with the new APIs. However, we're probably not going to implement this just yet as it's pretty likely to change or be abandoned in our opinion. So in the interim, we recommend you use the UA CH retrofill package to your app and calling overrideUserAgentUsingClientHints in your code. This will force the correct userAgent string to be written.

Here's an example:

import { TrackJS } from 'trackjs';
import { overrideUserAgentUsingClientHints } from './uach-retrofill.js';

overrideUserAgentUsingClientHints(["uaFullVersion"]);

TrackJS.install({...});

Note that this will only work if you give the page the correct permissions with the headers above.

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

2 participants