MODX sites are valued for their flexibility, performance, and control over the frontend. But in the context of modern regulation and increased attention to personal data, a quick code is no longer enough, and transparent notification of cookie collection is required.
In this article, we'll look at why a cookie banner is required even on light MODX projects, and how to implement it correctly, without plug-ins and overloading the system, using a ready-made script from QForm.
MODX is not a website builder, and developers often manually connect external libraries: Metrics, GA4, CRM forms, retargeting pixels, etc. Cookies are almost always involved in this. This means that you need a consent banner.
According to FZ-152 "On Personal Data", when collecting any identifying data, the user must be notified and give consent.
From the point of view of the law and search engines:
Universal cookie script from QForm
If you are looking for an easy way to embed a banner in MODX without unnecessary logic, it is better to use a ready-made script from QForm.:
The script is completely independent of CMS and works fine with MODX.
In MODX, the template structure is completely under the control of the developer. The banner is usually inserted into the main template (page template) or a chunk of the footer. This could be, for example:
swift
/assets/templates/base/footer.tpl
or
/assets/templates/base/index.tpl
Or in MODX Manager:
Elements → Templates → your template → HTML code of the page
html
<script src="https://cdn.qform.io/cookie/cookie-banner.js" async></script>
This is a standard connection that already provides minimal banner functionality. It will appear at the bottom of the screen, with neutral text and design.
If you want to adjust the colors, text, and position, use the built-in script parameters. Add the object before connecting:
html
<script>
window.qformCookieSettings = {
backgroundColor: '#f5f5f5',
buttonColor: '#1e87f0',
fontColor: '#000000',
fontSize: '14px',
position: 'bottom-left',
messageText: 'We use cookies to analyze and improve the site.',
policyText: 'Learn more',
privacyLink: 'https://in-en.qform.io/quiz/vidy', // The chunk or ID of the policy page in MODX
cookieExpiryDays: 30
};
</script>
<script src="https://cdn.qform.io/cookie/cookie-banner.js" async></script>
https://in-en.qform.io/quiz/vidy is a MODX tag that outputs the URL of the page with ID 23. Use it to dynamically insert a link to the "Privacy Policy".
After insertion:
MODX is focused on manual operation. In this context, the finished script from QForm has clear advantages.:
QForm |
Alternatives (on MODX) |
Requires no components |
They require a custom build |
It is connected in one line |
They are often written from scratch |
Flexible configuration via JS |
Without UI interfaces |
Legally prepared text |
You need to write it yourself |
For free and without registration |
Some solutions are paid |
Although search engines do not consider the presence of a cookie banner as a direct ranking factor, its correct implementation contributes to:
Cookie banner script from QForm:
This is a practical solution if you want to quickly adapt to personal data requirements, improve the UX and avoid complaints.