Install the script
Cookiemark runs from one script tag. This page tells you where that tag goes, why the position matters, and how to add it on the platforms our customers use most.
Add your domain and copy the line
- Sign in and open Domains, then Add domain. Enter the address your visitors use, such as
shop.example.com. - The setup wizard opens. It takes you through every setting in order: your company, the tag, the language and regions, the cookies, the design and your documents. Continue saves each step.
- In the second step, paste the tag into your site as described below for your platform. The wizard checks your site by itself.
- The last step, Check and publish, shows what each step left. Publish opens once every step is done, and the banner appears on the next page view. With Save and exit you leave and come back later from the domain's overview.
The line looks like this, with your own key in place of YOUR-SITE-KEY:
<script src="https://cdn.cookiemark.com/s/YOUR-SITE-KEY.js"></script>You can add the line before you publish anything. Until the first publish the script loads, finds nothing published and shows nothing. So it is safe to put it on a live site today and finish the design tomorrow.
Why the line goes first in the head
The script does two things that have to happen before any other script runs. It tells Google that nothing is allowed yet, and it starts watching the page for trackers it has to hold back. A script that runs earlier has already done its work by the time Cookiemark arrives.
So paste the line as the first script in the <head> of every page. Put it above Google Tag Manager, analytics, pixels and chat widgets.
<head>
<meta charset="utf-8">
<script src="https://cdn.cookiemark.com/s/YOUR-SITE-KEY.js"></script>
<!-- Google Tag Manager, analytics and every other script come after this line -->
...
</head>Leave the tag as it is. Do not add async or defer, because both let other scripts run first. The script is small: about 19 KB after compression, plus your own settings.
Keep optimisation tools away from it
Tools that delay, defer or combine scripts change the order you set. Exclude the Cookiemark script from them. Look for a setting called "exclude from delay", "exclude from combine" or similar. Common ones are WP Rocket, LiteSpeed Cache, Autoptimize and Cloudflare Rocket Loader.
When you publish a change
Saving in the dashboard keeps your change as a draft. Visitors see it after you press Publish. Every publish becomes a new version, and we empty the CDN cache for your script at the same moment. Visitors pick up the new version within about a minute, because browsers keep the script for 60 seconds.
Plain HTML
Paste the line directly after the opening <head> tag, on every page. If your pages share a header file or template, paste it there once. Check a few pages afterwards, because hand-built sites often have pages that use a different template.
WordPress
Use our plugin. It puts the script at the very top of the head, keeps WP Rocket, LiteSpeed, Autoptimize and Cloudflare Rocket Loader away from it, clears the page cache when you save, and tells plugins that use the WP Consent API what the visitor chose.
- Download the plugin from the Install tab of your domain in Cookiemark.
- In WordPress, open Plugins, Add new, Upload plugin, pick the file and activate the plugin.
- WordPress then opens Settings, Cookiemark. Press Connect with Cookiemark.
- Sign in to Cookiemark if you are asked to, pick the domain or add it as a new one, and you come back to WordPress.
- Publish the banner in Cookiemark. It then shows on every page.
Connecting also adds the WordPress address to your extra domains, if it is not your domain already, and fills in the path where the plugin sets the consent cookie from your own server, so Safari keeps the choice for its full term. If you cannot use the button, paste the line from the Install tab into the plugin's Site key field instead.
Prefer not to add a plugin? Then add the line by hand:
- In your theme. Open
header.phpof a child theme and paste the line directly after<head>, abovewp_head(). Edit a child theme, because a theme update overwrites changes to the parent theme. - With a plugin. A plugin that inserts code into the head works too. Give the snippet the highest priority it offers, so it lands above the scripts other plugins add through
wp_head().
Then clear the page cache of your caching plugin, your host and your CDN. Visitors otherwise keep getting pages from before the change. Exclude the script from optimisation plugins, as described above.
Shopify
- In your Shopify admin, open Online Store, then Themes.
- Next to your current theme, open the menu and choose Edit code.
- Open
layout/theme.liquidand paste the line directly after<head>. - Save, and open your shop in a private window to check that the banner shows.
Shopify's checkout does not use your theme, so the banner does not show there. Each choice a visitor makes in the banner goes to Shopify's Customer Privacy API, so the checkout and the pixels under Customer events follow it. To count purchases in the checkout, add the Cookiemark checkout pixel, as Purchases in the Shopify checkout explains.
Webflow
- Open your project and go to Site settings, then Custom code.
- Paste the line at the top of Head code, above anything else in that field.
- Save, and publish the site from Webflow.
Webflow only adds custom code to a published site on a paid site plan. If you also add head code to single pages, check in the page source that the Cookiemark line still comes first.
Wix
- In your site's dashboard, open Settings, then Custom code.
- Choose Add custom code and paste the line.
- Apply it to all pages, place it in the Head, and set it to load on each new page.
Wix needs a premium plan with a connected domain for custom code. Wix also loads its own scripts before yours, and you cannot change that order. Cookiemark can show the banner and hold back the scripts you add, but not what Wix itself loads first. Switch off the cookie banner of Wix itself, so visitors see one banner.
Squarespace
- Open Settings, then Advanced or Developer tools, then Code injection.
- Paste the line at the top of the Header field and save.
Code injection is not part of every Squarespace plan, so check yours first. Switch off the cookie banner that Squarespace offers itself, so visitors do not see two.
Google Tag Manager
Do not load Cookiemark through Tag Manager. A tag in your container runs after the container has started, which is too late to set Google's consent defaults or to hold anything back. Paste the line in the head instead, and choose one of these two ways for the container itself.
- Let Cookiemark load the container. Enter your container ID on the Google and GTM tab and remove your own Tag Manager snippet. Cookiemark then loads the container straight after the consent defaults, so the order cannot go wrong.
- Keep your own snippet. Leave the container ID empty and keep your snippet below the Cookiemark line.
When the setup scan finds one container on your site, Cookiemark takes it over, and asks you to remove your own snippet before you publish.
Never do both. A container that loads twice fires every tag twice. Google Tag Manager covers the triggers and events in your container.
Check that it works
- Open your site in a private window, so you start without a stored choice. The banner should show.
- View the page source and search for
cdn.cookiemark.com. It should be the first script in the head. - Run a scan from the Scan tab. It reports pages without the script and a cache that still serves an old copy of your pages.
When a scan finds your script on the site, the domain gets the label Verified. Scheduled scans only run for verified domains.
More than one domain
The consent log only accepts choices from your domain, its extra domains and their subdomains. If the same banner runs on another domain, add it as an extra domain under Settings, Domains. To remember one choice across all subdomains, enter your main domain under Share the choice across subdomains on the same tab.
Switch Cookiemark off for a while
Does something on the site stop working, and do you want to rule Cookiemark out? Under Settings, Switch off Cookiemark makes the site work as if the script were not on it, without taking it out of your pages. No banner shows, nothing is held back and no consent is asked, so you agree to a notice first. A Tag Manager container Cookiemark loads keeps loading. Your settings, texts and cookie list are kept, and the owners and admins get a reminder every day until it is on again.