Weather Enrichment

Summary

This enrichment uses the OpenWeatherMap service to look up weather conditions at the time in which an event is collected by your Snowplow tracker(s).

Overview

When it comes to getting insight into behavioural event data, it’s always best to inform those events with as much contextual information as possible. Weather certainly has an impact on our behaviour, therefore being able to see if there are any correlations between particular events and the type of weather conditions for the user at the time could be very useful.

To produce the enriched weather-related data, the values of latitude, longitude, and time are passed with API request to OpenWeatherMap.

Ultimately ip parameter (mapped to user_ipaddress) is used to obtain latitude and longitude geographical coordinates. It is achieved by yet another enrichment, namely IP lookups enrichment, which produces geo_latitude and geo_longitude.

The time parameter is the derived_tstamp value calculated during the common enrichment process.

You can find out more detail on this enrichment here.

If you’d like help in configuring this enrichment or making sure it’s deployed on your pipeline contact us at support@snowplowanalytics.com

Example

The configuration for this enrichment consists of the “apiKey”, “cacheSize”, “geoPrecision”, “apiHost”, and “timeout”. Here is what an example configuration script would look like:

{
    "schema": "iglu:com.snowplowanalytics.snowplow.enrichments/weather_enrichment_config/jsonschema/1-0-0",

    "data": {
        "enabled": true,
        "vendor": "com.snowplowanalytics.snowplow.enrichments",
        "name": "weather_enrichment_config",
        "parameters": {
            "apiKey": "{{KEY}}",
            "cacheSize": 5100,
            "geoPrecision": 1,
            "apiHost": "history.openweathermap.org",
            "timeout": 5
        }
    }
}