Skip to Content
ReferenceAnalytics and consentGoogle analytics event mapping

Google analytics event mapping

Audience: Integrator.

This reference defines the Google examples’ event mappings and value limits. Use GTM setup or direct GA4 setup for installation.

GTM event-name mapping

InputOutput
product_viewedview_item
product_added_to_cartadd_to_cart
product_removed_from_cartremove_from_cart
cart_viewedview_cart

The GTM lookup uses {{Event}} as input and has no default value. The separate page-view tag maps page_viewed to page_view. Direct GA4 also maps form_submitted to generate_lead. Other names remain custom events in that script.

Data-layer message

A confirmed addition of two items produces this example message. Its IDs and context values are examples. The CMS script sends the message without a second subscription.

{ "event": "product_added_to_cart", "event_id": "example-event-1", "context": { "pageViewId": "example-view-1", "domain": "shop.example.com", "pageId": "example-page-1", "locale": "en", "document": { "location": { "href": "https://shop.example.com/products/mug", "pathname": "/products/mug" }, "title": "Ceramic mug", "referrer": "https://shop.example.com/" } }, "data": { "cartLine": { "id": "gid://shopify/CartLine/123", "quantity": 2, "merchandise": { "id": "gid://shopify/ProductVariant/456", "title": "Blue", "sku": "MUG-BLUE", "price": { "amount": "19.90", "currencyCode": "EUR" }, "product": { "id": "gid://shopify/Product/789", "title": "Ceramic mug" } } } } }

The message sends add_to_cart after GTM mapping, currency = EUR, and value = 39.8. It includes one item with item_id = MUG-BLUE, price = 19.9, and quantity = 2. Keep items as an array. Do not convert it to a JSON string. Passing event_id does not remove duplicate tags or installations.

Values and quantities

This example uses currencies with two decimal places. Adjust rounding for other currencies. Prices and values use currency units, not cents. Cart action quantities contain the confirmed change, not the resulting cart quantity. Item IDs use the SKU when present. Otherwise, they use the variant ID. value is the sum of item price × quantity. The bus does not supply separate item discounts, shipping, or tax fields. Do not use this calculation as a purchase total. See Google’s ecommerce event contract .

An empty cart without currency is excluded by the GTM trigger condition. The CMS script sends the payload under data, not an automatic ecommerce data-layer key.

Unsupported events

This setup does not send begin_checkout or purchase. The checkout-link event is not proof of either action. The current collection event has no item array, so it cannot supply a complete view_item_list event. Add mappings only when the event contract supplies the required data.

The complete event contract defines the application payloads.

Last updated on