Configuring Google Analytics & Tag Manager Integration
This article will walk you through the steps of setting up an integration with Google Analytics (GA) and Google Tag Manager (GTM) . This will let you automatically track page view and custom events, along with any other tags configured in your GTM containers.
Choosing the Right Integration
This document covers integration with Google's marketing technology stack
(Google Analytics 4, Google Tag Manager).
Looking for Adobe Experience Cloud integration instead?
See our Adobe Experience Cloud Integration guide.
When to Use This Integration
- You're using Google Analytics as your primary analytics solution
- You want to leverage Google Tag Manager for tag management
- You're already invested in the Google marketing ecosystem
Integration Comparison
Feature | Google Analytics & GTM | Adobe Experience Cloud |
Analytics | Google Analytics 4 | Adobe Analytics |
Tag Management | Google Tag Manager | Adobe Experience Platform Tags |
Personalization | Limited (via GTM) | Adobe Target/AJO |
Data Layer | Google Data Layer | Adobe Client Data Layer |
Cost | Free tier available | Enterprise licensing |
Privacy | GDPR/CCPA compliant | GDPR/CCPA compliant |
Integration Overview
The Google Analytics & Tag Manager integration provides a streamlined marketing technology stack that enables:
- Comprehensive analytics with Google Analytics 4
- Flexible tag management through Google Tag Manager
- Custom event tracking for business-specific metrics
- Performance-optimized loading aligned with AEM EDS phases
- Privacy-compliant data collection
This integration is designed to work seamlessly with AEM Edge Delivery Services while maintaining optimal performance and user experience.
How It Works
The integration splits the traditional monolithic GTM approach into optimized phases:
- Google Analytics 4 Tag: Provides comprehensive web analytics and user behavior tracking
- Google Tag Manager: Manages all marketing tags and pixels from a centralized interface
- Google Data Layer: Standardizes data collection and event tracking
- Phased Loading: Separates critical tracking from delayed tag execution
- First-Party Data: Ensures reliable tracking while respecting privacy preferences
Rationale
In a traditional GTM implementation, one container is used to initialize tracking and load all other containers. This approach typically has a performance impact on the initial page load, degrading the Core Web Vitals (CWV).
This optimized approach attaches tracking actions to the Edge Delivery Services phases. By splitting up the loading of the libraries and containers, we have minimized the impact on page performance, while maintaining page event tracking.
Performance Benefits
- Reduced initial load time by deferring non-critical tags
- Improved Core Web Vitals through phased loading
- Faster Time to Interactive by prioritizing essential tracking
- Maintained tracking accuracy while optimizing performance
Pre-requisites
Before you can use this plugin, make sure you have access to:
- Google Analytics account with GA4 property configured
- Google Tag Manager account with container(s) set up
You'll also need the following information:
- Google Analytics Measurement ID (format: G-XXXXXXXXXX)
- Google Tag Manager container ID(s) (format: GTM-XXXXXXX)
- If using multiple containers, ensure to make note of which should be loaded in the different phases (lazy or delayed)
GTM Container Configuration
- Ensure your GTM container has the necessary tags configured
- Set up triggers for page views and custom events
- Configure variables for data layer values
- Test your container in preview mode before deploying
Installation & Configuration
Step 1: Install the Plugin
Follow the technical steps in the aem-gtm-martech GitHub repository.
Step 2: Configure Consent Management
Make sure you implement and pass a consentCallback
according to the documentation. This is essential for GDPR/CCPA compliance.
Privacy Considerations: The integration includes built-in consent management support. Default consent is set to require explicit user permission before tracking begins.
Step 3: Deploy Your Code
Commit and push your code branch to trigger the deployment.
Step 4: Test the Integration
Open a browser to the branch containing the plugin and verify the configuration.
Verification & Testing
To verify the configuration is correct you can:
Browser-Based Testing
- Use the Google Tag Assistant Chrome extension to view the events
- Use the Google Tag Assistant site to view events in real-time
- Monitor the network tab for scripts loaded from Google
- Check for calls to
https://www.google-analytics.com/g/collect
Google Analytics Verification
- Check real-time reports in Google Analytics
- Verify page view events are being recorded
- Test custom event tracking
- Confirm conversion tracking (if configured)
GTM Preview Mode
- Use GTM's preview mode to debug tag firing
- Verify data layer variables are populated correctly
- Check that triggers are working as expected
- Validate tag configurations
Expected Network Activity
When properly configured, you should see:
- GA4 measurement calls to
google-analytics.com
- GTM container loads from
googletagmanager.com
- Data layer pushes in browser console (if debugging enabled)
Privacy & Consent Management
The integration provides comprehensive privacy controls:
- Default consent state: Requires explicit user permission
- Granular consent categories: Analytics, marketing, preferences
- Consent callback integration: Works with popular consent management platforms
- Data retention controls: Configurable data retention periods
Troubleshooting
Common Issues
No tracking data in Google Analytics:
- Verify your GA4 Measurement ID is correct
- Check that consent has been granted
- Ensure GTM container is published, not just saved
- Monitor browser console for JavaScript errors
GTM tags not firing:
- Check GTM preview mode for trigger debugging
- Verify data layer variables are populated
- Ensure consent is properly granted for relevant storage types
- Check tag configuration and triggers
Performance degradation:
- Review the number of tags in your GTM container
- Consider moving non-critical tags to delayed phase
- Monitor Core Web Vitals impact
- Optimize trigger conditions to reduce unnecessary tag fires
Debugging Tools
- GTM Preview Mode: Real-time tag debugging
- Google Tag Assistant: Browser extension for validation
- GA4 DebugView: Real-time event monitoring
- Browser DevTools: Network and console monitoring
Next Steps & Related Resources
Demo & Examples
A demo site with the plugin can be found here.
Additional Documentation
- Google Analytics 4: GA4 Setup Guide
- Google Tag Manager: GTM Implementation Guide
Alternative Integration Options
- Adobe Experience Cloud: Adobe MarTech Integration
Technical Resources
- GitHub Repository: adobe-rnd/aem-gtm-martech
Google Resources
- Tag Assistant Chrome Extension: Install from Chrome Web Store
- Google Tag Assistant: Online Validation Tool
- Google Analytics Help: Support Documentation
- Google Tag Manager Help: Support Documentation