Getting Android Platform Info
Google has started reducing the amount of information available in the userAgent
string. The first impact of this is the loss of Android device, platform, and version information. If your application has a lot of variability here, it might be important for you to continue to have this data.
To make this information available, you need to allow it with some additional HTTP Headers from your hosting platform. Then, you’ll need to get the new client-hints and patch them onto the userAgent string.
Add User-Agent Client Hint Headers
You’ll need to serve your pages with the Accept-CH
header to allow the Platform version to be exposed:
Retrofill the navigator.userAgent string
The TrackJS agent has not switch to the new Client Hints API yet, so you need to polyfill the navigator.userAgent
string. We recommend doing this with the UACH Retrofill Library from Google.
Once included, call overrideUserAgentUsingClientHints(["uaFullVersion"]);
as early as possible in your code. Here is a more-complete example: