
Setting Up Google Analytics 4 & Tag Manager in Hyvä for Magento 2
by Rahul Basu
July 22,2025
If you're running an online store on Magento 2 and using the Hyvä theme, you're already ahead of the curve when it comes to performance and user experience. But high speed and clean UI are just the beginning — to really scale, you need data. That’s where Google Analytics 4 (GA4) and Google Tag Manager (GTM) come in.
In this guide, we’ll walk you through setting up GA4 and GTM in Hyvä for Magento 2 — so you can start collecting actionable insights, tracking user behavior, and boosting conversions. Whether you're a developer or a merchant working with a trusted Magento agency in Berlin, this setup will form the backbone of your analytics strategy.
Why Hyvä + GA4 + GTM Is a Game-Changer for E-commerce
Hyvä has revolutionized Magento frontend development by replacing bloated Luma themes with lightning-fast, clean, and modular code. But its streamlined approach also means it doesn’t include many of the traditional built-in integrations — like Google Tag Manager or GA4 scripts. That’s not a bad thing. In fact, it’s a huge opportunity: you get more control, better performance, and no extra JavaScript bloat. By integrating Google Analytics 4 via GTM, you’ll be able to:- Track enhanced eCommerce events (like add to cart, purchases, etc.)
- Run marketing campaigns with better attribution
- Set up custom conversions and funnels
- Reduce reliance on third-party tracking extensions
What You Need Before You Start
Make sure you have the following:- A Magento 2 store running with the Hyvä theme
- Access to your store’s codebase
- A Google Analytics 4 property set up
- A Google Tag Manager container created
- Admin access to Magento 2 backend
Step 2: Configure Your GTM Container
Log into Google Tag Manager and add a GA4 Configuration tag using your GA4 measurement ID.- Click "Add a new tag"
- Choose GA4 Configuration
- Enter your Measurement ID
- Set the trigger to All Pages
- Save and publish the container
Adding eCommerce Tracking for Magento 2
GA4 is event-based, so to go beyond page views, you’ll want to configure:- View Item
- Add to Cart
- Begin Checkout
- Purchase
Testing Your GA4 & GTM Setup
Don’t skip this step. Use the GTM Preview mode and the GA4 DebugView to ensure data is flowing correctly. Tools to verify:- Google Tag Assistant
- GA4 Realtime Dashboard
- Chrome DevTools > Network > collect
How a Magento Agency in Berlin Can Help
Working with a local Magento agency in Berlin ensures your store is built, customized, and tracked with precision. Whether it’s deploying Hyvä, optimizing for Core Web Vitals, or integrating GA4 with GTM, an experienced Magento 2 service team can make sure you’re getting clean data and scalable infrastructure. Benefits of working with a professional partner:- Custom tag development
- Debugging and QA environments
- Ongoing analytics consulting
- Integration with marketing tools like Facebook Pixel, TikTok, LinkedIn Ads, and more
- ❌ Not configuring Consent Mode for GDPR compliance
- ❌ Forgetting to load dataLayer before GTM triggers
- ❌ Using deprecated Universal Analytics tags
- ❌ Not enabling enhanced measurement in GA4