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:
- Log out of Concrete CMS
- Visit your site as regular user
- 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:
- Dashboard → System & Settings → Optimization → Clear Cache
- Clear all cache types
- Clear browser cache
- 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:
- GA4 → Admin → DebugView
- 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 Dashboard → System & Settings → SEO & Statistics → Tracking 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:
- Go to GTM
- Verify "Published" next to container name
- If "Workspace" shows changes, click Submit → Publish
Check GA4 tag in GTM:
- GTM → Tags
- Find GA4 Configuration tag
- Click Preview
- Verify tag fires on your site
- 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
itemsarray
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:
- Meta Events Manager
- Select your pixel
- 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:
- Meta Events Manager → Test Events
- Enter your website URL
- Perform actions
- Verify events appear within seconds
2. Common Event Issues
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:
- Go to GTM
- Look for "Workspace Changes" banner
- Click Submit
- Name version
- 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:
- Clear Concrete CMS cache (Dashboard → Optimization → Clear Cache)
- Clear browser cache
- Test in incognito mode
- 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:
- GTM Preview mode
- Navigate to page
- Check Data Layer tab
- 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:
- GTM Preview → Variables tab
- Find your variable
- 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:
- GTM Preview
- Click on tag
- Check "Firing Triggers" vs "Blocking Triggers"
- 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:
- Google Analytics Debugger
- Logs GA4 events to console
Meta Pixel:
- Meta Pixel Helper
- Shows pixel status and events
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:
- Enable debug mode
- GA4 → Admin → DebugView
- See events in real-time
Meta Events Manager:
- Events Manager → Test Events
- Enter site URL
- Perform actions
- See events immediately
GTM Preview Mode:
- GTM → Preview
- Enter site URL
- 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
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
Test Page Load
- Log out or use incognito mode
- Reload page
- Check if pageview fires
- Verify in platform (GA4/Meta/GTM)
Test User Interactions
- Submit form → Check Lead event
- Click links → Check click events
- View content → Check ViewContent
- Custom interactions → Check custom events
Check Data Quality
- Event parameters present
- Values correct (no undefined)
- IDs match expected format
- No duplicate events
Fix Issues
- Address highest priority first
- Remove duplicate implementations
- Fix JavaScript errors
- Update variables/triggers
- Clear cache after changes
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.