Wix Tracking Events Not Firing | Blue Frog Docs

Wix Tracking Events Not Firing

Troubleshoot analytics and marketing pixel events not firing on Wix websites.

Wix Tracking Events Not Firing

This guide helps diagnose and fix issues with analytics events not tracking properly on Wix, including GA4, GTM, Meta Pixel, and other marketing pixels.

Quick Diagnostic Checklist

Before diving deep, verify these basics:

  • Changes are published (not just saved in editor)
  • Testing in incognito mode (ad blockers disabled)
  • Correct tracking ID is used
  • Only ONE installation method per tool
  • Browser console shows no JavaScript errors
  • Testing on live site (not editor preview)

Common Causes by Platform

Google Analytics 4

Issue Cause Quick Fix
No pageviews GA4 not installed or not published Verify installation, publish site
Pageviews only on first page SPA navigation not tracked Implement wixLocation.onChange tracking
Events not in reports Waiting for processing Wait 24-48 hours, check Realtime reports
Duplicate events Multiple installations Remove duplicate tracking code

Google Tag Manager

Issue Cause Quick Fix
Container not loading GTM code not published Verify custom code is published
Tags not firing Trigger misconfigured Check GTM Preview mode
Variables empty Timing issue / wrong variable type Use built-in variables or add delays
Preview won't connect Browser blocking Disable extensions, use incognito

Meta Pixel

Issue Cause Quick Fix
Pixel not detected Pixel code not published Verify custom code or Marketing Integration
PageView only Custom events not implemented Add event tracking code with Velo
Purchase not firing Order ID not passed Check thank you page URL parameters
Duplicate events Multiple pixel installations Use only one method

Step-by-Step Debugging

Step 1: Verify Installation

Check if tracking code is present:

  1. Open browser DevTools (F12)
  2. Console tab → Run:
// Check for GA4
console.log('GA4:', typeof gtag);
console.log('dataLayer:', window.dataLayer);

// Check for GTM
console.log('GTM:', window.google_tag_manager);

// Check for Meta Pixel
console.log('Meta:', typeof fbq);
console.log('Meta Pixel ID:', fbq?.getState?.());

Expected results:

  • GA4: gtag: "function"
  • GTM: Object with container ID
  • Meta: fbq: "function"

If undefined:

  • Code not installed, or
  • Code not published, or
  • Ad blocker is active

Step 2: Check Network Requests

Monitor tracking beacons:

  1. DevToolsNetwork tab

  2. Filter requests:

    • GA4: Filter by collect or google-analytics.com
    • GTM: Filter by googletagmanager.com
    • Meta: Filter by facebook.com/tr
  3. Perform action (page navigation, button click)

  4. Look for requests with 200 status

If no requests appear:

  • Event not firing from code
  • Tracking script blocked
  • Trigger conditions not met

Step 3: Use Vendor Debug Tools

Google Analytics:

  1. Add to URL: ?debug_mode=true
  2. Or enable in tag:
    gtag('config', 'G-XXXXXXXXXX', { 'debug_mode': true });
    
  3. Check GA4 → AdminDebugView

Google Tag Manager:

  1. GTM → Preview button
  2. Enter Wix site URL
  3. Click Connect
  4. Debug panel shows tags firing

Meta Pixel:

  1. Install Meta Pixel Helper
  2. Visit your site
  3. Click extension icon
  4. Verify pixel and events

Wix-Specific Issues

Issue 1: SPA Navigation Not Tracked

Problem: Pageviews only fire on initial load, not on navigation.

Why: Wix uses AJAX for smooth transitions, which don't trigger default pageview tracking.

Solution (GA4):

// File: Site Code (Global)
import wixLocation from 'wix-location';

let lastPath = wixLocation.path.join('/');

wixLocation.onChange(() => {
  const currentPath = wixLocation.path.join('/');

  if (currentPath !== lastPath) {
    lastPath = currentPath;

    if (window.gtag) {
      gtag('event', 'page_view', {
        page_location: wixLocation.url,
        page_path: currentPath,
        page_title: document.title
      });
    }
  }
});

Solution (Meta Pixel):

import wixLocation from 'wix-location';

let lastPath = wixLocation.path.join('/');

wixLocation.onChange(() => {
  const currentPath = wixLocation.path.join('/');

  if (currentPath !== lastPath) {
    lastPath = currentPath;

    if (window.fbq) {
      fbq('track', 'PageView');
    }
  }
});

Solution (GTM):

See GTM setup guide for history change listener implementation.

Issue 2: Code Loads Too Late

Problem: Custom code runs after user interacts with page.

Why: Wix loads platform code first, then custom code.

Solution:

Option 1: Move code to head (if not already there)

  • Settings → Custom Code → Place code in: Head

Option 2: Use DOMContentLoaded

document.addEventListener('DOMContentLoaded', function() {
  // Your tracking code here
});

Option 3: Check for element ready

function waitForElement(selector, callback) {
  if (document.querySelector(selector)) {
    callback();
  } else {
    setTimeout(() => waitForElement(selector, callback), 100);
  }
}

waitForElement('#myButton', function() {
  // Now safe to attach tracking
});

Issue 3: Velo Code Not Executing

Problem: Page code or site code doesn't run.

Why: Velo not enabled, code errors, or scope issues.

Solutions:

Check if Velo is enabled:

  1. Editor → Dev Mode toggle
  2. Or use Wix Studio (Velo built-in)

Check for code errors:

  1. Editor → Developer Tools (Ctrl+Shift+D)
  2. Console tab → Look for red errors

Verify code scope:

  • Site code → Runs on all pages
  • Page code → Runs only on that page
  • Backend code → Doesn't run in browser

Test code:

$w.onReady(function () {
  console.log('Page code running');
  console.log('Current URL:', wixLocation.url);
});

Issue 4: GTM Variables Return Undefined

Problem: GTM variables show undefined in preview.

Why: Variable timing or type mismatch.

Solutions:

Check variable type:

  • Use Data Layer Variable for dataLayer values
  • Use JavaScript Variable for window objects
  • Use Custom JavaScript for functions

Add delay for dynamic content:

// In GTM Custom JavaScript Variable
function() {
  // Wait for value to be available
  var checkValue = function() {
    if (window.myValue) {
      return window.myValue;
    }
    return undefined;
  };
  return checkValue();
}

Use GTM built-in variables:

  • Page URL → Use \{\{Page Path\}\}
  • Page Title → Use \{\{Page Title\}\}
  • Referrer → Use \{\{Referrer\}\}

Issue 5: Events Fire on Editor, Not Live Site

Problem: Tracking works in editor preview, fails on published site.

Why: Editor and live site are different environments.

Solutions:

  1. Always test on live site

    • Publish changes
    • Test on actual domain
    • Use incognito to avoid cache
  2. Check for conditional code:

    // BAD: Only runs in editor
    if (wixWindow.rendering.env === 'editor') {
      trackEvent();
    }
    
    // GOOD: Runs on live site
    if (wixWindow.rendering.env === 'browser') {
      trackEvent();
    }
    
  3. Verify custom code publication:

    • Settings → Custom Code
    • Check that "Load code on: All pages" is set
    • Re-publish site

Issue 6: Ecommerce Events Missing

Problem: Product or purchase events don't fire.

Why: Wix Stores data not accessible, or timing issue.

Solutions:

Check Wix Stores is enabled:

  • DashboardBusiness & Site → Wix Stores

Verify API access:

import wixStoresFrontend from 'wix-stores-frontend';

$w.onReady(async function () {
  try {
    const product = await wixStoresFrontend.product.getProduct();
    console.log('Product loaded:', product);
  } catch (error) {
    console.error('Cannot access product:', error);
  }
});

For purchase tracking:

  • Ensure thank you page receives orderId parameter
  • Check URL: ...thank-you?orderId=xxx
  • Implement backend order retrieval (see ecommerce guide)

Issue 7: Duplicate Events

Problem: Events fire multiple times.

Why: Multiple tracking implementations.

Solutions:

Audit all tracking installations:

  1. Settings → Custom Code (check for scripts)
  2. Marketing & SEO → Marketing Integrations (check for native integrations)
  3. GTM → Check for duplicate tags
  4. Page code → Check for redundant tracking

Remove duplicates:

  • Use ONLY ONE installation method:
    • Marketing Integration, OR
    • Custom Code, OR
    • GTM
  • Not multiple!

Deduplicate in code:

// Use flag to prevent duplicate tracking
if (window.eventTracked) return;
window.eventTracked = true;

// Track event
gtag('event', 'purchase', {...});

Testing Methodology

1. Systematic Testing

Test procedure:

  1. Clear cache and cookies
  2. Open incognito window
  3. Open DevTools before loading page
  4. Navigate to page
  5. Perform action (click button, submit form)
  6. Check:
    • Console for errors
    • Network for tracking requests
    • Vendor debugger for events

2. Use Test Cases

Create test checklist:

Page Load Tests:
- [ ] Homepage pageview fires
- [ ] Product page pageview fires
- [ ] Navigation to another page fires pageview

Event Tests:
- [ ] Add to cart fires
- [ ] Form submission fires
- [ ] Button click fires
- [ ] Purchase fires (use test order)

Data Validation:
- [ ] Correct tracking ID in requests
- [ ] Event parameters populated
- [ ] User ID passed (if applicable)

3. Monitor in Real-Time

Use real-time reports:

GA4:

  • Reports → Realtime
  • Should show activity within seconds

GTM:

  • Use Preview mode
  • Shows tags as they fire

Meta:

  • Events Manager → Test Events
  • Enter your URL to monitor

Common Error Messages

Console Errors

Error Meaning Solution
gtag is not defined GA4 not loaded Check installation, publish site
fbq is not defined Meta Pixel not loaded Verify pixel code installation
Cannot read property 'push' of undefined dataLayer not initialized Initialize before GTM: `window.dataLayer = window.dataLayer
wix-stores-frontend module not found Wix Stores not enabled Enable Wix Stores in dashboard
CORS policy blocked Cross-origin issue Use proper API endpoints

Network Errors

Status Meaning Solution
404 Resource not found Check tracking ID, verify URL
403 Forbidden Check API credentials, permissions
0 (canceled) Ad blocker Test in incognito without extensions
ERR_BLOCKED_BY_CLIENT Extension blocking Disable ad blockers for testing

Platform-Specific Debugging

Google Analytics 4 Debugging

Enable debug mode:

gtag('config', 'G-XXXXXXXXXX', {
  'debug_mode': true
});

Check DebugView:

  • GA4 → Admin → DebugView
  • Should show events within seconds

Common GA4 issues:

  1. Events not in reports but in DebugView

    • Why: Processing lag
    • Solution: Wait 24-48 hours
  2. Measurement ID wrong format

    • Why: Using UA- instead of G-
    • Solution: Use GA4 property (G-XXXXXXXXXX)
  3. Events with invalid parameters

    • Why: Parameter names don't match GA4 spec
    • Solution: Use recommended parameter names

Google Tag Manager Debugging

Preview mode checklist:

  1. Connection issues:

    • Clear browser cache
    • Disable browser extensions
    • Try different browser
    • Check firewall/VPN settings
  2. Tags not firing:

    • Check trigger conditions
    • Verify variable values
    • Review tag firing priority
    • Check exception triggers
  3. Data layer issues:

    • Use Data Layer tab in debugger
    • Verify object structure
    • Check event names (case-sensitive)

Debug GTM tag:

// Add console log to Custom HTML tag
<script>
console.log('GTM Tag Fired:', {
  'Variable 1': {{Variable 1}},
  'Variable 2': {{Variable 2}}
});
</script>

Meta Pixel Debugging

Use Pixel Helper:

  • Shows which events fire
  • Displays event parameters
  • Indicates errors

Common Meta Pixel issues:

  1. Pixel found but no events:

    • fbq('init') present but no fbq('track')
    • Add event tracking code
  2. Incorrect parameters:

    • Check parameter names match Meta docs
    • Use content_ids (array), not content_id
  3. Events delayed:

    • Check Events Manager after 5-10 minutes
    • Browser pixel can lag vs. CAPI

Test with Meta Test Events:

  1. Events Manager → Test Events
  2. Enter website URL
  3. Browse site and verify events appear

Checklist: Event Not Firing

Work through this in order:

  1. Installation

    • Tracking code added to site
    • Code is in correct location (head/body/page)
    • Site is published (not just saved)
  2. Code Syntax

    • No JavaScript errors in console
    • Correct tracking ID format
    • Proper function calls (gtag, fbq, dataLayer.push)
  3. Triggers

    • Event trigger actually occurs (button clicked, page loaded)
    • Element selectors are correct
    • Trigger conditions are met
  4. Timing

    • Code loads before event fires
    • DOM elements available when code runs
    • No race conditions
  5. Environment

    • Testing on live site (not editor)
    • Using incognito mode
    • Ad blockers disabled
    • HTTPS (not HTTP)
  6. Data Validation

    • Event name spelled correctly
    • Parameters in correct format
    • Values are not null/undefined

Getting Additional Help

Wix Support

For platform issues:

Vendor Support

For tool-specific issues:

Community Resources

  • Stack Overflow (tag: wix, google-analytics-4, etc.)
  • Wix Forum
  • Reddit r/wix

Provide When Asking for Help

  1. Wix plan and editor type (Wix Editor vs Studio)
  2. Tracking tool and version (GA4, GTM, Meta Pixel)
  3. Installation method (Marketing Integration, Custom Code, GTM)
  4. Console errors (screenshot or copy)
  5. Network tab showing requests (or lack thereof)
  6. Steps to reproduce

Prevention Best Practices

  1. Test before publishing

    • Use vendor preview modes
    • Check console for errors
    • Verify network requests
  2. Document your implementation

    • Track what's installed and how
    • Note any custom code locations
    • Keep change log
  3. Single source of truth

    • One installation method per tool
    • No duplicate tracking
  4. Regular audits

    • Monthly: Check analytics for anomalies
    • Quarterly: Full tracking review
    • After site changes: Re-test tracking
  5. Monitor continuously

Next Steps

Additional Resources

// SYS.FOOTER