Fork CMS is a PHP CMS built on Symfony with Twig templates. It includes a built-in Google Analytics module, which is both a feature and a common source of conflict. Analytics issues on Fork CMS typically involve conflicts between the built-in GA module and custom tracking code, Twig template inheritance, or the Symfony cache layer.
Fork CMS-Specific Debugging Approach
Fork CMS's built-in analytics module connects directly to the Google Analytics API and injects tracking code automatically. Before debugging custom analytics, check if the built-in module is active.
Check Built-in Analytics Module
# SSH into your Fork CMS server
# Check if the Analytics module is installed and active
# In Fork admin: Modules > check for "Analytics" module
# Check rendered output
curl -s http://your-fork-site.com/ | grep -iE "gtag|gtm|analytics|google-analytics" | head -5
# Check for duplicate tracking
curl -s http://your-fork-site.com/ | grep -c "google-analytics\|gtag\|gtm.js"
# If > 1, you have duplicate tracking
Verify Template Configuration
# Find the active theme's layout template
ls -la src/Frontend/Themes/*/Layout/Templates/
# Check if the analytics block is in the base layout
grep -r "analytics\|gtag\|gtm" src/Frontend/Themes/*/Layout/Templates/
Most Common Fork CMS Analytics Issues
1. Built-in Analytics Module Conflicting with Custom GTM
Symptoms: Double pageview counts. Both the Fork CMS-injected GA snippet and your custom GTM container load simultaneously.
Root cause: Fork CMS's Analytics module auto-injects Google Analytics tracking code. If you also added GTM or GA manually, both fire.
Fix: Either use the built-in module OR custom code, not both:
# Option A: Disable the built-in module
# In Fork admin: Settings > Modules > Analytics > Disable
# Option B: Use the built-in module and remove your custom code
# Configure it in Settings > Modules > Analytics > enter your GA tracking ID
2. Twig Block Override Dropping Analytics
Symptoms: Analytics tag in the base layout does not appear on pages that use custom templates.
Root cause: Fork CMS uses Twig template inheritance. If a page template overrides {% block head %} or {% block scripts %} without calling {{ parent() }}, the base template's analytics is lost.
Fix:
{# In your custom page template #}
{% extends 'Layout/Templates/default.html.twig' %}
{% block scripts %}
{{ parent() }}
{# Page-specific scripts here #}
{% endblock %}
3. Fork CMS Cache Serving Stale HTML
Symptoms: Template changes not reflected on the live site. Analytics code visible in the editor but not in rendered output.
Root cause: Fork CMS uses Symfony's caching layer. Compiled Twig templates and HTTP responses are cached.
Fix:
# Clear all Fork CMS caches
php bin/console cache:clear --env=prod
# Or via admin: Settings > Advanced > Clear cache
# Also clear the Twig template cache
rm -rf var/cache/prod/twig/
4. Module Action Pages Not Tracked
Symptoms: Regular content pages have analytics but module pages (blog posts, FAQ entries, search results) do not.
Root cause: Fork CMS module action pages use different templates. If your analytics code is in the default layout but a module uses its own layout, the tracking code is absent.
Diagnosis:
// Check which template rendered the current page
console.log('Fork module:', document.querySelector('[data-module]')?.dataset.module || 'none');
console.log('Has analytics:', document.querySelector('script[src*="gtag"]') ? 'yes' : 'no');
Fix: Ensure all module layouts extend the same base template that includes analytics, or add analytics to a common footer template included everywhere.
5. Locale/Language Prefix Fragmenting Page Paths
Symptoms: Analytics shows separate entries for /en/page and /fr/page instead of grouping them. Traffic appears split across languages.
Root cause: Fork CMS's multilingual support prepends language codes to URLs. Each language variant appears as a separate page in GA.
Fix: Strip the language prefix in your analytics configuration:
// Normalize page path by removing the locale prefix
const path = window.location.pathname.replace(/^\/(en|fr|nl|de)\//, '/');
gtag('config', 'G-XXXXXXX', {
page_path: path,
custom_map: { dimension1: 'language' }
});
gtag('event', 'page_view', {
language: document.documentElement.lang || 'en'
});
Environment Considerations
- PHP requirements: Fork CMS requires PHP 7.4+ (older versions) or PHP 8.x (latest). Template engine behavior can differ between PHP versions
- Symfony version: Fork CMS bundles Symfony components. The Symfony version determines available debugging tools (profiler, dump functions)
- Shared hosting limitations: Fork CMS can run on shared hosting but CLI cache clearing requires SSH access. Use the admin panel's cache clear instead
- Built-in SEO tools: Fork CMS includes SEO modules that may inject meta tags affecting how search engines index tracked pages
Performance Issues
- LCP Issues - Twig compilation latency and module rendering overhead
- CLS Issues - Layout shifts from dynamically loaded module widgets and form elements
Tracking Issues
- Events Not Firing - Debug built-in module conflicts, Twig inheritance, and cache layers
Related Resources
- Fork CMS documentation
- Global Issues Hub for platform-agnostic solutions