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. Currency conversion enrichment

Currency conversion enrichment

Compatibility

JSON Schema iglu:com.snowplowanalytics.snowplow/currency_conversion/jsonschema/1-0-0 Compatibility 0.9.6+ Data provider Open Exchange Rates

Overview

This enrichment uses Open Exchange Rates to convert the values of all transactions to a specified base currency. To use it, you need an Open Exchange Rates account.

Example

{
    "schema": "iglu:com.snowplowanalytics.snowplow/currency_conversion_config/jsonschema/1-0-0",
    "data": {
        "enabled": true,
        "vendor": "com.snowplowanalytics.snowplow",
        "name": "currency_conversion_config",
        "parameters": {
            "accountType": "DEVELOPER",
            "apiKey": "{{API_KEY}}",
            "baseCurrency": "EUR",
            "rateAt": "EOD_PRIOR"
        }
    }
}

The fields are as follows:

  • “accountType”: The level of your Open Exchange Rates account. Must be “developer”, “enterprise”, or “unlimited”.
  • “apiKey”: Your Open Exchange Rates API key.
  • “baseCurrency”: The currency to convert all transaction values to.
  • “rateAt”: Determines which exchange rate will be used. Currently only “EOD_PRIOR” is supported, meaning that the enrichment uses the exchange rate from the end of the previous day.

Data sources

The Currency conversion enrichment serves as a complementary context to Ecommerce tracking, specifically the methods addTrans and addItem. Enabling the enrichment allows to acquire the prices/cost values related to the transaction in the base_currency. The input values come from those generated by firing a transaction event (e=tr) followed by firing item events (e=ti). The table below summaries the input parameters used in the enrichment process.

ParameterParent eventMapped to
tr_cuTransactiontr_currency
tr_ttTransactiontr_total
tr_txTransactiontr_tax
tr_shTransactiontr_shipping
ti_cuTransaction itemti_currency
ti_prTransaction itemti_price

Algorithm

This enrichment uses 3rd party, Open Exchange Rates, service to get the prices in transaction currency converted to a predefined base currency. In addition to the input parameters stated above the collector timestamp, collector_tstamp, obtained during common enrichment process is used as a base for EOD_PRIOR.

Data generated

Below is the summary of the fields in atomic.events table driven by the result of this enrichment (no dedicated table).

FieldPurpose
base_currencyBase currency code according to ISO_4217
tr_total_baseTotal amount of transaction in base currency
tr_tax_baseTax applied in base currency
tr_shipping_baseShipping cost in base currency
ti_price_baseItem price in base currency