ETLMCPData Conveyance Works
Log in Start free
Docs

fx rule: currency conversion

How the fx rule converts cost and other amounts into one currency at rates you give, what it changes in each row, and why a run fails on it.

An fx rule multiplies one amount column by a rate you supply, so that rows from accounts in different currencies arrive in a single currency. You name the column in field and the target currency in to; both are required. The rates object maps each source currency code to the number you multiply by to get the target currency. When the rule converts cost, it also converts cpc, cpm and cpa, and it sets the row's currency column to the target. Without an fx rule, etlmcp never converts anything: every amount is delivered in the currency the platform reports it in.

The rule's shape

A pipeline's rules are a JSON list, applied in order. This pair converts spend and revenue into US dollars, using made-up rates:

[
  {"op": "fx", "field": "cost", "to": "USD", "rates": {"AUD": 0.66, "GBP": 1.27}},
  {"op": "fx", "field": "conversion_value", "to": "USD", "rates": {"AUD": 0.66, "GBP": 1.27}}
]
  • field is the column to convert. It can be a base column such as cost or conversion_value, or a platform metric under extra., written extra.<name>.
  • to is the currency code the amounts end up in. Write codes exactly as the currency column holds them, for example USD, not usd.
  • rates is keyed by the currency a row is in now. A rate of 0.66 under AUD means one Australian dollar becomes 0.66 of the to currency. You need no entry for the target itself: a row already in USD is left as it is.
  • The rates are fixed numbers stored in the rule. They do not change by date, so every day in a sync is converted at the same rate.
  • A rule with no rates, or empty rates, changes nothing.
  • A row whose field is empty or not a number is skipped.

What changes in each row

For a row in a currency you listed, the rule multiplies field by that currency's rate and writes to into the row's currency column. Because currency is a standard delivered column, your table shows which currency each row ended in.

Converting cost carries its ratios along: cpc, cpm and cpa are multiplied by the same rate, because each is cost divided by something. ctr, impressions, clicks and conversions are counts and ratios of counts, so they never change.

Converting cost does not convert conversion_value. Give revenue an fx rule of its own, as in the example above, or a row will say USD while its revenue is still in Australian dollars. etlmcp keeps track of each column separately inside the rule list, so the second rule still knows the revenue is in AUD even though the first rule already set currency to USD.

Where to put it in the rule list

The rules run top to bottom, so put an fx rule:

  1. Before any derive that mixes money columns. A ROAS worked out as conversion_value / cost is only right when both amounts are in the same currency. Convert both first, then derive.
  2. Before a group rule. Grouping adds up cost and conversion_value across rows with no regard for currency, so an Australian and a British account summed together give a number in neither currency. A group whose by list leaves out currency drops that column, so an fx rule with rates placed after it is refused when you save, unless an earlier fx rule already converted the rows. Even then, an amount column that the earlier rule did not convert has no known currency once rows in different currencies are combined, and the later rule fails on it.
  3. Before a select or rename that removes currency. If an earlier rule drops the currency column, a later fx rule with rates is refused when you save, with a message that starts fx (rule {…}): an earlier rule drops currency, so the. Move the fx rule up, or keep currency in the list. A constant rule that sets currency gives the rows a currency again.

Errors

When you save or preview rules, a rule without field or to is refused with fx (rule {…}) needs 'field' and 'to'. Rule positions in these messages count from 0, while the dashboard editor numbers its rows from 1, so rule 0 is the editor's first row.

Two errors appear only when the rule meets rows, in a preview or while a sync applies the rules:

  • fx: no rate for {…} -> {…} names the row's currency and the target, for example a EUR account when rates lists only AUD and GBP. Add the missing currency to rates.
  • fx: a row has no currency means etlmcp could not tell what currency the amount is in: the row's currency is empty, or a group after an earlier fx rule combined rows whose unconverted amounts were in different currencies. Move every fx rule above the group.

During a sync, either one fails the run and nothing is delivered. etlmcp does not retry it, because running the same rules again gives the same error; fix the rule and start the sync again. See run statuses for how a failed run shows, and transform errors for every other rule message.

Adding an fx rule

The pipeline editor in the dashboard has no fx option. When a pipeline already has an fx rule, the editor shows it as a read-only line of JSON with its kind locked. Saving from the editor keeps that rule exactly as it is, in its place, and you can delete it with the remove button, but you cannot type a new one or change its rates there.

The public REST API and the MCP tools do not write rules either: Get a pipeline and list_pipelines show a pipeline's rules, including any fx rule, but nothing there changes them. Today the only way to set one is the pipelines endpoint the dashboard itself calls, which takes the whole rule list as JSON and works only with your signed-in dashboard session and a verified email address.

Where amounts come from without it

A Google Ads or Meta row is in the ad account's own currency, a GA4 row is in the property's currency, and a Shopify row is in the store's currency. etlmcp does not look up exchange rates. If you report across accounts in several currencies and do not use an fx rule, keep currency in your table and convert in your own queries, or group by currency rather than adding amounts together.

Related

Sources

  1. customer | Google Ads API — developers.google.com, checked
  2. Ad Account, Insights — developers.facebook.com, checked
  3. Currency reference - Analytics Help — support.google.com, checked
  4. MoneyBag - GraphQL Admin — shopify.dev, checked