Case Study - (Magento 2)

Google Analytics 4 | Google Tag Manager

About Client is an online store running on Magento 2 platform that specializes in high-quality yarn, knitting, and crochet supplies, as well as other craft supplies. The store was founded in 2004 and is based in Seattle, Washington, USA. They offer a wide range of yarn types, including wool, cotton, silk, alpaca, cashmere, and more. 

They carry yarns from popular brands such as Malabrigo, Noro, Cascade, Berroco, and many others. In addition to yarn, they also sell knitting and crochet tools and accessories, as well as patterns and books. 

Google Analytics 4 Littleknits


The client wanted GA4 to be set up on a Magento 2 website, as well as the implementation of e-Commerce tracking in GA4 via GTM.
Moreover, they wanted to create purchase funnels to visualize drop-offs at each step, which would greatly increase their conversion rate.

Challenges faced

In trying to set up these changes, there would be two main stages: Production, and Staging. We had to make sure that data from the staging domain does not get sent to the Production GA4 property, which was the main concern. 

Another issue was that the Magento 2 plugin that was being used to add dataLayer, added dataLayer in the Universal Analytics format. 

These issues thus need to be addressed immediately. 


To send data to different GA4 accounts, a possible solution was to have different Google Tag Manager (GTM) containers installed on production and staging domains.

But that would have been a very time-consuming and complicated approach. On top of that, whenever the staging setup would be updated using the latest production database, the production GTM container would become active on the staging domain.

Hence, we went with a foolproof solution by using the ‘Lookup Variable’ in GTM. Moreover, for GA4 dataLayer implementation, we used a customJS script to modify the UA format dataLayer to a GA4-ready dataLayer.


Thus, due to the steps taken, data from the Production and Staging website was now being accurately sent to their respective GA4 property.

The customJS dataLayer modification worked well, and we were able to implement E-Commerce tracking in GA4 successfully.

Now, with E-Commerce implementation in place, we were able to create conversion funnels using GA4 Explorations report.


The project was thus a success, with accurate data being tracked for the production domain and not getting mixed with staging GA4 hits.

We were able to create funnels using GA4 Explorations reports to identify where the major drop-off is happening on the website and optimize the drop-off areas for better conversions.

Thus, the ECommerce reports started receiving data with correct tracking in place, leading to better conversion optimization for the business.

Need help with your Google Analytics 4 implementation?