How to Fix Site123 Tracking Events Not Firing | OpsBlu Docs

How to Fix Site123 Tracking Events Not Firing

Fix GA4, GTM, and pixel events not firing on Site123 — code injection settings, publish-vs-preview mode issues, and built-in integration debugging

When tracking events don't fire on your Site123 website, conversions go untracked and data is lost. This guide helps you diagnose and fix common tracking issues.

Quick Diagnostic Checklist

Before diving into specific issues, run through this checklist:

  • Code saved in Site123 code injection settings
  • Site published (not just preview mode)
  • Testing on published site, not preview
  • Browser cache cleared or testing in incognito
  • Ad blockers disabled for testing
  • No JavaScript errors in browser console
  • Correct tracking IDs used (Measurement ID, Pixel ID, Container ID)
  • Scripts in correct injection location (head, body, footer)

Site123-Specific Issues

Code Injection Not Saved

Symptom: Scripts don't appear in page source.

Cause: Code injection changes not saved or not published.

Diagnosis:

  1. View page source (Ctrl+U or right-click → View Page Source)
  2. Search for your tracking code (Ctrl+F → search for "gtag", "fbq", or "GTM")
  3. If not found, code isn't on page

Fix:

  1. Go to Site123 Settings
    • Manage → Settings → Advanced Settings → Code Injection
  2. Verify code is present in correct section (head, body, footer)
  3. Click Save explicitly
  4. Publish your site (not just save)
  5. Wait 5-10 minutes for changes to propagate
  6. Clear cache and test again

Preview Mode vs. Published Site

Symptom: Tracking works in preview but not on live site (or vice versa).

Cause: Site123 preview and published sites can behave differently.

Fix:

  1. Always test on published site for final verification
  2. Publish changes before testing tracking
  3. Use your actual domain (not Site123 preview URL)
  4. Clear browser cache after publishing
  5. Wait a few minutes after publishing for CDN update

Testing URLs:

  • ✗ Wrong: preview.site123.com/yoursite
  • ✓ Correct: www.yoursite.com (published domain)

Code in Wrong Injection Location

Symptom: Scripts don't load or load at wrong time.

Cause: Code placed in incorrect injection area.

Site123 Code Injection Areas:

Head Code:

  • GA4 gtag.js base code
  • GTM head snippet
  • Meta Pixel base code
  • Critical CSS
  • Preconnect links

Body Code:

  • GTM noscript snippet
  • Custom HTML content
  • Above-fold scripts

Footer Code:

Fix:

  1. Move base tracking codes to Head (GA4, GTM, Meta Pixel)
  2. Move event tracking to Body or Footer
  3. Keep noscript tags in Body
  4. Test after reorganizing

Google Analytics 4 Issues

GA4 Events Not Appearing in Realtime

Symptom: No events in GA4 Realtime report.

Diagnosis Steps:

  1. Check if gtag is loaded

    // In browser console (F12)
    console.log(typeof gtag);
    // Should output "function"
    
  2. Verify Measurement ID

    • View page source
    • Find gtag config line
    • Verify format: G-XXXXXXXXXX
    • Confirm ID matches GA4 property
  3. Check for JavaScript errors

    • Open console (F12)
    • Look for red error messages
    • Fix any JavaScript errors
  4. Test with GA Debugger

    • Install GA Debugger
    • Enable extension
    • Reload page
    • Check console for GA debug messages

Common Fixes:

Wrong Measurement ID

Problem:

gtag('config', 'UA-XXXXXXXXX'); // Old Universal Analytics ID

Fix:

gtag('config', 'G-XXXXXXXXXX'); // Correct GA4 Measurement ID

GA4 IDs start with G-, not UA-.

Script Blocked by Ad Blocker

Problem: Ad blockers block googletagmanager.com.

Fix:

  • Disable ad blockers for testing
  • Test in incognito mode
  • Inform users about ad blockers affecting site functionality (optional)
  • Consider server-side tracking for critical events (advanced)

gtag Not Defined

Problem:

// Error: gtag is not defined
gtag('event', 'form_submit');

Fix: Ensure GA4 base code loads first:

<!-- In Head Code - must be first -->
<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>

<!-- Then in Body/Footer Code - event tracking -->
<script>
  document.addEventListener('DOMContentLoaded', function() {
    // Now gtag is defined
    gtag('event', 'form_submit');
  });
</script>

GA4 Events Fire But Wrong Parameters

Symptom: Events appear but data is incorrect.

Diagnosis: Check GA4 DebugView:

  1. GA4 → Admin → DebugView
  2. Enable debug mode: Add debug_mode: true to config
  3. View event parameters in DebugView

Common Issues:

String Instead of Number:

// Wrong
gtag('event', 'purchase', {
  value: "$99.99" // String with $
});

// Correct
gtag('event', 'purchase', {
  value: 99.99 // Number without currency symbol
});

Wrong Currency Format:

// Wrong
gtag('event', 'purchase', {
  currency: 'US Dollars'
});

// Correct
gtag('event', 'purchase', {
  currency: 'USD' // ISO 4217 code
});

Meta Pixel Issues

Meta Pixel Not Loading

Symptom: Pixel Helper shows no pixel detected.

Diagnosis Steps:

  1. Install Pixel Helper

  2. Check if fbq is defined

    // In console
    console.log(typeof fbq);
    // Should output "function"
    
  3. View page source

    • Look for Meta Pixel code
    • Verify Pixel ID (15-16 digits)
  4. Check Network requests

    • DevTools → Network tab
    • Filter: "facebook.com"
    • Look for requests to facebook.com/tr

Common Fixes:

Wrong Pixel ID

Problem:

fbq('init', '123456789'); // Too short
fbq('init', 'YOUR_PIXEL_ID'); // Placeholder not replaced

Fix:

fbq('init', '1234567890123456'); // Correct: 15-16 digits

Pixel Code Not in Head

Problem: Pixel in footer loads too late.

Fix: Move to Head Code injection:

<!-- In Head Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');

fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>

Script Blocked

Problem: Ad blockers or browser privacy features block Facebook pixel.

Fix:

  • Test in incognito without extensions
  • Test in different browser
  • Check browser privacy settings (Firefox Enhanced Tracking Protection, etc.)

Meta Pixel Events Not Firing

Symptom: PageView works but custom events don't.

Diagnosis: Check Events Manager Test Events:

  1. Meta Events Manager → Test Events
  2. Enter your Site123 URL
  3. Trigger event on your site
  4. Watch for event in Test Events

Common Issues:

Event Code After Form Submission

Problem: Form submits and reloads before event sends.

Fix: Prevent default or use callback:

document.querySelector('form').addEventListener('submit', function(e) {
  e.preventDefault(); // Stop default submission

  // Send event
  fbq('track', 'Lead', {}, function() {
    // Submit form after event sent
    this.submit();
  }.bind(this));
});

Wrong Element Selector

Problem: Can't find button/form to track.

Diagnosis:

// Test selector in console
console.log(document.querySelector('.your-selector'));
// Should show element, not null

Fix: Inspect element and use correct selector:

// Be more specific or use broader selector
document.querySelectorAll('form').forEach(function(form) {
  // Tracks ALL forms
});

Google Tag Manager Issues

GTM Container Not Loading

Symptom: GTM Preview won't connect or no tags fire.

Diagnosis Steps:

  1. Check if GTM loaded

    // In console
    console.log(window.google_tag_manager);
    // Should show object with container info
    
  2. Verify Container ID

    • View page source
    • Look for GTM-XXXXXXX
    • Confirm matches your GTM account
  3. Check both snippets present

    • Head snippet: In <head> section
    • Body snippet: After <body> tag

Common Fixes:

Missing Noscript Snippet

Problem: Only head snippet added, no noscript in body.

Fix: Add both snippets:

<!-- In Head Code -->
<script>(function(w,d,s,l,i){...})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>

<!-- In Body Code -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

Wrong Container ID

Problem:

// Container ID from different account
'GTM-XXXXXXX' // Doesn't match your account

Fix: Get correct ID from GTM:

  1. GTM → Admin → Container Settings
  2. Copy Container ID
  3. Replace in both snippets

GTM Tags Not Firing

Symptom: GTM loaded but specific tags don't fire.

Diagnosis: Use GTM Preview Mode:

  1. GTM → Preview
  2. Enter Site123 URL
  3. Check Tag Assistant
  4. See which tags fire/don't fire

Common Issues:

Trigger Conditions Not Met

Problem: Trigger looking for element that doesn't exist.

Fix: Verify trigger conditions:

  • Check element selectors are correct
  • Test conditions match actual page
  • Use built-in variables for debugging

Tag Sequencing Error

Problem: Tag tries to fire before dependent tag loads.

Fix: Set up tag sequencing:

  1. Tag → Advanced Settings → Tag Sequencing
  2. Set "Fire before/after" rules
  3. Ensure base tags load first

Container Not Published

Problem: Changes saved but not published in GTM.

Fix:

  1. GTM → Submit (top right)
  2. Add version name
  3. Click Publish
  4. Test again after 5 minutes

Form Tracking Issues

Contact Forms Not Tracked

Symptom: Form submissions don't trigger tracking events.

Diagnosis:

  1. Check if form exists when script runs

    console.log(document.querySelector('form'));
    // Should show form element
    
  2. Test form submission in console

    document.querySelector('form').addEventListener('submit', function() {
      console.log('Form submitted!');
    });
    // Submit form and check if message appears
    

Common Fixes:

Script Runs Before Form Loads

Problem: Script runs before Site123 loads form.

Fix: Wrap in DOMContentLoaded:

document.addEventListener('DOMContentLoaded', function() {
  // Now Site123 forms are loaded
  const forms = document.querySelectorAll('form');

  forms.forEach(function(form) {
    form.addEventListener('submit', function(e) {
      gtag('event', 'form_submission');
    });
  });
});

Site123 Uses AJAX Forms

Problem: Site123 form submits via AJAX, no standard submit event.

Fix: Track button click instead:

document.addEventListener('DOMContentLoaded', function() {
  const submitButtons = document.querySelectorAll('button[type="submit"], input[type="submit"]');

  submitButtons.forEach(function(button) {
    button.addEventListener('click', function() {
      gtag('event', 'form_attempt');
    });
  });
});

Element Selector Issues

Can't Find Page Elements

Symptom: querySelector returns null.

Diagnosis:

// Test in console after page loads
console.log(document.querySelector('.your-class'));
// null = not found

Common Causes:

  • Element doesn't exist on page
  • Wrong class/ID name
  • Element loads after script runs
  • Site123 uses different classes than expected

Fixes:

Wait for Element to Exist

function waitForElement(selector, callback) {
  const element = document.querySelector(selector);

  if (element) {
    callback(element);
  } else {
    setTimeout(function() {
      waitForElement(selector, callback);
    }, 100);
  }
}

waitForElement('form', function(form) {
  // Form exists, add tracking
  form.addEventListener('submit', function() {
    gtag('event', 'form_submit');
  });
});

Use More Generic Selectors

// Instead of specific class that may not exist
document.querySelector('.site123-contact-form-v2-2024')

// Use generic selector
document.querySelector('form')
// Or
document.querySelectorAll('form') // All forms

Inspect Actual Element

  1. Right-click element → Inspect
  2. Note actual class names and IDs
  3. Use those in your selectors

Duplicate Events

Events Fire Multiple Times

Symptom: Same event tracked 2-3 times for single action.

Causes:

  • Multiple tracking implementations
  • Event listener added multiple times
  • Code in multiple injection areas

Diagnosis:

// Check for multiple GTM containers
console.log(Object.keys(window.google_tag_manager || {}));

// Check for multiple GA4 configs
console.log(window.dataLayer);
// Look for multiple 'config' entries

Fixes:

Remove Duplicate Implementations

Check:

  • Head code injection
  • Body code injection
  • Footer code injection
  • GTM container
  • Page-specific code

Fix: Keep only ONE implementation:

  • If using GTM, remove direct GA4/Meta Pixel codes
  • If using direct codes, don't also use GTM for same tracking
  • Remove code from multiple injection areas

Prevent Multiple Event Listeners

// Bad - adds listener every time script runs
button.addEventListener('click', trackClick);

// Good - adds listener only once
button.addEventListener('click', trackClick, { once: true });

// Or use flag
let tracked = false;
button.addEventListener('click', function() {
  if (!tracked) {
    trackClick();
    tracked = true;
  }
});

Testing & Verification Tools

Browser Developer Tools

Open DevTools: F12 or Right-click → Inspect

Console Tab:

  • Check for JavaScript errors (red text)
  • Test if tracking functions exist
  • Run manual tests

Network Tab:

  • Filter: "google-analytics" or "facebook"
  • See if tracking requests sent
  • Check request payload

Application Tab:

  • Check cookies set
  • View localStorage
  • Inspect service workers

Analytics Platform Tools

GA4:

  • Realtime reports (30-second delay)
  • DebugView (detailed event view)
  • Enable debug mode for testing

Meta Pixel:

  • Pixel Helper extension (instant feedback)
  • Events Manager → Test Events (real-time)
  • Check event parameters

GTM:

  • Preview Mode (Tag Assistant)
  • See all tags, triggers, variables
  • Step-by-step debugging

Testing Workflow

Systematic Testing:

  1. Start clean

    • Clear browser cache
    • Open incognito window
    • Disable ad blockers
  2. Test base tracking

    • Visit homepage
    • Check pageview in Realtime/Pixel Helper
    • Verify base codes loaded
  3. Test specific events

    • Trigger action (form submit, button click)
    • Watch for event in debugging tools
    • Verify parameters correct
  4. Test on mobile

    • Use actual mobile device
    • Test in mobile browser
    • Check mobile-specific issues
  5. Monitor over time

    • Check data next day in reports
    • Verify events processed correctly
    • Confirm no data loss

When to Get Help

Site123 Support

Contact Site123 support if:

  • Code injection not saving
  • Platform issues preventing tracking
  • Site123-specific technical problems

How to contact:

Analytics Platform Support

Google Analytics:

Meta Business:

Hire a Developer

Consider professional help if:

  • Complex custom tracking requirements
  • Multiple errors you can't resolve
  • Need advanced implementation
  • Time-sensitive business needs

Where to find developers:

  • Upwork, Fiverr (freelancers)
  • Site123 community recommendations
  • Analytics agency specialists

Prevention Checklist

Before Adding Tracking

  • Back up existing code injection
  • Document what you're adding
  • Test in preview mode first
  • Have rollback plan ready

When Adding Tracking

  • Add one tracking code at a time
  • Test after each addition
  • Document tracking ID used
  • Note which injection area used
  • Save screenshots of setup

After Adding Tracking

  • Test immediately on published site
  • Check in incognito mode
  • Verify in platform (GA4/Meta/GTM)
  • Test on mobile
  • Monitor for 24-48 hours
  • Check for duplicate events
  • Document what's working

Next Steps

For general tracking troubleshooting, see global troubleshooting guide.