Skip to content

WordPress, Shopify and Tag Manager

The snippet is plain HTML, so it works with any website. What matters is that it ends up first in <head>.

  • With a plugin that adds code to the header (for example a “header and footer scripts” plugin), paste the snippet into the header box and give it the highest priority.
  • Or, in a child theme, place it in header.php right after <head>.

Caching and optimisation plugins can move or delay scripts. Exclude cb.min.js from “defer”, “delay JavaScript” and “combine” options.

In Online Store → Themes → Edit code, open layout/theme.liquid and paste the snippet right after <head>.

Use the option for custom code in the head of all pages. If the builder only allows code in the body or in a “footer”, the banner still works, but tags above it may run before consent.

Load CookieDoo outside Tag Manager, directly in the page, above the Tag Manager snippet. Then:

  • Google tags (GA4, Google Ads) follow Consent Mode v2 on their own. CookieDoo sets these defaults before they load: ad_storage, ad_user_data, ad_personalization, analytics_storage and personalization_storage denied; functionality_storage and security_storage granted. When the visitor chooses, it sends an update.
  • Other tags can use the event that CookieDoo pushes to the dataLayer after every choice:
dataLayer key Value
event cookiedoo_consent_update
cookiedoo_necessary always true
cookiedoo_preferences true / false
cookiedoo_statistics true / false
cookiedoo_marketing true / false

Create Data Layer Variables for the cookiedoo_* keys and a Custom Event trigger on cookiedoo_consent_update, and fire each tag only when its category is true.

If the Pixel is already on the page when CookieDoo starts, CookieDoo calls fbq('consent', 'revoke') at load and fbq('consent', 'grant') once marketing is allowed.