Getting started on Snowplow Open Source

  1. Home
  2. Docs
  3. Getting started on Snowplow Open Source
  4. Setup Snowplow Open Source on GCP
  5. Setup Validation and Enrich (GCP)
  6. Add additional enrichments
  7. ua-parser enrichment

ua-parser enrichment

Compatibility

JSON Schema iglu:com.snowplowanalytics.snowplow/ua_parser_config/jsonschema/1-0-1 Compatibility r109+ 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.

Example

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

You can additionally specify a database:

{
  "schema": "iglu:com.snowplowanalytics.snowplow/ua_parser_config/jsonschema/1-0-1",
  "data": {
    "vendor": "com.snowplowanalytics.snowplow",
    "name": "ua_parser_config",
    "enabled": true,
    "parameters": {
      "uri": "s3://snowplow-hosted-assets/third-party/ua-parser",
      "database": "regexes-latest.yaml"
    }
  }
}

You can check the hosted assets page to know more about the database we host. The context generated by the enrichment adheres to this schema.

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. 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:

ParameterValue
useragent_familyChrome
useragent_major48
useragent_minor
useragent_patch2564
os_familyWindows 7
os_major
os_minor
os_patch_minor
device_familyOther

Data generated

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

FieldPurpose
useragent_familyUseragent family (browser) name
useragent_majorUseragent major version
useragent_minorUseragent minor version
useragent_patchUseragent patch version
useragent_versionFull version of the useragent
os_familyOperation system name
os_majorOperation system major version
os_minorOperation system minor version
os_patchOperation system patch version
os_patch_minorOperation system patch minor version
os_versionOperation system full version
device_familyDevice type