PrivacyQuick

All documentation pages ↓

Install PrivacyQuick on Ghost

Paste one tag into Ghost's site header code, tag the scripts and embeds that should wait for consent, and test on the live site.

Ghost has a Code injection setting that adds code to the head of every page. That's where the PrivacyQuick tag goes. Ghost renames settings from time to time; if a name below doesn't match, search Ghost's help for "code injection".

Do you need a banner? Ghost says it doesn't set non-essential cookies by default. You need consent once you add analytics, ad pixels, or embeds such as YouTube that set their own cookies. A free scan of your live site shows what it loads today.

1. Add your site and copy the snippet

In the PrivacyQuick dashboard, add your domain and copy the snippet from the site's Overview tab:

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

2. Paste it into the site header

  1. In Ghost Admin, open Settings and find Code injection.
  2. Paste the snippet at the top of the Site header box, above anything already there.
  3. Save. The change is live straight away.

If you edit your theme instead, put the tag near the top of <head> in default.hbs, before {{ghost_head}}. Code injection is simpler and survives theme changes.

3. Tag the scripts that should wait

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 comes before every tracking script in your site header and theme.

PrivacyQuick holds back a script only when its tag has type="text/plain" and a data-category of analytics, functional or marketing. Change analytics and ad tags you've pasted into Code injection the same way:

<!-- before -->
<script src="https://example-analytics.com/tag.js" async></script>

<!-- after -->
<script type="text/plain" data-category="analytics" src="https://example-analytics.com/tag.js" async></script>

Embeds in posts

Ghost's YouTube and other embed cards load from the provider when the page opens. To make an embed wait, use an HTML card with a tagged iframe instead:

<iframe data-src="https://www.youtube-nocookie.com/embed/VIDEO_ID" data-category="functional" width="560" height="315" title="Video"></iframe>

Ghost's own membership and sign-in cookies are needed for those features to work, so they don't need consent. See Cookie categories and Blocking scripts.

4. Add a "Cookie settings" link

In Settings → Navigation, add a secondary (footer) item called "Cookie settings" with the URL #cookie-settings. Then add this to the Site footer box in Code injection:

<script>
document.addEventListener('click', function (e) {
  var a = e.target.closest('a[href$="#cookie-settings"]');
  if (a) { e.preventDefault(); if (window.PrivacyQuick) PrivacyQuick.open(); }
});
</script>

5. Test on the live site

  1. Open your site in a private window. The banner should appear.
  2. In the browser's developer tools, open the Network tab and reload. Tagged scripts and embeds shouldn't load before you choose.
  3. Click Accept all. They load straight away, and the banner stays closed on the next page.
  4. Click your "Cookie settings" link. The preferences panel opens.

Finish the setup

Stuck? See Troubleshooting or email [email protected].