ua parser enrichment - OXYGEN-MARKET/oxygen-market.github.io GitHub Wiki

HOME > SNOWPLOW SETUP GUIDE > Step 3: Setting up Enrich > Configurable enrichments > ua-parser enrichment

Compatibility

JSON Schema iglu:com.snowplowanalytics.snowplow/ua_parser_config/jsonschema/1-0-0 Compatibility r63+ Data provider ua-parser

Overview

This enrichment uses the ua-parser library to parse the useragent and attach a ua_parser_context to each event. It can be used alongside or instead of the user_agent_utils enrichment.

Example

{
    "schema": "iglu:com.snowplowanalytics.snowplow/ua_parser_config/jsonschema/1-0-0",
    "data": {
        "vendor": "com.snowplowanalytics.snowplow",
        "name": "ua_parser_config",
        "enabled": true,
        "parameters": {}
    }
}

Note that this enrichment configuration always takes an empty dictionary ({}) of parameters.

The context generated by the enrichment adheres to this schema.

Note: As an alternative solution, you could enable user-agent-utils enrichment either in place of this enrichment or as an accopmanying enhancement. There's no conflict here as the output data of these enrichments will end up in different tables.

Data sources

The input value for the enrichment comes from ua parameter which is mapped to useragent field in atomic.events table.

Algorithm

This enrichment uses 3rd party ua_parser Java library. This library handles some useragent strings (such as mobile app useragents) better than user-agent-utils, which is relied on in User agent utils enrichment.

As an example, the useragent string

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

Will be parsed with the following result:

Parameter Value
useragent_family Chrome
useragent_major 48
useragent_minor
useragent_patch 2564
os_family Windows 7
os_major
os_minor
os_patch_minor
device_family Other

Data generated

If ua-parser is enabled, then the Snowplow Enrichment process will write its results into a new context, ua_parser_context. As a result the following fields in the dedicated com_snowplowanalytics_snowplow_ua_parser_context_1 table would be populated.

Field Purpose
useragent_family Useragent family (browser) name
useragent_major Useragent major version
useragent_minor Useragent minor version
useragent_patch Useragent patch version
useragent_version Full version of the useragent
os_family Operation system name
os_major Operation system major version
os_minor Operation system minor version
os_patch Operation system patch version
os_patch_minor Operation system patch minor version
os_version Operation system full version
device_family Device type
⚠️ **GitHub.com Fallback** ⚠️