Back to the help center

Integrations

WordPress setup

Install and configure the banner on WordPress

A complete guide to installing and configuring GetCookies on your WordPress site, covering the plugin method, manual installation, WooCommerce considerations, and troubleshooting.

Install via ZIP Upload

The plugin is not listed in the WordPress.org plugin directory. Download the ZIP from your GetCookies dashboard (Domains > Integrations), then:

  1. Go to Plugins > Add New > Upload Plugin.
  2. Choose the downloaded ZIP file.
  3. Click Install Now, then Activate Plugin.

Configure the Plugin

  1. Navigate to Settings > GetCookies in your WordPress admin.
  2. Check the Domain ID. It is filled in when you download the plugin from your dashboard; otherwise copy it from Domains > Widget Configuration.
  3. Review these settings:
SettingDescriptionRecommended
Hold back trackersHolds back known trackers until consent, whether a plugin, your theme or code pasted into a theme file adds themOn
Google tagsLets Google tags load in Consent Mode (cookieless pings) instead of waiting for consentYour choice
Google Tag ManagerAdds your Google Tag Manager containerOnly if GTM is not added elsewhere
  1. Click Save Changes.

Banner text, design and languages are set in the GetCookies dashboard, not in WordPress.

Installation Method 2: Manual Script (Theme Editing)

If you prefer not to use a plugin, add the script directly to your theme.

Add to your child theme's functions.php:

php
<?php
// Prints the loader at the top of <head>, before other scripts.
function getcookies_print_loader() {
    echo '<script src="https://app.getcookies.co/api/v1/widget/loader.js" data-domain-id="YOUR_DOMAIN_ID"></script>' . "\n";
}
add_action('wp_head', 'getcookies_print_loader', 1);
?>

Option B: header.php

Or add it directly to header.php, as the first script inside the <head> tag:

html
<!-- GetCookies - Cookie Banner -->
<script src="https://app.getcookies.co/api/v1/widget/loader.js"
        data-domain-id="YOUR_DOMAIN_ID"></script>
Important: Always use a child theme when editing theme files. Direct edits to the parent theme will be lost on theme updates.

WooCommerce Considerations

WooCommerce stores often have additional tracking scripts for analytics and advertising. Here is how to handle them:

Payment and Cart Scripts

Payment gateway scripts (Stripe, PayPal) and cart functionality scripts are considered Strictly Necessary and should not be blocked. GetCookies handles this automatically for known payment scripts.

WooCommerce Analytics

If you use WooCommerce Analytics or Google Analytics for eCommerce tracking:

  1. Google Analytics follows Google Consent Mode, which the loader sets to denied before any Google tag runs. To make it wait for consent instead, turn off Google tags under Settings > GetCookies.
  2. Analytics scripts GetCookies does not recognise need type="text/plain" and data-cookieconsent="analytics".

Conversion Tracking Pixels

For Facebook/Meta Pixel, Google Ads conversions, and other advertising pixels:

  1. Known pixels (Meta, TikTok, Pinterest, LinkedIn, Microsoft Advertising and others) are held back automatically, including when they are pasted straight into your theme.
  2. For pixels GetCookies does not recognise, add type="text/plain" and data-cookieconsent="marketing" to the script tags.

Handling Caching Plugins

Caching can interfere with consent banner behavior. Configure your caching plugin to work correctly:

WP Super Cache / W3 Total Cache / LiteSpeed Cache

  1. Exclude the GetCookies JavaScript from minification and combination. Add this URL to your exclusion list: getcookies.co/api/v1/widget/loader.js
  2. Clear the cache after enabling or changing GetCookies settings.
  3. Do not cache the consent cookie. Most caching plugins handle this automatically, but verify that pages are not served from cache with stale consent states.

WP Rocket

  1. Go to Settings > WP Rocket > File Optimization.
  2. Under Excluded JavaScript Files, add: getcookies.co/api/v1/widget/loader.js
  3. Clear the cache.

Cloudflare (if used alongside WordPress)

  1. Create a Page Rule or Cache Rule for your domain that bypasses cache for the GetCookies script URL.
  2. Alternatively, purge the Cloudflare cache after making changes.

Multisite / Network Installations

For WordPress Multisite:

  1. Network activate the plugin to enable it across all sites.
  2. Each site needs its own Domain ID configured under Settings > GetCookies on that site.
  3. If all sites share a single domain, you can use one Domain ID.

Shortcode

[getcookie_preferences]

Adds a "Cookie Preferences" link that reopens the banner, for example in your footer or on your cookie policy page. Custom text: [getcookie_preferences]Change cookie settings[/getcookie_preferences].

The plugin has no PHP consent functions: consent is stored in the visitor's browser. Use the JavaScript API (window.GetCookies.hasConsent('marketing')) or mark scripts with type="text/plain" and data-cookieconsent so they run only after consent.

Verify the Installation

  1. Open your site in an incognito/private window.
  2. Confirm the consent banner appears on the first page load.
  3. Open DevTools > Network and check that tracking scripts do not fire before consent.
  4. Accept consent and verify trackers now load.
  5. Check your GetCookies dashboard under Consent Logs to see the test consent recorded.

Troubleshooting

  • Check Domain ID: Verify it matches exactly in Settings > GetCookies and your GetCookies dashboard.
  • Clear all caches: Purge WordPress cache, CDN cache, and browser cache.
  • Check for JavaScript errors: Open DevTools > Console and look for errors.
  • Plugin conflicts: Temporarily disable other plugins to isolate the issue. Common conflicts include other cookie banner plugins or script-optimization plugins.
  • Hold back trackers: Ensure it is turned on in plugin settings, and that Automatic tracker blocking is On in your GetCookies dashboard (sites added before November 2026 start in Monitor).
  • Unrecognised scripts: Known trackers are held back wherever they appear, including theme files. Scripts GetCookies does not recognise need data-cookieconsent attributes, or move them to GTM.
  • Plugin-injected scripts: Some plugins add tracking scripts that bypass the consent banner. Check which plugins inject scripts and either configure them to respect consent or use the data-attribute blocking method.
  • Theme CSS conflicts: Some themes have aggressive CSS resets. Use the Custom CSS option in your GetCookies dashboard to add !important overrides if needed.
  • Z-index issues: If the banner appears behind other elements, add custom CSS: .gc-banner { z-index: 999999 !important; }

WooCommerce checkout issues

  • If the checkout page is affected, ensure payment scripts are not being blocked. Payment scripts should be categorized as Strictly Necessary.
  • Verify that the cart and checkout pages function correctly after enabling the banner.

Still stuck?

Email [email protected] with your domain and what you tried. Signed-in customers can also open a ticket from the dashboard.