Sub topic 5
Currency and value: getting money fields right
Assume you know the GA4 event model, JavaScript objects, and how a shop calculates an order total. This chapter focuses on two event parameters: currency and value.
What `currency` means
currency identifies the currency used by the monetary values in an event. Use the three-letter ISO 4217 code, such as USD, EUR, or GBP.
Send currency whenever you send value, price, tax, or shipping. The event currency tells GA4 how to interpret the numbers. GA4 can then convert monetary values into the property currency for reporting.
Use one currency code for every monetary value in an event. Do not send a product price in USD and a shipping amount in EUR in the same event.
What `value` means
For e-commerce events, value is normally the total value of the items:
value = sum(price × quantity)
Do not add tax or shipping to this calculation. Send tax and shipping in their own parameters when the event supports them.
For example, two items priced at 24.99 USD have an item value of 49.98 USD. The tax and shipping are separate:
gtag('event', 'purchase', {
transaction_id: 'T_12345',
currency: 'USD',
value: 49.98,
tax: 4.00,
shipping: 5.99,
items: [
{
item_id: 'SKU_1001',
item_name: 'Trail Running Shoe',
price: 24.99,
quantity: 2
}
]
});The price inside an item is the unit price. The quantity is the number of units. Both should be numeric values, not strings such as "24.99" or "2".
For discounted products, make the arithmetic match the amount your business wants to report. Many shops send the net unit price in price and send the discount separately when needed. This prevents value from overstating item revenue.
A reliable calculation flow
Calculate the item total from the same cart data that produces the checkout total. Do not calculate value from a formatted display string such as $49.98. Store prices as numbers in the application's order data, then format them only for display.
Common mistakes
- Sending
currency: "US Dollar"instead ofcurrency: "USD". - Including tax and shipping in
valuewhile also sending them separately. - Sending a cart total that does not equal the item prices multiplied by quantities.
- Mixing currencies within one event.
- Sending numeric fields as localized text, such as
"1.234,56".
Exercise
An order contains three units at 12.50 EUR, 2.00 EUR tax, and 4.00 EUR shipping. What should the purchase event send for currency and value?
Show answer
Send currency as "EUR" and value as 37.50. Send tax as 2.00 and shipping as 4.00 in their separate parameters.