GA4 e-commerce tracking with a custom data layer for a bespoke website
A custom-built site selling courses had no reliable purchase data. We wrote a JavaScript data layer for add-to-cart, checkout and purchase events, configured the tags and triggers in Tag Manager, and tested the full flow so GA4 now reports products, purchases and revenue accurately.
- Industry
- Coaching & education
- Services
- GA4 setup, Google Tag Manager, Custom data layer, E-commerce tracking
- Pillar
- Grow




The brief
The site was custom code rather than a standard platform, so no plugin could supply e-commerce events. GA4 showed sessions but not what was bought.
What we did
- Wrote a custom data layer in JavaScript that pushes Add to Cart, Begin Checkout and Purchase events with item names, quantities, prices, value and transaction IDs.
- Configured the GA4 configuration tag, event tags and triggers in Google Tag Manager.
- Tested the complete flow in GTM Preview and GA4 DebugView before publishing.
- Verified the e-commerce purchases report and revenue figures against real orders.
Outcome
GA4 now reports product, e-commerce, purchase and revenue data the client can trust, which is the foundation for every advertising decision that follows.



