Closed nielsbasjes closed 1 year ago
Thanks @nielsbasjes! At first I assumed this meant just bump the library to 7.x and do nothing else. But I see now there is an opportunity for snowplow to do something bigger and better than that, to take advantage of this new yauaa feature.
Currently, we call ua.parse(userAgent)
here where userAgent
is a simple string taken from the headers. But we should change to instead to pass in a map comprising all useragent and client-hint headers as described in these docs.
I assume we don't need to also make a collector change to request these hints from the browser. The docs says:
By default the browsers that support this will send the “low entropy” values without the need to do anything special (other than going over https).
So to start with I think we can do this without a collector change, and still get the benefit of passing in the client hints. It's interesting to consider if in future we could change the collector to ask for any higher entropy client hint.
The JS Tracker has a feature to read the Client Hints from the Browser Client Hints API: https://docs.snowplow.io/docs/collecting-data/collecting-from-own-applications/javascript-trackers/browser-tracker/browser-tracker-v3-reference/plugins/client-hints/
We could perhaps leverage this captured schema, although I imagine getting the headers directly in the request will make this more seemless for end users (and I think there's more info available via headers than the JS API).
@paulboocock I'm veering off topic here, but we could probably write an enrichment to add org.ietf/http_client_hints
as a derived context, instead of doing it in the tracker. Looks like it's just a matter of mapping headers to fields.
@istreeter Yes this is correct. I see the following steps:
With version 7.0.0 the Yauaa User-Agent analyzer now has support for also parsing the User-Agent Client Hints. See https://yauaa.basjes.nl/using/clienthints/
In addition to only providing a
User-Agent
value it is now possible to provide a Map<String, String> with the values for the relevant request headers (i.e. headers likeUser-Agent
andSec-CH-UA-Mobile
) and get a more accurate analysis result (where possible).