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.
Installation Method 1: WordPress Plugin (Recommended)
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:
- Go to Plugins > Add New > Upload Plugin.
- Choose the downloaded ZIP file.
- Click Install Now, then Activate Plugin.
Configure the Plugin
- Navigate to Settings > GetCookies in your WordPress admin.
- Paste your Domain ID (found in GetCookies dashboard under Domains > Widget Configuration).
- Configure these settings:
| Setting | Description | Recommended |
|---|---|---|
| Enable Banner | Show the consent banner | On |
| Auto-block Scripts | Automatically block known tracking scripts before consent | On |
| Widget Position | Where the floating preferences button appears | Bottom Left |
| Privacy Page | Link to your cookie/privacy policy page | Select your policy page |
- Click Save Changes.
Installation Method 2: Manual Script (Theme Editing)
If you prefer not to use a plugin, add the script directly to your theme.
Option A: functions.php (Recommended Manual Method)
Add to your child theme's functions.php:
<?php
function getcookies_enqueue_banner() {
wp_enqueue_script(
'getcookies-banner',
'https://app.getcookies.co/api/v1/widget/loader.js',
array(),
null,
false // Load in <head>, not footer
);
wp_script_add_data('getcookies-banner', 'async', true);
wp_script_add_data('getcookies-banner', 'data-domain-id', 'YOUR_DOMAIN_ID');
}
add_action('wp_enqueue_scripts', 'getcookies_enqueue_banner');
?>Option B: header.php
If your theme does not support wp_enqueue_scripts data attributes, add directly to header.php inside the <head> tag:
<!-- GetCookies - Cookie Banner -->
<script src="https://app.getcookies.co/api/v1/widget/loader.js"
data-domain-id="YOUR_DOMAIN_ID"
async></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:
- Ensure your analytics scripts are loaded via GTM or wrapped with
data-cookieconsent="analytics". - For the WooCommerce Google Analytics Integration plugin, enable Auto-block Scripts in GetCookies settings.
Conversion Tracking Pixels
For Facebook/Meta Pixel, Google Ads conversions, and other advertising pixels:
- Move them into Google Tag Manager where possible.
- For hard-coded pixels, add
type="text/plain"anddata-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
- Exclude the GetCookies JavaScript from minification and combination. Add this URL to your exclusion list:
app.getcookies.co/api/v1/widget/loader.js - Clear the cache after enabling or changing GetCookies settings.
- 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
- Go to Settings > WP Rocket > File Optimization.
- Under Excluded JavaScript Files, add:
app.getcookies.co - Clear the cache.
Cloudflare (if used alongside WordPress)
- Create a Page Rule or Cache Rule for your domain that bypasses cache for the GetCookies script URL.
- Alternatively, purge the Cloudflare cache after making changes.
Multisite / Network Installations
For WordPress Multisite:
- Network activate the plugin to enable it across all sites.
- Each site needs its own Domain ID configured under Settings > GetCookies on that site.
- If all sites share a single domain, you can use one Domain ID.
Shortcodes
The GetCookies plugin provides shortcodes for embedding consent controls anywhere:
[getcookies_settings]Displays the full cookie preferences panel inline on any page (useful for a dedicated cookie settings page).
[getcookies_button]Adds a "Manage Cookie Preferences" button that opens the consent modal.
PHP Developer Functions
For theme or plugin developers who need consent-aware logic:
<?php
// Check if user consented to a specific category
if (function_exists('getcookies_has_consent') && getcookies_has_consent('marketing')) {
// Safe to output marketing scripts
}
// Get all consent choices as an associative array
$consent = getcookies_get_consent();
// Returns: ['necessary' => true, 'analytics' => false, 'marketing' => false, 'preferences' => false]
?>Verify the Installation
- Open your site in an incognito/private window.
- Confirm the consent banner appears on the first page load.
- Open DevTools > Network and check that tracking scripts do not fire before consent.
- Accept consent and verify trackers now load.
- Check your GetCookies dashboard under Consent Logs to see the test consent recorded.
Troubleshooting
Banner not appearing
- 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.
Scripts still loading before consent
- Enable Auto-block: Ensure it is turned on in plugin settings.
- Hard-coded scripts: If scripts are added directly in your theme, wrap them with
data-cookieconsentattributes 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.
Banner appears but looks broken
- Theme CSS conflicts: Some themes have aggressive CSS resets. Use the Custom CSS option in your GetCookies dashboard to add
!importantoverrides 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.