Ref
CS-16
Filed
2023
Status
Validated

Case study / E-commerce (yarn, knitting, and craft supplies)

Clean GA4 E-commerce Tracking and Funnels for a Magento 2 Yarn Retailer

CS-16LittleKnits.comUSMagento 2GA4 · GTM · E-commerce Tracking · GA4 Explorations

LittleKnits.com website
LIVE SITE LittleKnits.com

Results recorded

ELIMINATEDStaging traffic kept out of production data
LIVEGA4 ecommerce live on Magento 2
TRUSTEDPurchase-funnel drop-offs surfaced

01 The broken state

LittleKnits ran separate production and staging environments, and the immediate risk was staging traffic contaminating the production GA4 property. A further complication was that the Magento 2 plugin generating the dataLayer output it in the legacy Universal Analytics format rather than a GA4-ready structure.

02 What we changed

  1. Set up GA4 on the Magento 2 store and implemented e-commerce tracking through Google Tag Manager
  2. Used a GTM Lookup Variable to route hits to the correct GA4 property by environment, avoiding the overhead of maintaining separate containers for production and staging
  3. Wrote a custom JavaScript variable to transform the plugin's Universal Analytics dataLayer into a GA4-ready dataLayer
  4. Built conversion funnels in GA4 Explorations to visualize drop-offs at each step of the purchase journey

03 The outcome

A Magento 2 yarn and craft retailer needed GA4 and GTM-based e-commerce tracking without staging data polluting its production analytics. A GTM Lookup Variable separated environments and a custom dataLayer transform delivered clean GA4 e-commerce data, feeding conversion funnels in Explorations.

Record specification

Sector
E-commerce (yarn, knitting, and craft supplies)
Region
US
Platform
Magento 2
Services
GA4, GTM, E-commerce Tracking, GA4 Explorations

Next step

Want results like these on your stack?

Book a 15-minute call and we will tell you, plainly, what is wrong with your tracking and how we would fix it.