How to Fix Concrete CMS Events Not Firing | OpsBlu Docs

How to Fix Concrete CMS Events Not Firing

Fix GA4, GTM, and pixel events not firing on Concrete CMS — theme page_head block editing, full-page cache conflicts, and block template debugging

Common causes and solutions for tracking events that don't fire correctly on Concrete CMS websites.

For general tracking troubleshooting, see the global tracking troubleshooting guide.

Quick Diagnosis Checklist

Before diving deep, check these common issues:

  • Ad blocker disabled (for testing)
  • Incognito/private mode (clear cache)
  • Browser console has no errors (F12)
  • Not in edit mode (tracking should exclude edit mode)
  • Concrete CMS cache cleared (recent changes may be cached)
  • GTM container published (if using GTM)
  • Correct tracking code location (Header/Footer or template)
  • Not on dashboard pages (should exclude dashboard)

Concrete CMS-Specific Tracking Limitations

Edit Mode vs. View Mode

Limitation: Tracking should not fire when editing pages.

Expected Behavior:

  • ✓ Tracking fires in view mode (logged out or viewing published page)
  • Tracking should NOT fire in edit mode (when editing page content)
  • Tracking should NOT fire on dashboard pages

Verification:

  1. Log out of Concrete CMS
  2. Visit your site as regular user
  3. Check if tracking fires

Common Issue: Tracking code doesn't check for edit mode.

Fix:

<?php
// Always add this check
if (!$c->isEditMode() && !$this->controller->isControllerTaskInstanceOf('DashboardPageController')) {
    ?>
    <!-- Tracking code here -->
    <?php
}
?>

Cache Preventing Updates

Limitation: Concrete CMS caching can prevent tracking code updates from appearing.

Impact:

  • Changes to tracking code don't appear
  • Old version of scripts loading
  • GTM container not updating

Workaround:

Clear All Caches:

  1. DashboardSystem & SettingsOptimizationClear Cache
  2. Clear all cache types
  3. Clear browser cache
  4. Test in incognito mode

CLI Method:

concrete/bin/concrete5 c5:clear-cache

Disable Cache for Testing:

// In /application/config/concrete.php (temporarily for testing only)
return [
    'cache' => [
        'enabled' => false,
        'page' => [
            'enabled' => false
        ]
    ]
];

Important: Re-enable cache after testing!

Google Analytics 4 (GA4) Issues

GA4 Events Not Appearing

1. Check GA4 DebugView

Enable Debug Mode:

<?php if (!$c->isEditMode()) { ?>
<script>
gtag('config', 'G-XXXXXXXXXX', {
  'debug_mode': true
});
</script>
<?php } ?>

Check DebugView:

  • GA4AdminDebugView
  • Should see events in real-time
  • If events appear here but not in Reports, wait 24-48 hours for processing

2. Verify Measurement ID

Check format: Must start with G- (e.g., G-XXXXXXXXXX)

NOT UA-XXXXXXXXX (Universal Analytics - deprecated)

<!-- Correct: GA4 -->
gtag('config', 'G-XXXXXXXXXX');

<!-- Wrong: Universal Analytics -->
gtag('config', 'UA-XXXXXXXXX');

3. Check for Duplicate Implementations

Common scenario: Both Dashboard tracking codes AND template code installed.

Diagnosis:

// In browser console
window.dataLayer.filter(obj => obj.event === 'page_view').length
// If > 1, you have duplicates

Fix:

  • Check DashboardSystem & SettingsSEO & StatisticsTracking Codes
  • Check theme template files for GA4 code
  • Check marketplace add-ons that might add GA4
  • Remove all but ONE implementation

4. Tracking in Edit Mode

Diagnosis:

// Check if page is in edit mode
console.log(window.location.href.indexOf('ccm/system/dialogs') !== -1);

Fix: Always add edit mode check:

<?php if (!$c->isEditMode()) { ?>
    <!-- GA4 code -->
<?php } ?>

5. GTM + GA4 Not Working

Check GTM is installed:

// In console
console.log(window.google_tag_manager);
// Should show GTM object

Check GTM container published:

  1. Go to GTM
  2. Verify "Published" next to container name
  3. If "Workspace" shows changes, click SubmitPublish

Check GA4 tag in GTM:

  1. GTM → Tags
  2. Find GA4 Configuration tag
  3. Click Preview
  4. Verify tag fires on your site
  5. Check for errors in Preview mode

Common GTM mistakes:

  • GA4 tag not triggered on correct events
  • Measurement ID incorrect
  • Variables not capturing data correctly
  • Tag blocked by trigger exception

GA4 Events Missing Parameters

Issue: Events fire but missing data.

Diagnosis:

  • Check DebugView
  • Click event to see parameters
  • Look for empty parameters or missing items array

Common causes:

1. PHP Variables Not Available:

<!-- Wrong - variable might not exist -->
<?php echo $product->getPrice(); ?>

<!-- Correct - check if exists first -->
<?php if (isset($product)) {
    echo $product->getPrice();
} ?>

2. JavaScript Escaping Issues:

<!-- Wrong - can break if title has quotes -->
'page_title': '<?php echo $c->getCollectionName(); ?>'

<!-- Correct - properly escaped -->
'page_title': '<?php echo addslashes($c->getCollectionName()); ?>'

3. Data Layer Variables Not Set:

// Check if variable exists
console.log({{Page Type}}); // In GTM Preview
// If undefined, variable not configured correctly

Meta Pixel Issues

Meta Pixel Not Loading

1. Verify Pixel Helper

Install Meta Pixel Helper:

  • Green icon = Working
  • Yellow = Warnings
  • Red = Error
  • No icon = Not loaded

2. Check Pixel ID

Format: 16-digit number (e.g., 1234567890123456)

Find in Meta Events Manager:

  1. Meta Events Manager
  2. Select your pixel
  3. Copy Pixel ID from top

3. Check for Ad Blockers

Meta Pixel is commonly blocked:

  • Disable ad blocker for testing
  • Use incognito mode
  • Test on mobile device
  • Check browser console for blocked requests

4. Multiple Pixel Implementations

Diagnosis:

// In console
console.log(window.fbq);
// Should show function, not undefined

Check for duplicates:

  • Dashboard tracking codes
  • Theme template code
  • GTM implementation
  • Marketplace add-ons

Fix: Choose ONE method and remove others.

Meta Pixel Events Not Firing

1. Check Events Manager

Real-time testing:

  1. Meta Events Manager → Test Events
  2. Enter your website URL
  3. Perform actions
  4. Verify events appear within seconds

2. Common Event Issues

Form Lead events not firing:

Diagnosis:

// Check if form exists
console.log(document.querySelectorAll('form').length);

Fix: Add event listener properly:

document.addEventListener('DOMContentLoaded', function() {
    const forms = document.querySelectorAll('form[action*="/ccm/system/form/submit"]');

    forms.forEach(function(form) {
        form.addEventListener('submit', function(e) {
            fbq('track', 'Lead', {
                content_name: form.getAttribute('data-form-name') || 'Contact Form'
            });
        });
    });
});

ViewContent firing in edit mode:

Fix: Add edit mode check:

<?php if (!$c->isEditMode() && $c->getPageTypeHandle() === 'blog_entry') { ?>
<script>
fbq('track', 'ViewContent', {
    content_name: '<?php echo addslashes($c->getCollectionName()); ?>'
});
</script>
<?php } ?>

3. Missing Event Parameters

Issue: Events fire but no content_ids or value.

Fix:

// Correct format
fbq('track', 'ViewContent', {
    content_ids: ['123'],        // Array of strings
    content_name: 'Page Name',   // String
    content_type: 'product',     // Required
    value: 29.99,                // Number, no currency symbol
    currency: 'USD'              // ISO code
});

// Wrong
fbq('track', 'ViewContent', {
    content_ids: 123,            // Should be array
    value: '$29.99',             // Should be number
    currency: 'dollars'          // Should be ISO code
});

Google Tag Manager (GTM) Issues

GTM Container Not Loading

1. Verify Installation

Check template file:

<!-- Should be in <head> of theme template -->
<?php if (!$c->isEditMode() && !$this->controller->isControllerTaskInstanceOf('DashboardPageController')) { ?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager -->
<?php } ?>

Verify Container ID: Replace GTM-XXXXXXX with your actual ID.

Check in console:

console.log(window.google_tag_manager);
// Should show GTM object with your container ID

2. Container Not Published

Most common GTM issue: Changes made but not published.

Fix:

  1. Go to GTM
  2. Look for "Workspace Changes" banner
  3. Click Submit
  4. Name version
  5. Click Publish

Verify:

  • Refresh your site
  • Check Preview mode shows published version

3. Cache Preventing GTM Update

Problem: Updated GTM code doesn't appear.

Fix:

  1. Clear Concrete CMS cache (Dashboard → Optimization → Clear Cache)
  2. Clear browser cache
  3. Test in incognito mode
  4. Verify theme file was saved correctly

GTM Triggers Not Firing

1. Custom Event Triggers

Issue: Data layer event fires but GTM trigger doesn't catch it.

Diagnosis:

  1. GTM Preview mode
  2. Navigate to page
  3. Check Data Layer tab
  4. Look for your custom event

If event is in data layer but trigger doesn't fire:

  • Trigger event name misspelled (case-sensitive!)
  • Trigger has incorrect conditions
  • Trigger blocked by exception

Fix:

Trigger Type: Custom Event
Event name: form_submit  (exact match, case-sensitive)
This trigger fires on: All Custom Events

2. Variables Not Populating

Issue: Variable shows undefined in GTM Preview.

Diagnosis:

  1. GTM Preview → Variables tab
  2. Find your variable
  3. Check value

Common causes:

Data layer not initialized:

<!-- Add BEFORE GTM container code -->
<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({
    'pageType': '<?php echo $c->getPageTypeHandle(); ?>',
    'pageID': '<?php echo $c->getCollectionID(); ?>'
});
</script>

Wrong data layer path:

// Wrong
pageType

// Correct (if nested)
page.type

Variable accessed before push:

  • Variable accessed before data layer push happens
  • Use trigger to ensure data pushed first

3. Tags Not Firing

Check Tag Firing Rules:

  1. GTM Preview
  2. Click on tag
  3. Check "Firing Triggers" vs "Blocking Triggers"
  4. Verify trigger conditions met

Common issues:

  • Tag paused (unpause in GTM)
  • Trigger exception blocking tag
  • JavaScript error in tag code
  • Tag depends on another tag that didn't fire

Data Layer Issues

Data Layer Empty or Undefined

Diagnosis:

console.log(window.dataLayer);
// Should return array, not undefined

If returns undefined:

Cause 1: GTM Not Installed

  • Check GTM code in template
  • Clear cache
  • Verify GTM container ID correct

Cause 2: JavaScript Error

  • Check browser console for errors
  • Fix errors preventing data layer initialization

Cause 3: Data Layer Code After GTM

  • Data layer initialization must come BEFORE GTM container code

Fix:

<!-- CORRECT ORDER -->
<script>
// 1. Initialize data layer FIRST
window.dataLayer = window.dataLayer || [];
dataLayer.push({...});
</script>

<!-- 2. GTM container code AFTER -->
<script>(function(w,d,s,l,i){...GTM code...})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>

Data Layer Not Capturing Page Data

Issue: Data layer exists but page information not captured.

Diagnosis:

// Check data layer contents
console.log(window.dataLayer);

Expected:

[{
    pageType: 'blog_entry',
    pageID: '123',
    pageName: 'Blog Post Title'
}]

If missing data:

Fix: Add to template before GTM:

<?php
if (!$c->isEditMode()) {
    ?>
    <script>
    window.dataLayer = window.dataLayer || [];
    dataLayer.push({
        'pageType': '<?php echo $c->getPageTypeHandle(); ?>',
        'pageID': '<?php echo $c->getCollectionID(); ?>',
        'pageName': '<?php echo addslashes($c->getCollectionName()); ?>'
    });
    </script>
    <?php
}
?>

Testing Tools & Techniques

Browser Extensions

GA4:

Meta Pixel:

GTM:

  • Built-in Preview mode (best option)
  • Shows all tags, triggers, variables

Browser Console Debugging

Check for JavaScript errors:

// Open console (F12)
// Look for red errors
// Fix errors to unblock tracking

Monitor data layer pushes:

const originalPush = window.dataLayer.push;
window.dataLayer.push = function() {
    console.log('Data Layer Push:', arguments[0]);
    originalPush.apply(window.dataLayer, arguments);
};

Check if tracking pixels loaded:

// GA4
console.log(window.gtag);

// Meta Pixel
console.log(window.fbq);

// GTM
console.log(window.google_tag_manager);

Platform-Specific Testing

GA4 DebugView:

  1. Enable debug mode
  2. GA4 → AdminDebugView
  3. See events in real-time

Meta Events Manager:

  1. Events Manager → Test Events
  2. Enter site URL
  3. Perform actions
  4. See events immediately

GTM Preview Mode:

  1. GTM → Preview
  2. Enter site URL
  3. See tags, triggers, variables in real-time

Common Error Messages

"GTM-XXXXXXX not found"

Cause: Container ID incorrect or container deleted.

Fix:

  • Verify container ID in GTM
  • Update ID in theme code or Dashboard tracking codes

"gtag is not defined"

Cause: GA4 script not loaded or blocked.

Fix:

  • Check if GA4 script in <head>
  • Disable ad blocker
  • Check for JavaScript errors blocking script
  • Verify not in edit mode

"fbq is not defined"

Cause: Meta Pixel script not loaded.

Fix:

  • Check if Pixel code in theme or Dashboard
  • Verify Pixel ID correct
  • Disable ad blocker
  • Check browser console for blocked requests

"dataLayer is not defined"

Cause: Data layer not initialized before access.

Fix:

// Always initialize first
window.dataLayer = window.dataLayer || [];
dataLayer.push({...});

Debugging Workflow

Step-by-Step Debugging Process

  1. Verify Basic Setup

    • Tracking code present in theme or Dashboard
    • Container/Pixel ID correct
    • No JavaScript errors in console
    • Not in edit mode
    • Cache cleared
  2. Test Page Load

    • Log out or use incognito mode
    • Reload page
    • Check if pageview fires
    • Verify in platform (GA4/Meta/GTM)
  3. Test User Interactions

    • Submit form → Check Lead event
    • Click links → Check click events
    • View content → Check ViewContent
    • Custom interactions → Check custom events
  4. Check Data Quality

    • Event parameters present
    • Values correct (no undefined)
    • IDs match expected format
    • No duplicate events
  5. Fix Issues

    • Address highest priority first
    • Remove duplicate implementations
    • Fix JavaScript errors
    • Update variables/triggers
    • Clear cache after changes
  6. Verify Fixes

    • Test in incognito mode
    • Test on multiple pages
    • Test on mobile
    • Monitor for 24-48 hours

When to Get Help

Consider Hiring a Concrete CMS Expert

  • Events still not firing after troubleshooting
  • Complex custom implementation needed
  • Multiple integrations conflicting
  • Custom block event tracking needed
  • Time-sensitive launch

Find experts: Concrete CMS Marketplace

Concrete CMS Community

Platform Support

GA4: Google Analytics Help Meta: Meta Business Help GTM: Tag Manager Help

Next Steps

For general troubleshooting strategies, see Tracking Troubleshooting Guide.