Google Analytics 4 Setup on Wix | Blue Frog Docs

Google Analytics 4 Setup on Wix

Complete guide to installing and configuring Google Analytics 4 on Wix websites.

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

The easiest method with no coding required. Best for standard tracking implementations.

Step-by-Step Installation

  1. Access Marketing Integrations

    • Log in to your Wix dashboard
    • Navigate to Marketing & SEOMarketing Integrations
  2. Add Google Analytics

    • Click See More Tools
    • Find Google Analytics in the list
    • Click Connect
  3. Configure the Integration

    • Select Google Analytics 4 (not Universal Analytics)
    • Enter your Measurement ID (G-XXXXXXXXXX)
    • Click Save & Enable
  4. 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

Method 2: Custom Code Installation

Use this method when you need more control over GA4 configuration or custom tracking.

Step-by-Step Installation

  1. Access Custom Code Settings

    • Wix Dashboard → SettingsCustom Code
    • Click + Add Custom Code
  2. 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>
  1. Configure Code Placement

    • Load code on: All pages
    • Place code in: Head
    • Load code once: Checked (important!)
  2. Handle Consent (if required)

    • Under GDPR Settings, configure consent requirements
    • Or implement consent mode manually (see below)
  3. Save and Publish

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:

  1. 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)
  2. 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)
  3. Code Execution Context

    • Custom code runs in a sandboxed environment
    • Some browser APIs may be restricted
    • Cannot access Wix's internal site structure directly

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

  1. Dashboard → Analytics & Reports
  2. Click Settings (gear icon)
  3. Select Google Analytics
  4. Click Connect and authorize your Google account
  5. 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

  1. Open Google Analytics → ReportsRealtime
  2. Visit your Wix site in an incognito window
  3. Verify you appear in the realtime report
  4. Navigate to different pages to confirm page tracking

Using Google Tag Assistant (Chrome Extension)

  1. Install Tag Assistant Legacy
  2. Navigate to your Wix site
  3. Click the Tag Assistant icon
  4. Verify GA4 tag is detected and firing

Using Browser Developer Tools

  1. Open DevTools (F12)
  2. Go to Network tab
  3. Filter by "collect" or "analytics"
  4. Look for requests to www.google-analytics.com/g/collect
  5. 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

  1. Choose ONE installation method to avoid duplicate tracking
  2. Test thoroughly before publishing changes
  3. Document your implementation for team members
  4. Set up custom events for important user interactions
  5. Configure data retention settings in GA4
  6. Enable Google Signals (if using custom code method)
  7. Create a measurement plan before implementing

Next Steps

Additional Resources

// SYS.FOOTER