DataLayer Generator
Fill in the order or product details and copy a GA4-standard dataLayer push for Google Tag Manager.
Value = Σ price × quantity (+ shipping is sent separately). In GTM, use a Custom Event trigger with the event name and GA4 “Send ecommerce data → Data Layer”.
Questions & answers
Why clear the ecommerce object first?+
dataLayer.push({ecommerce: null}) stops values from a previous event being merged into the next one — Google recommends it.
Which events does GA4 need for a shop?+
view_item, add_to_cart, begin_checkout and purchase cover most shops; purchase must include transaction_id, value and currency.
Can Meta and TikTok use the same dataLayer?+
Yes — GTM tags (or TrackPilot) can read the same ecommerce data for every platform.
Fix it automatically with TrackPilot
Server-side tracking for Meta, TikTok, GA4, Google Ads and more — one snippet or the WooCommerce plugin, automatic events, COD purchase hold and a live event log.
Start free