Choosing a setup method
Ways to set up CookieOfficer and which one to choose. Differences in implementation.
You can set up the cookie banner in three ways. The end result on your site is the same, but the methods differ in where the code is placed and how cookies are blocked. Below you'll find a comparison of all the options, and you'll learn which one to choose in your case.
Ways to set up CookieOfficer
| Method | Requirements | Blocking of scripts and cookies | Level of complexity |
|---|---|---|---|
| Google Tag Manager | Access to the GTM container | You gate tags in GTM using Consent Mode or dataLayer events | Configuration through the GTM interface |
Code on the site (in <head>) | Access to the site template | Automatic or manual, your choice | Requires someone who knows the site's code |
| A plugin or a code field in a CMS | CMS administrator permissions | Automatic, if the code is placed before other scripts in the site's structure, or manual | Configuration through the interface |
Which method should you choose?
To choose the best way to set up CookieOfficer for you, ask yourself these questions:
- Do you use Google Tag Manager? If so, choose this option. You'll set up the banner without editing the site's code, and you'll gate the GTM tags using the built-in consent mechanism (Google Consent Mode) or the appropriate
dataLayerevents. - Do you have access to the site template? Paste the installation code in the
<head>section, as the first script. Automatic blocking will then work without any additional changes to the code. - Do you use a CMS that lets you add code in the
<head>without involving developers, for example WordPress, Shopify, Wix, Webflow or Squarespace? Choose this option or a plugin. The result will be the same as pasting into the template, as long as the code ends up at the start of the<head>section.
What if you decide to use Google Tag Manager?
- Automatic cookie blocking requires the installation code to be the first script in the
<head>section. When you set up through GTM, the code loads asynchronously, so scripts added directly to the site may run earlier (without blocking). - To block tags in GTM, gate them in the container using Consent Mode or the appropriate
dataLayerevents. - To hold back scripts written into the site's code, make two changes at once: replace
type="text/javascript"withtype="text/plain"and adddata-co-catwith the category the given tool belongs to. The attribute alone isn't enough: withouttype="text/plain"the script will run before consent.
Example:
<script type="text/plain" data-co-cat="analytics" src="…"></script>
Enter the cookie category as follows:
necessaryfor Necessary,analyticsfor Analytics,marketingfor Marketing,personalizationfor Functional.
Don't need automatic blocking of scripts that use cookies?
You can turn this feature off in the CookieOfficer panel. Do it in Settings, in the “Cookie blocking” section, by choosing the “Manual” mode. You'll have full control over how scripts are loaded.
Choosing a setup method comes down to where you can place the CookieOfficer code.
Troubleshooting
- You don't know whether you have access to the site template, or whether your system has room to add code in the
<head>section. Look for this field in your CMS settings. If you can't find it, you'll need technical help or a setup through GTM. - The site is maintained by developers. Copy the installation code from the “Installation” page and send it to that person with the instruction: “Paste the code in the
<head>section, as the first script”. - There is a place to add the CookieOfficer code in the header, but the code ends up after the theme's scripts. The banner then works, so it looks like a correct setup, yet scripts start before consent anyway. Run a website scan and go to the Cookies page. If a red message “After consent is rejected, N trackers are still running” is displayed above the list, the code runs too late. In that case, paste it directly into the template.
Common mistakes to avoid
- Don't set up the cookie banner in several different ways. The second copy of the code will switch itself off, but you'll be left with two places to update.
- Don't assume that GTM will block scripts on its own. Without gating the tags in the container, everything will run just as it did before.
- Don't change the setup method without removing the old code. The copy that loaded first is the one that runs, and the panel doesn't show which one that is, so if you remove the wrong one you'll switch the banner off.