relay_event_normalization::user_agent

Function browser_from_client_hints

source
pub fn browser_from_client_hints(s: &str) -> Option<(String, String)>
Expand description

The sec-ch-ua field looks something like this: “Not_A Brand”;v=“99”, “Google Chrome”;v=“109”, “Chromium”;v=“109” The order of the items are randomly shuffled.

It tries to detect the “not a brand” item and the browser engine, if it’s neither its assumed to be a browser and gets returned as such.

Returns None if no browser field detected.