Skip to main content

GA4 in Google Tag Manager: events, variables, and purchase verification

Connect the right Abicart events and data layer variables to GA4. Distinguish purchase from the older purchase_GA4 and check values, VAT…

With Google Tag Manager (GTM), you can send product views, cart events, and purchases from Abicart to Google Analytics 4 (GA4). GA4 and GTM are available in Go, Plus, and Pro. Start with a connected GTM container and check which events your active theme actually sends, so that the correct data reaches GA4 and the same purchase is not registered twice.

Before you begin

This guide is about events and variables, not about installing the same tracking again. GTM-… identifies the GTM container. G-… is a measurement ID for GA4. The fact that an ID is saved in Abicart does not in itself show that the correct container and purchase tag are running.

See create and connect a GTM account for the connection and add GA4 for GA4 settings. Theme families and older theme versions can send different structures. Therefore, do not use a specific version number as a guarantee for all themes. Ask support to check the support in your active theme if the events below are missing.

Also check the store's consent settings and Google's tag settings. An event in the data layer does not prove consent or delivery to GA4. Map only the parameters required for the current event; do not send the entire data layer object automatically.

Do not send email addresses, phone numbers or other directly identifying customer data as ordinary GA4 event parameters, in page URLs or in custom dimensions, even when the customer has consented to tracking. Dedicated user-data features require a separate, correct configuration. Use only one verified purchase flow for the same order and reconcile item value excluding tax and shipping, tax and shipping separately.

1. Read the events in GTM Preview

  1. Open the correct container in GTM and start Preview for the store's address. Use the store and theme that are to be measured.

  2. View a product, add it to the cart, and open the checkout. Select each event in Tag Assistant and read both Data Layer, Variables and the tags that have fired.

  3. Check the event for that specific action. An old value that remains from a previous event should not be used as proof of a new purchase.

  4. Only check the purchase step with a planned test flow and a payment environment that you are allowed to use. A real purchase can charge, reserve money, and affect inventory.

Event in the data layer

When it's used

What to check

view_item

A product page is viewed.

Correct product in ecommerce.items, currency, and price basis for the theme.

add_to_cart

An item is added to the cart.

Which item and quantity the event refers to; do not assume that an order ID already exists.

begin_checkout

The checkout process begins.

The cart's contents and value. Check the VAT basis separately from the purchase event.

purchase

The structured purchase event appears on the receipt page in themes with this support.

ecommerce.transaction_id, value, tax, shipping and items.

purchase_GA4

An older purchase flow with separate transaction fields.

See the comparison below. The event name does not guarantee a modern ecommerce object.

2. Create variables with the full path

ecommerce is an object. ecommerce.items is a list of product objects. Create data layer variables in GTM with the exact path for the event you have checked, for example ecommerce.currency. Do not just use currency when the value is inside the object.

Path

Type and meaning

ecommerce.currency

Currency code, for example SEK.

ecommerce.items

List of items. Send the entire list as the GA4 parameter items.

ecommerce.items[].item_id, item_name, price, quantity

The product's identifier, name, unit price, and quantity. [] describes each item in the list; do not enter the square brackets as a GTM path to a single variable.

ecommerce.transaction_id

Unique order ID as a string for a purchase. Do not create a made-up order ID for a product view.

ecommerce.value

Item value for the structured purchase event, excluding VAT and shipping.

ecommerce.tax, ecommerce.shipping

The order's VAT amount and its shipping cost excluding VAT, respectively. Both are separate from the item value.

ecommerce.totaltransactionValue

Supplementary total including VAT in the structured purchase flow. This is not the same value as GA4's value.

For product views and beginning checkout, prices may follow different VAT settings than the purchase event. Check the actual event before reusing the same price variable in all tags. Missing fields should be troubleshooted; do not replace a missing order ID or item value with an older value that happens to be in the data layer.

3. Connect the event to a GA4 tag

  1. Create the data layer variables you need in GTM. Select Data Layer Variable, enter the full path, and check the value in Preview for the correct event.

  2. Create a custom event trigger with the exact event name, for example purchase. Connect it to the intended GA4 event tag and the correct Google tag/measurement ID.

  3. Send the parameters that correspond to the event. For purchases, parameters such as transaction_id, currency, value, tax, shipping and items are relevant.

  4. Check if the container sends ecommerce data automatically or via manual parameter mappings. Do not let two different purchase tags send the same order.

  5. Test in Preview and check the received parameters in GA4's DebugView. Only publish when the result is correct.

purchase and the older purchase_GA4 are different data sources

The structured purchase event has purchase data in ecommerce. The older purchase_GA4 flow may instead contain transactionId, transactionProducts, currencyCode, cartCost, transactionTotal, transactionTax, transactionShipping, paymentFee and totalIncVat. These are not automatically the same GTM paths as in the table above.

If the older flow is used, the mapping needs to be checked specifically: cartCost refers to the item value excluding VAT, while transactionTotal can also include other costs. The product list format also needs to match GA4's items. Standalone fields like articleId, articleNumber, name, articleName, articlePrice and orderItem can appear in older events. They are not necessarily present on every page or event.

Do not connect both purchase and purchase_GA4 to separate GA4 purchase tags for the same order. If you need to switch from an older mapping, check existing tags and test the switch before turning off the old flow.

Example: check the amounts

A simplified test order without a discount or payment fee has two items at SEK 100 each excluding VAT, shipping at SEK 40 excluding VAT, and 25 percent VAT on everything. Then the item value is 200, shipping is 40, VAT is 60, and the total is SEK 300. This illustrates why value should not be set to the entire total including VAT and shipping. Check actual discounts, fees, and VAT rates against your own test order.

{"event":"purchase","ecommerce":{"transaction_id":"TEST-1001","currency":"SEK","value":200,"tax":60,"shipping":40,"items":[{"item_id":"TEST-01","item_name":"Testprodukt","price":100,"quantity":2}]}}

Also check a reload of the same test receipt. The order should keep the same transaction_id; do not create a new ID per page view. Compare received purchases, not just the number of events in the data layer. Include discounts, multiple VAT rates, shipping, and any payment fees in the test cases. The item value, shipping, VAT, and total are different amounts and must be mapped to the correct parameters.

Troubleshoot and check the result

Symptom

Next check

Wrong or old GTM ID is loaded

Check the correct store, active theme, saved ID, and published container. Investigate duplicate installations and any cache before adding another script.

The event exists but the variable is empty

Select the correct event and read the structure there. Check the full path and whether the event uses the modern or older purchase format.

GA4 shows too high a value or duplicate purchases

Compare value, VAT basis, and shipping with the order. Check how many purchase tags are firing and that the same unique transaction_id is used for the same order.

Nothing reaches GA4

First check the data layer, then the trigger, fired tag, measurement ID, consent, and DebugView. A data layer event alone does not prove delivery to GA4.

When contacting support: specify the store, active theme, GTM ID, event name, time, and an anonymized example of the missing fields. Do not send customer data or payment data. For Google's recipient format, see Google's guide for GA4 ecommerce.

Quick start

  1. Check that the correct GTM container is loaded in the correct store and that the intended container version is published.

  2. Follow product → cart → checkout in GTM Preview and read the data layer for each event.

  3. Use purchase with its ecommerce object when that structure exists. Do not confuse it with the older event purchase_GA4.

  4. Reconcile the order ID, currency, item value, VAT, and shipping against an agreed-upon test order. Check for a single purchase report before publishing changed tags.

Subscription and access

GA4 and GTM are available in Go, Plus, and Pro. A connected GTM container, the correct Google account, a supported active theme configuration, and correct consent settings are also required. The guide covers events and variables; it does not replace checking the store's existing tracking.

Overview of Google Marketing Platform
Did this answer your question?