Google Analytics 4 (GA4) is the latest version of Google's analytics platform. This guide covers both methods of installing GA4 on your Zyro site: built-in integration and custom code.
Prerequisites
Before installing GA4 on Zyro, you need:
- A Zyro account with a paid plan (Unleash, eCommerce, or eCommerce Plus)
- A Google Analytics 4 property - Create one in Google Analytics
- Your GA4 Measurement ID (format:
G-XXXXXXXXXX) - A published Zyro site (tracking only works on published sites)
Note: GA4 tracking requires a paid Zyro plan because custom code access is not available on the free plan.
Method 1: Built-in Integration (Recommended for Beginners)
The simplest way to add GA4 to your Zyro site using Zyro's built-in integration feature.
Step 1: Get Your GA4 Measurement ID
- Go to Google Analytics
- Select your GA4 property
- Navigate to Admin (gear icon at bottom left)
- Under Property, click Data Streams
- Click your Web data stream
- Copy your Measurement ID (format:
G-XXXXXXXXXX)
Step 2: Add GA4 to Zyro
- Log in to your Zyro dashboard
- Select the website you want to track
- Click Settings in the left sidebar
- Scroll to Integrations section
- Find Google Analytics
- Click Connect or Add
- Paste your GA4 Measurement ID
- Click Save
Step 3: Publish Your Site
- Click the Publish button (top right)
- Wait for deployment to complete
- Visit your live site
Step 4: Verify Installation
- Go to Google Analytics
- Select your GA4 property
- Navigate to Reports > Realtime
- In a new browser tab, visit your published Zyro site
- Return to GA4 Realtime - you should see your visit appear within 30 seconds
Limitations of Built-in Integration:
- Basic page view tracking only
- No custom event tracking
- Limited configuration options
- Cannot track forms, buttons, or eCommerce events
If you need more than basic tracking, use Method 2 (Custom Code) instead.
Method 2: Custom Code Integration (Recommended for Advanced Tracking)
Install GA4 using custom code for full control and advanced features.
Step 1: Get Your GA4 Tracking Code
- Go to Google Analytics
- Select your GA4 property
- Navigate to Admin (gear icon)
- Under Property, click Data Streams
- Click your Web data stream
- Click View tag instructions
- Select Install manually
- Copy the Global site tag (gtag.js) code
The code will look like this:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
Important: Copy the ENTIRE code block including both <script> tags.
Step 2: Add GA4 Code to Zyro
- Log in to your Zyro dashboard
- Select your website
- Click Settings in the left sidebar
- Scroll to Website code section
- Find the Header code field
- Paste your GA4 tracking code
- Click Save
Important Notes:
- Use Header code, not Footer code
- If you're using built-in GA4 integration, remove it first to avoid duplicate tracking
- Make sure to click Save after pasting the code
Step 3: Publish Your Site
- Click the Publish button (top right corner)
- Wait for Zyro to deploy your changes (usually 1-2 minutes)
- Visit your live site to verify
Step 4: Verify Installation
Using GA4 Realtime Reports
- Go to Google Analytics
- Select your GA4 property
- Navigate to Reports > Realtime
- In a new browser tab, visit your published Zyro site
- Return to GA4 - you should see your visit appear within 30 seconds
Using Browser Developer Tools
- Open your published Zyro site
- Press F12 to open Developer Tools
- Go to the Network tab
- Filter by
collectorgoogle-analytics - Reload the page
- Look for requests to
https://www.google-analytics.com/g/collect
If you see these requests, GA4 is working correctly.
Using Google Tag Assistant
- Install Google Tag Assistant Chrome extension
- Visit your published Zyro site
- Click the Tag Assistant icon
- Verify that GA4 tag is firing
- Check that the Measurement ID is correct
Configuration Options
Enhanced Measurement
GA4's Enhanced Measurement automatically tracks common interactions. Configure in Google Analytics:
- Go to Admin > Data Streams
- Click your web stream
- Click Enhanced measurement
- Toggle specific automatic events:
- Page views: Always enabled
- Scrolls: Tracks 90% scroll depth
- Outbound clicks: Tracks clicks to external links
- Site search: Not applicable for most Zyro sites
- Video engagement: Tracks YouTube/Vimeo videos
- File downloads: Tracks PDF and file downloads
Recommended for Zyro:
- ✓ Enable Page views (required)
- ✓ Enable Scrolls (measure engagement)
- ✓ Enable Outbound clicks (track external links)
- ✓ Enable File downloads (if you have downloadable files)
- ✓ Enable Video engagement (if you have embedded videos)
- ✗ Disable Site search (most Zyro sites don't have search)
Custom Configuration Parameters
Modify the gtag('config') call to customize GA4 behavior:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX', {
'cookie_domain': 'yourdomain.com',
'cookie_expires': 63072000, // 2 years in seconds
'anonymize_ip': true,
'send_page_view': true
});
</script>
Useful parameters for Zyro:
cookie_domain: Set to your custom domaincookie_expires: Cookie lifetime (default is 2 years)anonymize_ip: Anonymize IP addresses for privacy (GDPR)send_page_view: Control automatic page view tracking
Debug Mode
Enable debug mode to see GA4 events in real-time during testing:
<script>
gtag('config', 'G-XXXXXXXXXX', {
'debug_mode': true
});
</script>
View events in Admin > DebugView in GA4.
Remember: Remove debug_mode: true before going to production.
Zyro-Specific Considerations
AI Website Builder
Zyro's AI tools create consistent page structures:
- Consistent HTML: Similar pages have similar structure
- Template-based: All pages follow the same template
- Element classes: Zyro uses consistent class names (
.zyro-button,.zyro-form, etc.) - Responsive: Mobile tracking works automatically
Dashboard Navigation
Access tracking settings through clear paths:
Zyro Dashboard → Select Website → Settings → Website code → Header code
Or for built-in integration:
Zyro Dashboard → Select Website → Settings → Integrations → Google Analytics
Multiple Pages
Zyro supports multi-page websites:
- GA4 tracks each page automatically
- Page URLs are tracked correctly
- Page titles appear in reports
- Navigation between pages is tracked
Custom Domains
GA4 works on both Zyro subdomains and custom domains:
- Zyro subdomain:
yoursite.zyro.space(works immediately) - Custom domain:
yourdomain.com(works after DNS setup)
If using a custom domain, ensure it's properly connected before testing.
Mobile-First Design
Zyro templates are mobile-responsive:
- Same tracking code works on all devices
- GA4 automatically detects device type
- Test on mobile devices
- Most Zyro traffic is mobile
Performance Impact
GA4 is lightweight and loads asynchronously:
- Baseline: Zyro sites are fast (good PageSpeed scores)
- GA4 impact: Minimal (~5-10KB), loads asynchronously
- Total impact: Usually <0.1s additional load time
- Recommendation: GA4 is worth the minimal performance cost
Troubleshooting
GA4 Not Tracking
Problem: No data appears in GA4 Realtime reports.
Solutions:
- Verify paid plan: Ensure you have Unleash, eCommerce, or eCommerce Plus plan
- Check site is published: GA4 only works on published sites, NOT preview
- Verify Measurement ID: Format must be
G-XXXXXXXXXX(not UA- or GTM-) - Check code placement: Code should be in Header code, not Footer
- Remove duplicates: Don't use both built-in integration AND custom code
- Clear cache: Hard reload browser (Ctrl+Shift+R)
- Disable ad blockers: Test with ad blockers disabled
- Wait 24-48 hours: Standard reports can take up to 48 hours to populate
Tracking Works on Zyro Subdomain But Not Custom Domain
Problem: GA4 works on yoursite.zyro.space but not yourdomain.com.
Solutions:
- Wait for DNS propagation: Custom domains can take 24-48 hours
- Verify domain connection: Check custom domain is properly connected in Zyro
- Update cookie domain: Set
cookie_domainparameter in GA4 config - Clear browser cache: Hard refresh on custom domain
- Test in incognito: Use private browsing to avoid cache issues
Duplicate Tracking
Problem: Seeing double page views in GA4.
Causes:
- GA4 installed via both built-in integration AND custom code
- GA4 in both GTM and direct installation
Solutions:
- Check built-in integration: Remove GA4 from Settings → Integrations
- Check custom code: Search Header code for duplicate GA4 snippets
- Check GTM: If using GTM, remove direct GA4 installation
- Choose one method: Either built-in OR custom code OR GTM, not multiple
Events Not Appearing in GA4
Problem: Page views work, but custom events don't appear.
Solutions:
- Check event syntax: Ensure proper
gtag('event', 'event_name')format - Wait for processing: Events can take a few minutes to appear in Realtime
- Use DebugView: Enable debug mode to see events immediately
- Check JavaScript errors: Open browser console (F12) and look for errors
- Verify Enhanced Measurement: Some events require Enhanced Measurement to be enabled
Advanced Setup
Consent Mode
Implement cookie consent before loading GA4:
<!-- Add to Header code BEFORE GA4 code -->
<script>
// Set default consent state
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
'analytics_storage': 'denied',
'ad_storage': 'denied'
});
// Update consent when user accepts
function grantConsent() {
gtag('consent', 'update', {
'analytics_storage': 'granted',
'ad_storage': 'granted'
});
}
</script>
<!-- Then load GA4 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
Call grantConsent() when user accepts cookies.
User ID Tracking
Track logged-in users across sessions:
<script>
// Set user ID (if you have user authentication)
gtag('config', 'G-XXXXXXXXXX', {
'user_id': 'USER_ID_HERE'
});
</script>
Privacy note: Only use User ID tracking with proper consent and privacy disclosures.
Custom Dimensions
Set custom dimensions for Zyro-specific data:
<script>
gtag('config', 'G-XXXXXXXXXX', {
'custom_map': {
'dimension1': 'site_type',
'dimension2': 'template_name'
}
});
// Send custom dimension data
gtag('event', 'page_view', {
'site_type': 'business',
'template_name': 'modern_portfolio'
});
</script>
Configure custom dimensions in Admin > Custom Definitions in GA4 first.
Privacy and Compliance
GDPR Compliance
For EU visitors:
- Obtain consent before loading GA4
- Anonymize IP addresses: Set
anonymize_ip: true - Update privacy policy: Disclose GA4 usage
- Implement consent banner: Use a cookie consent solution
- Configure data retention: Set appropriate retention in GA4 (Admin > Data Retention)
CCPA Compliance
For California visitors:
- Provide opt-out mechanism: Allow users to opt out of tracking
- Update privacy policy: Disclose data collection practices
- Honor opt-out requests: Respect user preferences
Next Steps
- Configure Custom Event Tracking to track forms, links, and interactions
- Install Google Tag Manager for advanced tag management
- Troubleshoot Tracking Issues if events aren't working
- Optimize Performance to maintain fast loading times