Track User-Agent Client Hints on web
User-Agent Client Hints are being rolled out across a number of browsers and are an alternative to the tracking the user-agent, which is particularly useful in those browsers which are freezing the user-agent string. See here for browser support.
This is useful data to capture as browsers are moving away from high entropy user-agent strings. Client Hints offer useful information to understand browser usage without the potential to infringe on a users privacy as is often the case with the user-agent string.
This entity can be configured in two ways:
clientHints: true: captures the "basic" client hintsisMobileandbrands.clientHints: { includeHighEntropy: true }: captures the "basic" client hints as well as hints that are deemed "High Entropy" and could be used to fingerprint users. Browsers may choose to prompt the user before making this data available.
The high entropy properties are architecture, model, platform, platformVersion, and uaFullVersion.
For the full schema details see the device and browser tracking overview page.
The Client Hints entity is automatically tracked once configured.
Install plugin
- JavaScript (tag)
- Browser (npm)
| Tracker Distribution | Included |
|---|---|
sp.js | ❌ |
sp.lite.js | ❌ |
Download:
| Download from GitHub Releases (Recommended) | Github Releases (plugins.umd.zip) |
| Available on jsDelivr | jsDelivr (latest) |
| Available on unpkg | unpkg (latest) |
Note: The links to the CDNs above point to the current latest version. You should pin to a specific version when integrating this plugin on your website if you are using a third party CDN in production.
// Basic
window.snowplow('addPlugin',
"https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-client-hints@latest/dist/index.umd.min.js",
["snowplowClientHints", "ClientHintsPlugin"]
);
// High Entropy
window.snowplow('addPlugin',
"https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-client-hints@latest/dist/index.umd.min.js",
["snowplowClientHints", "ClientHintsPlugin"],
{ includeHighEntropy: true }
);
npm install @snowplow/browser-plugin-client-hintsyarn add @snowplow/browser-plugin-client-hintspnpm add @snowplow/browser-plugin-client-hints
import { newTracker } from '@snowplow/browser-tracker';
import { ClientHintsPlugin } from '@snowplow/browser-plugin-client-hints';
// Basic
newTracker('sp1', '{{collector_url}}', {
appId: 'my-app-id',
plugins: [ ClientHintsPlugin() ],
});
// High Entropy
newTracker('sp1', '{{collector_url}}', {
appId: 'my-app-id',
plugins: [ ClientHintsPlugin(true) ],
});