How to embed a cookie notification script on a MODX website: a simple and legitimate solution

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.

Why does a MODX website need a cookie banner?

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:

  • The lack of cookie notification is equal to the risk of violations and complaints;
  • Its presence is equal to a demonstration of transparency and correctness.;
  • For SEO— it is a signal of reliability and concern for the user (especially in e-commerce).

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.:

  • Without plugins.
  • One line of code.
  • Legally correct text.
  • Adaptive appearance.

The script is completely independent of CMS and works fine with MODX.

How to embed a cookie banner in MODX

1. Find the template where to insert the code.

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

2. Insert the script in front of </body>

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.

Customization: adapt it to your project

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://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://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".

Verification and behavior

After insertion:

  • The banner will appear immediately upon first loading.
  • After the consent, it will not be shown for a specified period of time.
  • It works correctly on all devices (adaptive design).
  • It can be tested via incognito or cookie reset.

Why is QForm the best choice for MODX

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

Impact on reputation and SEO

Although search engines do not consider the presence of a cookie banner as a direct ranking factor, its correct implementation contributes to:

  • Compliance (reducing legal risks, especially for e-commerce and media);
  • Improve the user experience if the banner does not interfere with the interaction with the content.;
  • Trust from the audience, which can indirectly affect behavioral metrics (time on the site, returns).
  • For SEO, the technical correctness of the implementation is more important:
  • The banner should not block indexing of the content (for example, due to incorrect overlay);
  • It is advisable to avoid excessive load on Core Web Vitals (for example, to connect the script asynchronously).

Conclusion

Cookie banner script from QForm:

  • Fully compatible with MODX architecture;
  • Does not interfere with productivity;
  • It is installed in 2 minutes;
  • Complies with laws and user expectations.

This is a practical solution if you want to quickly adapt to personal data requirements, improve the UX and avoid complaints.