Skip to main content

Currency conversion enrichment

This enrichment uses Open Exchange Rates to convert the currencies used in transactions. It requires an Open Exchange Rates account and API key.

When transactional data is collected in multiple currencies, it can be useful to convert it in the one that is used for reporting for instance. This could help to lower discrepancies when reporting revenue amounts across multiple currencies.

Limitations

This is an older and less actively maintained enrichment, and as such it has several limitations.

  • It can only use the exchange rate from the end of the day prior to the event’s collector_tstamp. You can’t apply a different rate (e.g. the one in effect when the event occurred), and you can’t pick a different timestamp field (e.g. dvce_sent_tstamp).
  • It only works with the tr_ and ti_ fields. These fields are not very convenient to use and exist for legacy reasons. One of their significant downsides is that you have to send a separate event for the transaction itself and then an event for each of the order items in that transaction (as opposed to including all items in a single event).

Over the years, it has become more idiomatic to use dedicated entities for order items in e-commerce transactions. For instance, our E-commerce Accelerator uses this approach, which is incompatible with this enrichment.

We recommend to manage currency conversion downstream instead of using this enrichment. For example, you could bring currency exchange rate information into your data warehouse and join that data with your Snowplow data.

Configuration​

Testing with Micro

Unsure if your enrichment configuration is correct or works as expected? You can easily test it using Snowplow Micro on your machine. Follow the Micro usage guide to set up Micro and configure it to use your enrichment.

FieldDescription
accountTypeLevel of Open Exchange Rates account. Must be “developer”, “enterprise”, or “unlimited”.
apiKeyOpen Exchange Rates API key
baseCurrencyCurrency to convert all transaction values to
rateAtDetermines 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 day prior to the event’s collector_tstamp.

Input​

This enrichment uses the following fields :

  • tr_currency
  • tr_total
  • tr_tax
  • tr_shipping
  • ti_currency
  • ti_price

Output​

This enrichment updates the following fields of the atomic event :

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