Purchase Event Builder
Build a complete GA4 purchase event with line items
Fill in transaction details and add product line items to generate a fully-structured GA4 purchase event. Get both the dataLayer.push() code and the gtag() equivalent.
How It Works
Enter transaction details
Add transaction ID, currency, total value, tax, and shipping amounts.
Add line items
Add each product with ID, name, category, price, and quantity.
Copy the generated code
Get the complete dataLayer.push() and gtag() event code ready for implementation.
Frequently Asked Questions
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, product performance data into Merchant Center, 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.
This GA4 purchase event builder generates a complete, production-ready event โ including transaction details and multiple line items โ in either dataLayer.push() or gtag() format. It follows Google's official GA4 ecommerce schema exactly, so the code you copy from this tool will pass GA4 schema validation without modification.
The Complete GA4 Purchase Event Structure
A fully-formed GA4 purchase event includes three layers of data: the event-level parameters, the ecommerce object, and the items array. Here is what each layer contributes to your reporting:
- transaction_id (string) โ Unique identifier for this order. GA4 uses this for purchase deduplication โ if the same transaction_id fires twice in the same session, the duplicate is dropped. Always use your order ID as a string, never as a number.
- value (number) โ Total revenue for this transaction. This value appears in GA4 revenue reports and imports into Google Ads as conversion value. Define clearly whether this includes or excludes tax and shipping, and be consistent.
- currency (string) โ ISO 4217 three-letter currency code (USD, EUR, GBP). Without this, GA4 cannot attribute revenue and the value field is effectively ignored.
- items array โ Contains one object per product purchased, each with item_id, item_name, price, and quantity at minimum. Item-level data powers GA4's product performance reports, shopping funnel analysis, and product list attribution.
Purchase Event via GTM: Implementation Guide
The recommended implementation pattern for the GA4 purchase event via GTM is: 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. Enable "Send Ecommerce data" in the tag's advanced settings to ensure the items array is forwarded correctly to GA4.
For Shopify stores, WooCommerce, and other major platforms, the ecommerce data layer is often already present via official theme code or plugins. In these cases, you only need to configure the GTM tag to read from the existing data layer โ no custom developer work required. Use this purchase event builder to validate the structure your platform pushes before assuming it matches GA4's requirements.
Need Expert Tracking Setup?
Our team implements GA4, GTM, and conversion tracking for 200+ clients worldwide. Get a free audit.
Get a Free Consultation โ