Setting Currency When Using Universal Analytics and Google Tag Manager Ecommerce

After some frustrations with conflicting documentation, I figured I’d make the blog post I wished I had at the start of this all. This forum post is what finally led me in the correct direction.

If you’re using Universal Analytics through Google Tag Manager and are tracking Standard Ecommerce transactions in multiple currencies, you’ll need some extra setup beyond the documentation they provide. You’ll notice there’s no mention of setting the currency when sending a standard ecommerce transaction because the Universal Analytics through Google Tag Manager doesn’t support it. Thankfully, it’s easy to add.

Setting up Google Tag Manager to pass on currency code

In Tag Manager, you’ll want to create or edit a Universal Analytics tag that has a Track Type of Transaction and under More Settings, expand Fields to Set. Here you’re going to add a new field to map the transaction currency to what Google Analytics expects for the currency code.

Set Field Name to currencyCode and set the Value to a new Data Layer Variable whose variable name is transactionCurrency.

GTM’s variable UI for setting a currency variable

Once set, your Universal Analytics tag for transactions will look like so:

GTM tag configuration for Universal Analytics

This will map the currency code set in dataLayer.transactionCurrency to Google Analytics’ currencyCode.

Adding currency to your transaction in code

When defining your transaction on the dataLayer object, you can now set dataLayer.transactionCurrency to one of the supported currency codes and Google Analytics will do all the conversions needed.

Example Data Layer Transaction

In the example below, if you have a transaction in Indian Rupees, Google Analytics will take care of converting that to USD if your view is set to display data in USD instead of treating it as 5K USD.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
dataLayer.push({
    'transactionId': 123,
    'transactionTotal': 5000.00,
    'transactionCurrency': 'INR',
    'transactionProducts': [
        {
            'sku': 'ABCD',
            'name': 'Super Awesome Product',
            'price': 2500.00,
            'quantity': 2
        }
    ]
});

Caveat: This will apply the currency for the whole transaction. Different currencies per product are not covered here.