GA4 Purchase Event Builder — Generate Purchase Tracking Code | Adslytics | Adslytics

🧾

Purchase Event Builder

Build a complete GA4 purchase event with line items

How It Works

1

Enter transaction details

Add transaction ID, currency, total value, tax, and shipping amounts.

2

Add line items

Add each product with ID, name, category, price, and quantity.

3

Copy the generated code

Get the complete dataLayer.push() event code ready for implementation.

GA4 Purchase Event Builder

Items


              
            

Why the GA4 Purchase Event Requires Careful Implementation

The GA4 purchase event is the most important event in any ecommerce analytics implementation. It feeds revenue data into GA4 reports, conversion values into Google Ads for ROAS bidding, and audience qualification signals for remarketing. A correctly structured purchase event is the difference between having actionable ecommerce intelligence and having a dashboard full of misleading numbers.

The Complete GA4 Purchase Event Structure

  • transaction_id (string) — Unique identifier for this order. Always use your order ID as a string, never as a number.
  • value (number) — Total revenue for this transaction. Define clearly whether this includes or excludes tax and shipping.
  • currency (string) — ISO 4217 three-letter currency code (USD, EUR, GBP).
  • items array — Contains one object per product purchased, each with item_id, item_name, price, and quantity.

Purchase Event via GTM: Implementation Guide

The recommended pattern: push the ecommerce data to the data layer on the order confirmation page before the GTM snippet fires, then configure a GA4 Event tag in GTM triggered by a Custom Event trigger set to your purchase event name. In the GA4 Event tag, add a single parameter named ecommerce with value set to a Data Layer Variable reading from the key ecommerce.

Frequently Asked Questions

Required: transaction_id (unique string), currency (ISO 4217 code), value (total revenue as number). The items array is strongly recommended.
It depends on your business. GA4 does not enforce either convention. The key is consistency — pick one approach and document it.
item_id is your internal SKU or product ID. item_name is the human-readable product name. GA4 requires at least one of these per item.
Yes — use a GA4 Event tag in GTM triggered by a custom event (e.g., "purchase") in the dataLayer.
GA4 supports up to 200 items per event.