Google Analytics 4 Setup on Wix
This guide covers three methods for implementing Google Analytics 4 on Wix websites, with recommendations based on your technical requirements and customization needs.
Prerequisites
Before beginning:
- Create a GA4 property in Google Analytics
- Obtain your Measurement ID (format: G-XXXXXXXXXX)
- Determine which implementation method suits your needs
Method 1: Wix Marketing Integrations (Recommended for Most Users)
The easiest method with no coding required. Best for standard tracking implementations.
Step-by-Step Installation
Access Marketing Integrations
- Log in to your Wix dashboard
- Navigate to Marketing & SEO → Marketing Integrations
Add Google Analytics
- Click See More Tools
- Find Google Analytics in the list
- Click Connect
Configure the Integration
- Select Google Analytics 4 (not Universal Analytics)
- Enter your Measurement ID (G-XXXXXXXXXX)
- Click Save & Enable
Verify Installation
- Publish your site
- Visit your live site in an incognito/private window
- Check Google Analytics Realtime report for activity
What Gets Tracked Automatically
With the native integration, Wix automatically tracks:
- Page views (including dynamic page navigation in Wix apps)
- Scroll events (90% scroll depth)
- Site search (if Wix Site Search is enabled)
- File downloads (PDF, DOC, XLS, etc.)
- Outbound link clicks
- Video engagement (for Wix Video)
Limitations of Native Integration
- No custom event tracking without Velo code
- Limited ecommerce tracking (basic only, see ecommerce guide)
- Cannot modify GA4 configuration (e.g., session timeout, custom parameters)
- No access to raw gtag.js functions
- Cannot use Google Signals or other advanced features
Method 2: Custom Code Installation
Use this method when you need more control over GA4 configuration or custom tracking.
Step-by-Step Installation
Access Custom Code Settings
- Wix Dashboard → Settings → Custom Code
- Click + Add Custom Code
Add GA4 Global Site Tag
- Name: "Google Analytics 4"
- Paste the following code:
<!-- 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', {
'send_page_view': true,
'debug_mode': false // Set to true for debugging
});
</script>
Configure Code Placement
- Load code on: All pages
- Place code in: Head
- Load code once: Checked (important!)
Handle Consent (if required)
- Under GDPR Settings, configure consent requirements
- Or implement consent mode manually (see below)
Save and Publish
Implementing Consent Mode
For GDPR compliance, add consent configuration before the config call:
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
// Default consent state
gtag('consent', 'default', {
'analytics_storage': 'denied',
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied'
});
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
// Update consent when user accepts
// (trigger this from your consent banner)
window.grantAnalyticsConsent = function() {
gtag('consent', 'update', {
'analytics_storage': 'granted'
});
};
</script>
Wix-Specific Custom Code Challenges
⚠️ Important Wix Limitations:
Page Load Timing Issues
- Custom code in the
<head>may load before Wix's framework - DOM elements may not be available immediately
- Wrap DOM-dependent code in
wixLocation.onChange()(requires Velo)
- Custom code in the
Single-Page Application Behavior
- Wix uses AJAX navigation for some page transitions
- GA4 may not track virtual pageviews automatically
- Requires Velo code to track SPA navigation (see event tracking guide)
Code Execution Context
- Custom code runs in a sandboxed environment
- Some browser APIs may be restricted
- Cannot access Wix's internal site structure directly
Method 3: Google Tag Manager (Recommended for Advanced Users)
For maximum flexibility and multiple marketing tools, install GA4 through GTM.
Benefits:
- Centralized tag management
- Version control for tracking changes
- Easy testing with preview mode
- No code deployment needed after initial GTM setup
See: GTM Setup Guide
Wix Analytics Platform Integration
Wix has its own analytics platform that can sync with GA4.
Connecting Wix Analytics to GA4
- Dashboard → Analytics & Reports
- Click Settings (gear icon)
- Select Google Analytics
- Click Connect and authorize your Google account
- Select your GA4 property
What this enables:
- View GA4 data within Wix dashboard
- Unified reporting with Wix's native analytics
- Cross-platform insights
Note: This does NOT install GA4 tracking - you still need Method 1, 2, or 3.
Verification and Testing
Using Google Analytics Realtime Reports
- Open Google Analytics → Reports → Realtime
- Visit your Wix site in an incognito window
- Verify you appear in the realtime report
- Navigate to different pages to confirm page tracking
Using Google Tag Assistant (Chrome Extension)
- Install Tag Assistant Legacy
- Navigate to your Wix site
- Click the Tag Assistant icon
- Verify GA4 tag is detected and firing
Using Browser Developer Tools
- Open DevTools (F12)
- Go to Network tab
- Filter by "collect" or "analytics"
- Look for requests to
www.google-analytics.com/g/collect - Verify your Measurement ID appears in the request
Common Setup Issues
| Issue | Cause | Solution |
|---|---|---|
| No data in Realtime | Ad blocker active | Test in incognito without extensions |
| Duplicate tracking | Multiple installations | Use ONLY one installation method |
| Missing pageviews on navigation | SPA navigation not tracked | Implement Velo tracking (see event tracking) |
| Data appears delayed | GA4 processing lag | Realtime reports are immediate; standard reports can lag 24-48 hours |
Wix Editor vs. Wix Studio Differences
Wix Editor
- Uses Marketing Integrations for GA4
- Limited custom code capabilities
- Velo can be enabled as an add-on
- Best for simple tracking needs
Wix Studio
- Full Velo integration by default
- Advanced custom code capabilities
- Better suited for complex tracking requirements
- Direct access to Wix APIs
Best Practices
- Choose ONE installation method to avoid duplicate tracking
- Test thoroughly before publishing changes
- Document your implementation for team members
- Set up custom events for important user interactions
- Configure data retention settings in GA4
- Enable Google Signals (if using custom code method)
- Create a measurement plan before implementing
Next Steps
- Configure Wix-specific event tracking
- Set up ecommerce tracking for Wix Stores
- Troubleshoot tracking issues