CMS Made Simple (CMSMS) uses Smarty templates and a module-based architecture. Analytics problems on CMSMS most often trace to Smarty template tag parsing conflicts, the built-in page caching system, or modules that inject or override head content. The admin panel's template editor is the primary integration point.
CMSMS-Specific Debugging Approach
CMSMS uses Smarty as its template engine. Smarty's { and } delimiters conflict with JavaScript syntax, which is the single most common source of analytics failures on this platform.
Check for Smarty Parsing Conflicts
# SSH into your CMSMS server
# Check if your analytics code appears in the rendered output
curl -s http://your-cmsms-site.com/ | grep -iE "gtag|gtm|analytics" | head -5
# If empty, check the error log for Smarty parse errors
tail -100 tmp/cache/error.log | grep -i "smarty\|template\|parse"
# Check which template is active for the homepage
grep -r "default_template" config.php
Verify Template Structure
{* In CMSMS Admin > Layout > Templates, check your page template *}
{* This tag MUST be present for head content to render: *}
{cms_head_content}
{* Verify it appears in <head> section of your template *}
Most Common CMSMS Analytics Issues
1. Smarty Parsing JavaScript Curly Braces
Symptoms: Blank page, Smarty error in logs, or analytics code completely missing from output. Error: Smarty: [in content string] syntax error.
Root cause: Smarty interprets { and } in your analytics JavaScript as Smarty tags. Any inline JavaScript with curly braces will trigger parse errors.
Fix: Wrap JavaScript in {literal} tags:
{literal}
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXX');
</script>
{/literal}
2. Content Block Cache Serving Old HTML
Symptoms: Updated analytics code visible in the template editor but not in the rendered page.
Root cause: CMSMS caches compiled Smarty templates and content blocks. Template changes require a cache clear.
Fix:
# Clear CMSMS cache via CLI
rm -rf tmp/cache/*
rm -rf tmp/templates_c/*
# Or via admin: Extensions > CMSMailer isn't relevant — go to:
# Admin > Settings > Global Settings > Clear Cache
3. Global Content Block Not Included in Template
Symptoms: You added analytics to a Global Content Block (GCB) but it does not appear on pages.
Root cause: Global Content Blocks must be explicitly called in the template. Creating one does not auto-inject it.
Fix: Add the GCB call to your template's <head>:
<head>
{cms_head_content}
{global_content name='analytics_tracking'}
</head>
4. Module Scripts Overriding Head Content
Symptoms: Analytics tag appears on most pages but disappears on pages using specific modules (e.g., News, Products).
Root cause: Some CMSMS modules override or replace {cms_head_content} output, dropping your manually-added scripts.
Diagnosis:
// On a page where analytics is missing, check if the module loaded instead
console.log('Scripts in head:', document.head.querySelectorAll('script').length);
console.log('Module meta:', document.querySelector('meta[name="generator"]')?.content);
Fix: Place analytics code after {cms_head_content} but outside module-controlled blocks, or use a User Defined Tag (UDT) to inject analytics independently of modules.
5. Pretty URL Routing Causing 404 on Tracking Endpoints
Symptoms: Analytics tags load but beacon/collection requests fail with 404s. Network tab shows failed POST requests.
Root cause: CMSMS's URL routing (via .htaccess or config.php pretty URLs) may intercept outgoing analytics requests if your server is configured to route all requests through CMSMS.
Fix: Add exceptions to your .htaccess:
# In .htaccess, before the CMSMS rewrite rules
RewriteCond %{REQUEST_URI} !^/collect [NC]
RewriteCond %{REQUEST_URI} !^/j/collect [NC]
Environment Considerations
- PHP version sensitivity: CMSMS versions before 2.2 may not support PHP 8.x. Smarty version compatibility can affect template parsing behavior
- Shared hosting: Most CMSMS installations run on shared hosting. Verify PHP OPcache is not aggressively caching old templates
- No Composer: CMSMS does not use Composer. Modules are installed via the admin panel or FTP. Module conflicts must be debugged manually
- File permissions: Template cache files in
tmp/need write permissions. If cache cannot be written, every page load recompiles templates, causing performance issues that affect tracking reliability
Performance Issues
- LCP Issues - Smarty template compilation latency and module rendering overhead
- CLS Issues - Layout shifts from module-injected content and deferred script loading
Tracking Issues
- Events Not Firing - Debug Smarty parsing conflicts, cache issues, and module head overrides
Related Resources
- CMS Made Simple documentation
- Global Issues Hub for platform-agnostic solutions