Currency conversion enrichment

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.

{
    "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.

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.

Parameter Parent event Mapped to
tr_cu Transaction tr_currency
tr_tt Transaction tr_total
tr_tx Transaction tr_tax
tr_sh Transaction tr_shipping
ti_cu Transaction item ti_currency
ti_pr Transaction item ti_price

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.

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

Field Purpose
base_currency Base currency code according to [ISO_4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
tr_total_base Total amount of transaction in base currency
tr_tax_base Tax applied in base currency
tr_shipping_base Shipping cost in base currency
ti_price_base Item price in base currency