PrivacyQuick

All documentation pages ↓

Install PrivacyQuick on WordPress

Five steps: copy your snippet, add it to the head of every page, tag the scripts that track visitors, exclude the banner from JavaScript optimization, and test.

PrivacyQuick doesn't need a WordPress plugin of its own. The banner is one script tag, so you add it the same way you'd add any header code. This page is the short version. For background on what WordPress sites typically load and why, read the full guide to adding a cookie banner to WordPress.

What you need: a PrivacyQuick account (the Free plan is fine), and permission to add code to your site's header, either through a plugin or a child theme. Allow five minutes for the banner, plus a few more for each tracking plugin you need to tag.

1. Add your site and copy the snippet

In the dashboard, add your domain, for example example.com. The site goes live with a default banner and a first cookie scan is queued. Copy the snippet shown next to your site. It looks like this, with your own site ID:

<script src="https://cdn.privacyquick.com/v1/privacy.js" data-site-id="pq_xxxxxxxxxx" async></script>

2. Put the snippet in the head of every page

Pick one of these two methods. Both work with classic and block themes, because block themes still run the wp_head hook.

Option A: a header and footer plugin (no code)

  1. Install a header and footer plugin, for example WPCode's free "Insert Headers and Footers" feature.
  2. Open its header section (in WPCode: Code Snippets → Header & Footer; menu names change between versions).
  3. Paste the snippet at the top of the Header box and save.

Option B: a wp_head hook in your child theme

Add this to your child theme's functions.php or a small custom plugin. Don't edit the parent theme, because updates overwrite it.

add_action( 'wp_head', function () {
    echo '<script src="https://cdn.privacyquick.com/v1/privacy.js" data-site-id="pq_xxxxxxxxxx" async></script>' . "\n";
}, 1 );

Priority 1 prints the tag before most plugins, which use the default priority of 10. That matters for Google tags: the banner sets the Consent Mode default as soon as it runs, so it should come first.

3. Tag the scripts that track visitors

Rather not tag each script? Put the automatic blocker line directly above the snippet. It holds scripts from known analytics and advertising services, so you only tag what it doesn't cover. It has to load before those scripts, so it only helps if it is the first script in the head, ahead of anything your theme or plugins add.

The banner on its own doesn't stop anything. A script waits for consent only when its tag has type="text/plain" and a data-category of analytics, functional or marketing. How you change the tag depends on how it got onto the page.

Code you pasted yourself

Edit it where you pasted it (WPCode, the theme customizer, a widget):

<!-- before -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>

<!-- after -->
<script type="text/plain" data-category="analytics" async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>

Inline scripts work the same way: add type="text/plain" data-category="…" to the opening tag. Iframes such as YouTube or Google Maps use data-src instead of src, plus data-category. See Blocking scripts for every pattern.

Scripts that plugins add

Plugins usually load scripts with wp_enqueue_script(), so there's no tag to edit. Find the script's handle in the page source (WordPress gives the tag an id of the handle followed by -js), then rewrite the tag with the script_loader_tag filter:

add_filter( 'script_loader_tag', function ( $tag, $handle ) {
    $categories = array(
        'example-analytics' => 'analytics', // replace with the real handles
        'example-pixel'     => 'marketing',
    );
    if ( ! isset( $categories[ $handle ] ) ) {
        return $tag;
    }
    $tag = preg_replace( '/(<script\b[^>]*?)\stype=([\'"])[^\'"]*\2/', '$1', $tag );
    return str_replace( '<script', '<script type="text/plain" data-category="' . esc_attr( $categories[ $handle ] ) . '"', $tag );
}, 10, 2 );

Some plugins print their tags directly in wp_head or through their own settings instead. If a plugin has a setting to add the tracking code manually, use that and paste a tagged version. Google tags added by plugins such as Site Kit read the Consent Mode signals the banner sends, so they hold back cookies until consent even if you don't tag them. That is Google's "advanced" setup, where the tags still load and send cookieless pings; tag them as well if you want them blocked completely. Either way, check that the PrivacyQuick tag appears above them in the page source.

Not sure what your site loads? Run the free cookie scan. It lists the cookies and third-party hosts on your pages, which tells you which plugins need tagging.

4. Exclude the banner from JavaScript optimization

Page caching is fine: the banner decides what to show in the visitor's browser, not in the cached HTML. JavaScript optimization features are the usual cause of trouble:

FeatureWhat goes wrongFix
Delay JavaScript until interactionThe banner only appears after the visitor scrolls or clicksAdd privacy.js or cdn.privacyquick.com to the delay exclusions
Combine or minify JavaScriptTagged scripts get merged into one file and run without consentExclude the banner and every text/plain script
Defer all JavaScriptLoad order changes, tagged scripts may lose their typeExclude the banner; check tagged scripts keep type="text/plain"
Cloudflare Rocket LoaderRewrites script tagsAdd data-cfasync="false" to the banner tag, or turn Rocket Loader off

After changing settings, purge every cache: the plugin's, your host's and your CDN's.

5. Test it

  1. Open your site in a private window. The banner should appear (on the Free plan, everyone sees the opt-in banner).
  2. In the browser's developer tools, open the Network tab and reload. Tagged scripts shouldn't load before you choose.
  3. Click Accept all. Tagged scripts load straight away, without a reload.
  4. Reload: the banner stays closed and the floating cookie button appears.
  5. In the dashboard, the site shows Installed within a minute or two.

If the banner doesn't show, look for a console warning starting with PrivacyQuick: config not loaded, which usually means a wrong data-site-id. If it shows but scripts still run before consent, view the page source and check that their tags really have type="text/plain"; an optimization plugin may have rewritten them.

Finish the setup

  • Add a "Cookie settings" link to your footer menu with a Custom HTML block: <a href="#" onclick="window.PrivacyQuick && PrivacyQuick.open(); return false;">Cookie settings</a>.
  • Point WordPress's privacy policy page (Settings → Privacy) to a policy that describes your cookies. The policy generator can embed one with a cookie table that updates from your scans.
  • Read WordPress GDPR compliance beyond the cookie banner for comments, embeds and forms.

Stuck? Email [email protected] with your site address.