MODX is a flexible content management platform that uses Templates and Chunks to structure pages. Adding CookieScan means editing your Template (or a Chunk that's included in it) to add the script to the <head>.
Before you start
You will need:
- An active CookieScan subscription (view plans)
- Your banner installation code from the CookieScan dashboard (Cookie Banner → Install Code)
- Administrator access to your MODX manager
The install code looks like this:
<script src="https://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"></script>
Replace YOUR-COOKIESCAN-ID with the code from your dashboard.
Method 1: Add to your Template (recommended)
Step 1 – Open your main Template
- Log into your MODX Manager
- In the left tree, click Elements
- Expand Templates
- Click your site's main Template (often called BaseTemplate or similar)
Step 2 – Add the CookieScan script
- In the Template code, find the opening
<head>tag - Add your CookieScan script immediately after it:
<head>
<script src="https://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"></script>
...rest of your head content...
</head>
Step 3 – Save and clear cache
- Click Save
- Go to Manage → Clear Cache
- Visit your site in a new incognito window
Tip: If your site uses multiple Templates for different page types, add the script to all of them, or put it in a shared Chunk (see Method 2).
Method 2: Use a Chunk (for multi-template sites)
A Chunk is a reusable content block. Put your CookieScan script in a Chunk and include it in every Template.
Step 1 – Create the Chunk
- Go to Elements → Chunks
- Click Create new Chunk
- Name it
CookieScanBanner - In the content, add:
<script src="https://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"></script> - Save
Step 2 – Include the Chunk in your Template(s)
In each Template, add this tag inside the <head>:
<head>
[[$CookieScanBanner]]
...rest of your head content...
</head>
Step 3 – Clear cache
Go to Manage → Clear Cache and visit your site to verify.
Method 3: Install via Google Tag Manager
If GTM is already installed on your MODX site:
- In CookieScan, open Cookie Banner → Install Code and switch to the Google Tag Manager Install tab
- Copy your CookieScan ID
- In GTM, go to Templates → Search Gallery and add the CookieScan template
- Create a tag using the template, paste your ID
- Trigger: Consent Initialization – All Pages
- Submit and publish
Verify the installation
- Visit your site in a new incognito window
- The CookieScan banner should appear
- Open DevTools (F12) → Network tab → filter by
cookiescan - Confirm
banner.cookiescan.comloaded
What happens next
- CookieScan scans your MODX site and detects all cookies
- New cookies appear in Cookie Manager → Unclassified – categorise them
- The banner blocks cookies until user consents
- Every decision is logged in Consent Log
Troubleshooting
Banner not appearing
- Clear MODX cache: Manage → Clear Cache
- Clear any server-side cache (Varnish, CDN)
- View page source and confirm the script is in the
<head> - Check the right Template is being used for the page you're viewing
Banner shows on some pages but not others
- Different page types may use different Templates
- Use the Chunk approach (Method 2) to include the script in all of them easily
MODX Cache stripping the script
- Some MODX minification extras (e.g. Gzip) may merge or strip inline tags
- Check the extras settings and add
cookiescanto any exclusion list
Full documentation
For detailed setup help, see the support guide linked in your CookieScan dashboard, or visit our support guides.