Skip to main content

UA parser enrichment (legacy)

Use YAUAA instead

The YAUAA enrichment supersedes this enrichment and is preferable in most cases.

This enrichment uses the ua-parser library to parse the user agent and provide information about the user's device.

Both the UA parser and YAUAA enrichments will add an additional entity to the event, based on the information available in the User-Agent header of the tracker request, or the ua tracker payload field. Unlike YAUAA, this enrichment doesn't support client hints.

UA parser vs YAUAA​

This table compares the output of the two user agent parsing enrichments. The UA parser enrichment provides fewer fields, but is more lightweight and has lower memory requirements than YAUAA.

The example output is based on the user agent string Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:106.0) Gecko/20100101 Firefox/106.0 (Firefox 106 on Mac OS X).

UA Parser fieldYAUAA fieldExample
deviceFamilydeviceClassDesktop
❌deviceNameApple Macintosh
❌deviceBrandApple
❌deviceCpuIntel
❌deviceCpuBits32
❌deviceFirmwareVersion
❌deviceVersion
❌operatingSystemClassDesktop
osFamilyoperatingSystemNameMac OS X
osVersionoperatingSystemVersion10.15
osMajoroperatingSystemVersionMajor10
osMinor❌15
osPatch❌
osPatchMinoroperatingSystemVersionBuild
❌operatingSystemNameVersionMac OS X 10.15
❌operatingSystemNameVersionMajorMac OS X 10
❌layoutEngineClassBrowser
❌layoutEngineNameGecko
❌layoutEngineVersion106.0
❌layoutEngineVersionMajor106
❌layoutEngineNameVersionGecko 106.0
❌layoutEngineNameVersionMajorGecko 106
❌layoutEngineBuild20100101
❌agentClassBrowser
useragentFamilyagentNameFirefox
useragentVersionagentVersion106.0
useragentMajoragentVersionMajor106
useragentMinor❌0
useragentPatch❌
❌agentNameVersionFirefox 106.0
❌agentNameVersionMajorFirefox 106
❌agentBuild
❌agentLanguage
❌agentLanguageCode
❌agentInformationEmail
❌agentInformationUrl
❌agentSecurity
❌agentUuid
❌webviewAppName
❌webviewAppVersion
❌webviewAppVersionMajor
❌webviewAppNameVersionMajor
❌facebookCarrier
❌facebookDeviceClass
❌facebookDeviceName
❌facebookDeviceVersion
❌facebookFBOP
❌facebookFBSS
❌facebookOperatingSystemName
❌facebookOperatingSystemVersion
❌anonymized
❌hackerAttackVector
❌hackerToolkit
❌koboAffiliate
❌koboPlatformId
❌iECompatibilityVersion
❌iECompatibilityVersionMajor
❌iECompatibilityNameVersion
❌iECompatibilityNameVersionMajor
❌carrier
❌gSAInstallationID
❌networkType

Configuration​

The optional database and uri parameters allow you to specify a custom ruleset. By default, the enrichment will use the one defined in the ua-parser library.

The enrichment takes these parameters:

ParameterRequiredDescription
database❌Filename of a custom ruleset.
uri❌URI of the bucket containing the custom ruleset file.

Configure the parameters in the Console enrichment editor. For example:

json
{
"database": "regexes-latest.yaml",
"uri": "s3://snowplow-hosted-assets/third-party/ua-parser/"
}
Testing with Micro

Unsure if your enrichment configuration is correct or works as expected? You can easily test it using Snowplow Micro, either through Console or on your machine.

Output​

This enrichment adds a ua_parser_context entity to the event. The example data shows the output for a User-Agent string of

txt
Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

ua_parser_context

Entity
Schema for useragent context generated by ua-parser enrichment
Schema URIiglu:com.snowplowanalytics.snowplow/ua_parser_context/jsonschema/1-0-0
Example data
json
{
"useragentFamily": "Chrome",
"useragentMajor": "48",
"useragentPatch": "2564",
"useragentVersion": "48.0.2564",
"osFamily": "Windows 7",
"osVersion": "Windows 7",
"deviceFamily": "Computer"
}
Properties and schema
PropertyDescription
useragentFamily
string
Required. Useragent family (browser) name
useragentMajor
string
Required. Useragent major version
useragentMinor
string
Required. Useragent minor version
useragentPatch
string
Optional. Useragent patch version
useragentVersion
string
Optional. Full version of the useragent
osFamily
string
Required. Operating system name
osMajor
string
Optional. Operating system major version
osMinor
string
Optional. Operating system minor version
osPatch
string
Optional. Operating system patch version
osPatchMinor
string
Optional. Operating system patch minor version
osVersion
string
Optional. Operating system full version
deviceFamily
string
Required. Device type

On this page

Want to see a custom demo?

Our technical experts are here to help.