For AI agents: a Markdown version of this page is at https://docs.snowplow.io/docs/sources/web-trackers/tracking-events/client-hints.md. The index of all documentation pages is at https://docs.snowplow.io/llms.txt, and the index for this section is at https://docs.snowplow.io/docs/cdi/llms.txt.
Track user agent client hints on web
Client hints include information about the user, network, or device. They're an alternative or supplement to tracking the user agent. They're available in most Chromium-based browsers.
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 user's privacy as can be the case with the user agent string.
Use the client hints plugin to capture hints information from navigator.userAgentData in an entity.
This entity can be configured in two ways:
clientHints: true: captures the "low entropy" client hintsisMobileandbrandsclientHints: { includeHighEntropy: true }: captures the "low entropy" hints as well as the "high entropy" hintsarchitecture,model,platform,platformVersion, anduaFullVersion
High entropy hints can potentially be used to fingerprint users, and so might not be suitable depending on your consent strategy. No additional configuration is needed to capture the high entropy hints here.
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 |
| Available on unpkg | unpkg |
Note: The links to the CDNs above are pinned to a specific version at the time of writing. Check the plugin's GitHub releases for newer versions, and update the pinned version when you upgrade.
// Basic
window.snowplow('addPlugin',
"https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-client-hints@4.10.2/dist/index.umd.min.js",
["snowplowClientHints", "ClientHintsPlugin"]
);
// High Entropy
window.snowplow('addPlugin',
"https://cdn.jsdelivr.net/npm/@snowplow/browser-plugin-client-hints@4.10.2/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) ],
});