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:
- Open browser DevTools (F12)
- 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:
DevTools → Network tab
Filter requests:
- GA4: Filter by
collectorgoogle-analytics.com - GTM: Filter by
googletagmanager.com - Meta: Filter by
facebook.com/tr
- GA4: Filter by
Perform action (page navigation, button click)
Look for requests with 200 status
If no requests appear:
Step 3: Use Vendor Debug Tools
- Add to URL:
?debug_mode=true - Or enable in tag:
gtag('config', 'G-XXXXXXXXXX', { 'debug_mode': true }); - Check GA4 → Admin → DebugView
- GTM → Preview button
- Enter Wix site URL
- Click Connect
- Debug panel shows tags firing
Meta Pixel:
- Install Meta Pixel Helper
- Visit your site
- Click extension icon
- 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:
- Editor → Dev Mode toggle
- Or use Wix Studio (Velo built-in)
Check for code errors:
- Editor → Developer Tools (Ctrl+Shift+D)
- 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:
Always test on live site
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(); }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:
- Dashboard → Business & 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
orderIdparameter - 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:
- Settings → Custom Code (check for scripts)
- Marketing & SEO → Marketing Integrations (check for native integrations)
- GTM → Check for duplicate tags
- 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:
- Clear cache and cookies
- Open incognito window
- Open DevTools before loading page
- Navigate to page
- Perform action (click button, submit form)
- 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:
Events not in reports but in DebugView
- Why: Processing lag
- Solution: Wait 24-48 hours
Measurement ID wrong format
- Why: Using UA- instead of G-
- Solution: Use GA4 property (G-XXXXXXXXXX)
Events with invalid parameters
- Why: Parameter names don't match GA4 spec
- Solution: Use recommended parameter names
Google Tag Manager Debugging
Preview mode checklist:
Connection issues:
- Clear browser cache
- Disable browser extensions
- Try different browser
- Check firewall/VPN settings
Tags not firing:
- Check trigger conditions
- Verify variable values
- Review tag firing priority
- Check exception triggers
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:
Pixel found but no events:
fbq('init')present but nofbq('track')- Add event tracking code
Incorrect parameters:
- Check parameter names match Meta docs
- Use
content_ids(array), notcontent_id
Events delayed:
- Check Events Manager after 5-10 minutes
- Browser pixel can lag vs. CAPI
Test with Meta Test Events:
- Events Manager → Test Events
- Enter website URL
- Browse site and verify events appear
Checklist: Event Not Firing
Work through this in order:
Installation
- Tracking code added to site
- Code is in correct location (head/body/page)
- Site is published (not just saved)
Code Syntax
- No JavaScript errors in console
- Correct tracking ID format
- Proper function calls (gtag, fbq, dataLayer.push)
Triggers
- Event trigger actually occurs (button clicked, page loaded)
- Element selectors are correct
- Trigger conditions are met
Timing
- Code loads before event fires
- DOM elements available when code runs
- No race conditions
Environment
Data Validation
- Event name spelled correctly
- Parameters in correct format
- Values are not null/undefined
Getting Additional Help
Wix Support
For platform issues:
- Wix Support Center
- Wix Help (in dashboard for Premium users)
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
- Wix plan and editor type (Wix Editor vs Studio)
- Tracking tool and version (GA4, GTM, Meta Pixel)
- Installation method (Marketing Integration, Custom Code, GTM)
- Console errors (screenshot or copy)
- Network tab showing requests (or lack thereof)
- Steps to reproduce
Prevention Best Practices
Test before publishing
- Use vendor preview modes
- Check console for errors
- Verify network requests
Document your implementation
- Track what's installed and how
- Note any custom code locations
- Keep change log
Single source of truth
- One installation method per tool
- No duplicate tracking
Regular audits
- Monthly: Check analytics for anomalies
- Quarterly: Full tracking review
- After site changes: Re-test tracking
Monitor continuously
- Set up alerts in GA4 for traffic drops
- Check Realtime reports daily
- Review Search Console for errors