Implementing Cookiebot in WordPress without a plug-in

Home - Implementing Cookiebot in WordPress without a plug-in

Any WordPress site that sets cookies, such as for Google Analytics, YouTube or marketing pixels - must first ask visitors for permission to do so. This is required by the AVG (GDPR) and also gives your visitors more confidence.

With a plugin you can easily arrange this, but not everyone wants to install yet another plugin. Plugins can make your site slower or conflict with other components. Therefore you can also manual integration. Cookiebot automatically scans which cookies your site uses and ensures that your banner and statement are always up to date.

How to implement Cookiebot manually in WordPress?

It may sound technical, but with the right steps, you can add Cookiebot just fine without a plugin. Below we explain how to do that.

1. Create a Cookiebot account

Go to Cookiebot and create an account. Add your domain under Domains & Aliases and wait for the scan to complete.

2. Set your cookie banner

In the Cookiebot Manager, you control how your banner looks. Under Configuration choose your style and position, and through the tab Content adapt the texts.

3. Add the Cookiebot script to your theme

  • Log in to WordPress and go to View → Theme editor.
  • Open the file header.php.
  • Paste the script from your Cookiebot account just before the line .

This will load the cookie banner first.

4. Place the cookie statement on a page

Want to give visitors an overview of all cookies? Create a separate page, for example Cookie Statement, and paste the second script from your Cookiebot account there.

5. Test your implementation

Open your site in an incognito window and check if the banner appears. In your Cookiebot dashboard, you can use Scan again let you search for cookies again.

For advanced users: loading cookies only after consent

Use manual blocking mode if you want to activate cookies only after agreement. To do so, add to your scripts the attribute type="text/plain" and data-cookieconsent toe.

What should you look out for in manual implementation?

Inserting Cookiebot manually into your theme yourself gives you a lot of freedom, but also requires care. It is not enough just to paste the script: the order in which it is loaded and how you deal with other scripts are crucial. If you get this wrong, cookies may still be placed without permission or certain features of your site may not work properly. That's why it's smart to keep a few key considerations in mind when implementing manually:

  • Load the consent script first
    Always place the Cookiebot script at the top of your header, before other scripts. This will prevent cookies from being active before a visitor can give permission.
  • Be mindful of plugins that set cookies
    WordPress plugins that use cookies themselves are not always automatically covered by Cookiebot. In that case, you should mark their scripts so that they start only after permission.
  • Know that you can always fall back on the plugin
    Do you find the manual method too complicated or find that there are too many separate scripts to manage? Then you can always switch to the official Cookiebot plugin.

Getting started yourself or getting help

With the steps above, you can add Cookiebot to your WordPress site without a plugin. That gives you a lot of freedom, but it also requires diligence. Can't manage or prefer to outsource this kind of technical task? Then take a look at our webmaster service. This ensures that your site remains secure, fast and compliant.

Picture of David Ladiges
David Ladiges
Technical Lead
On this page

Share this article:

Related articles