Setting Up Google Analytics 4 & Tag Manager in Hyvä for Magento 2

Setting Up Google Analytics 4 & Tag Manager in Hyvä for Magento 2

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
Pro Tip: If you're working with a professional Magento 2 service provider, ask them to give you access to preview environments where you can test GTM tags safely.  Step-by-Step: Setting Up GTM in Hyvä  Step 1: Add GTM Code Snippets to Your Theme  Unlike Luma-based Magento 2 stores, Hyvä doesn’t have a GTM module out of the box. So you’ll need to add the GTM container manually in your custom layout.  GTM Head snippet: Insert this in the <head> section of your default_head_blocks.xml or custom layout file:  xml  Copy  <referenceContainer name="head.additional">      <block class="Magento\Framework\View\Element\Template" name="gtm_head" template="Magento_Theme::html/gtm-head.phtml"/>  </referenceContainer>  Then create a file gtm-head.phtml with the GTM head code from your container.  GTM Body snippet: Insert in default.xml or the layout where your <body> tag is rendered:  xml  Copy  <referenceContainer name="after.body.start">      <block class="Magento\Framework\View\Element\Template" name="gtm_body" template="Magento_Theme::html/gtm-body.phtml"/>  </referenceContainer>  And create the corresponding gtm-body.phtml. 

Step 2: Configure Your GTM Container 

Log into Google Tag Manager and add a GA4 Configuration tag using your GA4 measurement ID.
  1. Click "Add a new tag" 
  1. Choose GA4 Configuration 
  1. Enter your Measurement ID 
  1. Set the trigger to All Pages 
  1. Save and publish the container 
This sends page view data to GA4 across your Magento store. 

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 
You can either write custom dataLayer pushes in Magento templates or use third-party modules that support Hyvä (like Anowave, Scommerce, or custom-developed modules). Here’s an example of pushing product view data:  html  Copy  <script>  window.dataLayer = window.dataLayer || [];  window.dataLayer.push({    event: 'view_item',    ecommerce: {      items: [{        item_name: 'Bluebell Wedding Dress',        item_id: 'SKU12345',        price: 999.99,        item_category: 'Wedding Dresses'      }]    }  });  </script>  Place this script inside your product template, e.g., Magento_Catalog/templates/product/view.phtml. 

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 
Common Pitfalls to Avoid 
  • 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 
Final Thoughts  Setting up Google Analytics 4 and Tag Manager in Hyvä for Magento 2 gives you full visibility into your customer journey while keeping your site lightweight and blazing fast. It’s a must-have for eCommerce businesses serious about growth. If you need expert help, look no further than a certified Magento agency in Berlin with a deep understanding of Hyvä development and Magento 2 services. When done right, analytics isn’t just a tool — it’s your growth engine.

Frequently Asked Questions (FAQs) 

What’s the difference between GA4 and Universal Analytics for Magento?  GA4 is event-driven, more flexible, and future-proof. Universal Analytics was session-based and is now sunset by Google.  Do I need a developer to set up GTM and GA4 in Hyvä?  If you’re comfortable editing layout files and HTML, you can do it yourself. But for advanced tracking, working with a Magento 2 service provider is recommended.  Is Hyvä compatible with all Magento extensions?  Not always. You’ll need to check if the extension supports Hyvä or has a fallback integration. Analytics and GTM usually require manual setup or module support. 

Latest Post

Gepostet auf Google Google
Inka Möller profile picture
Inka Möller
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex überprüft, ob die Originalquelle der Bewertung Google ist.
Hat alles super geklappt und ganz unkompliziert.
Gepostet auf Google Google
Rene Emser profile picture
Rene Emser
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex überprüft, ob die Originalquelle der Bewertung Google ist.
Wir bei Hochzeitsrausch Brautmoden sind sehr zufrieden mit der Zusammenarbeit mit Ingold Solutions. Besonders hervorzuheben sind die schnelle Reaktionszeit und der freundliche Service. Ingold Solutions hat unsere WordPress- und Shopify-Seiten überarbeitet und wichtige Funktionen hinzugefügt, wie zum Beispiel eine Terminbuchungsfunktion. Auch die Migration unserer Geschäftsdaten in die Microsoft 365 Cloud verlief reibungslos und hat unsere Arbeitsabläufe spürbar verbessert. Durch die Integration von SAP Business One sind unsere Online- und Offline-Systeme jetzt optimal aufeinander abgestimmt. Wir können Ingold Solutions für ihre technische Expertise und maßgeschneiderten Lösungen uneingeschränkt empfehlen.
Gepostet auf Google Google
Uwe L profile picture
Uwe L
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex überprüft, ob die Originalquelle der Bewertung Google ist.
Die Kooperation mit der Ingold Solutions GmbH als unserem Lösungspartner für SAP Business One war für die MIP Consult GmbH eine äußerst positive Erfahrung. Ingold hat uns mit einem maßgeschneiderten Paket beliefert, das ihre umfassende Kenntnis unserer Anforderungen widerspiegelt. Ihr Team hat die SAP-Datenbank effizient konfiguriert, umfangreiche Schulungen angeboten und die Stammdaten sorgfältig hochgeladen, was einen reibungslosen Übergang ermöglichte. Die Implementierung des Multi-Banking-Systems zeugt weiter von ihrer fachlichen Kompetenz und ihrem Engagement für ganzheitliche Lösungen. Die Professionalität und Einsatzbereitschaft von Ingold haben unseren Übergang äußerst effizient gestaltet, und ihre kontinuierliche Unterstützung ist von unschätzbarem Wert. Wir können Ingold Solutions GmbH wärmstens empfehlen für Unternehmen, die erstklassige SAP-Lösungen und exzellenten Service.
Gepostet auf Google Google
Dawid Telesinski profile picture
Dawid Telesinski
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex überprüft, ob die Originalquelle der Bewertung Google ist.
Ingold Solutions GmbH hat für Numiartis eine effiziente Lösung entwickelt, die als B2B-E-Commerce-Portal und Online-Katalog dient und B2C-Bestellungen vereinfacht. Das verbesserte Design ermöglicht eine reibungslose Navigation und effiziente Kundenregistrierung, was zur Kundengewinnung beiträgt. Dank der Magento Open Source Plattform ist auch die Produkt-Navigation optimiert worden. Wir sind sehr zufrieden mit dem bedeutenden Beitrag von Ingold Solutions zur digitalen Erweiterung unseres Unternehmens.
Gepostet auf Google Google
Attila Totos profile picture
Attila Totos
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex überprüft, ob die Originalquelle der Bewertung Google ist.
Ingold Solutions proved to be an invaluable partner for Pyronova IS Deutschland GmbH during our recent implementation. Their team seamlessly configured our accounting system, and their expertise was evident as they provided a dedicated German accounting expert, ensuring precise setup tailored to our needs. Furthermore, Ingold's commitment to customization shone through as they worked on seamless and precise configuration of our accounting system within SAP Business One. This addon will undoubtedly elevate our financial operations. Their professionalism, expertise, and dedication to our project's success were exemplary. We highly recommend Ingold Solutions for their exceptional service and comprehensive support throughout our implementation process. Attila Totos Head of Finance Dep. Pyronova
Gepostet auf Google Google
Thomas Schneider profile picture
Thomas Schneider
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex überprüft, ob die Originalquelle der Bewertung Google ist.
Von Anfang an beeindruckte uns Ingold Solutions mit ihrer Umsetzung von SAP Business One. Sie erfüllten effizient unseren Bedarf an Benutzerlizenzen und integrierten diese in die robuste Infrastruktur von Cloudiax's Private Cloud. Unsere Entscheidung für das Standardpaket wurde dank Ingold Solutions' Geschäftsblueprint-Vorlage präzise umgesetzt, was zu einer perfekten Datenbankkonfiguration führte und unsere Betriebsstruktur optimierte. Ingold Solutions bot mit ihrer Expertise wertvolle Unterstützung. Ihr technisches Team sorgte nicht nur für die richtigen Änderungen, sondern integrierte sie auch nahtlos in die Cloudiax-Umgebung. Die von Ingold Solutions eingesetzten Technologien - von der Private Cloud in Cloudiax über SAP B1 mit HANA bis zum SAP Business One Standard Package - zeugen von einem durchdachten Ansatz, der auf betrieblichen Erfolg ausgerichtet ist. Absolut professionell, nur zu empfehlen! winwall GmbH
Gepostet auf Google Google
Markus Beck profile picture
Markus Beck
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex überprüft, ob die Originalquelle der Bewertung Google ist.
Schnelle und kompetente Umsetzung zu fairen Preisen mit fähigen Mitarbeitern. Danke
Verifiziert von: Trustindex
Das verifizierte Trustindex-Abzeichen ist das universelle Symbol des Vertrauens. Nur die besten Unternehmen können das verifizierte Abzeichen erhalten, die eine Bewertungsnote über 4.5 haben, basierend auf Kundenbewertungen der letzten 12 Monate. Mehr erfahren