← EmDash plugins
EmDash plugin · Privacy

Privacy Choices for EmDash

Cookie banner, Google Consent Mode v2 and the tags that wait for consent — set up from the EmDash admin, without a third-party consent platform.

v0.1.0 · npm · EmDash registry soon
npm ↗ GitHub ↗ EmDash registry · soon
What it does

The banner is the easy part. The hard part is that nothing may set a cookie or call Google before the visitor chooses, that Accept and Reject weigh the same, that a withdrawn choice really stops the tags, and that you can show a choice was made. Privacy Choices does all of it in one plugin: the banner, the Consent Mode signals, loading GTM, GA4 and Meta Pixel, holding other trackers until their category is allowed, and a consent log — managed from the EmDash admin in every language the site has.

Features

Equal choices

Accept all and Reject all are always the same size, colour and weight. Nothing is pre-checked; a second layer has per-category switches and service lists.

Consent Mode v2

All seven keys, wait_for_update, region scoping (EEA + UK + CH), ads_data_redaction, url_passthrough, Advanced or Basic mode.

Tags from the admin

GTM or GA4 from Google, from your server-side GTM (own domain, path or Stape) or through Google tag gateway on Cloudflare. Meta Pixel with revoke and grant.

Automatic holding

Hotjar, Clarity, Meta, LinkedIn, TikTok, YouTube, Google Maps and other common tools wait for their category, even when a GTM tag adds them.

Withdrawal that works

Withdrawing a category deletes the cookies its common tools left behind and reloads the page once.

Consent log

One record per choice, without IP addresses or user agents. Filters, counters, CSV export and automatic rotation.

Your look

Bar, corner card or dialog, light and dark colours, ready-made styles and a live-site preview. Every save is checked against WCAG AA contrast.

Light runtime

One file, no dependencies, about 11 KB gzipped, in Shadow DOM with no layout shift. Text templates for English, Estonian, Russian and Finnish.

On the site and in the admin

The banner on a live site: Reject all and Accept all side by side
The banner on a live site: Reject all and Accept all side by side
Tags: GTM, GA4, server-side GTM, Google tag gateway and Meta Pixel
Tags: GTM, GA4, server-side GTM, Google tag gateway and Meta Pixel
Consent log with counters, filters and CSV export
Consent log with counters, filters and CSV export

Install

  1. 01

    From npm

    The native plugin runs in the site process and adds its script through <EmDashHead>, so it has to be the first script in <head>.

    Terminal
    npm install @tagperfect/emdash-plugin-consent
    astro.config.mjs
    import consent from "@tagperfect/emdash-plugin-consent/native";
    
    emdash({
      plugins: [consent],
    });
  2. 02

    From the EmDash registry — soon

    Once it is published in the registry, the sandboxed version installs from Plugins → Marketplace. The recommended setup then adds one component to the layout:

    Terminal
    npm install @tagperfect/emdash-consent-astro
    Layout
    ---
    import { ConsentHead, ConsentBodyStart } from "@tagperfect/emdash-consent-astro";
    ---
    <head>
      <meta charset="utf-8" />
      <ConsentHead locale={Astro.currentLocale} />
    </head>
    <body>
      <ConsentBodyStart locale={Astro.currentLocale} />
  3. 03

    Set it up

    Open Privacy choices in the admin: banner and texts, Consent Mode, where the tags load from, and the consent log. Remove any old banner and hard-coded GTM, GA4 or Pixel snippets — the plugin loads them itself.

11 KB
Runtime, gzipped · no dependencies
7
Consent Mode keys, all mapped
0
IP addresses in the consent log
MIT
Open source license
Works with
EmDashAstroGoogle Tag ManagerGA4Server-side GTMStapeGoogle tag gatewayMeta PixelCloudflare Workers

Questions

Does it make my site compliant?

It is a tool, not legal advice. It makes the right things possible — equal choices, nothing before consent, a log — but whether your texts and categories meet GDPR, ePrivacy and local rules is for you and your lawyer to decide.

Is it an IAB TCF CMP?

No. It does not produce TCF strings. If you serve programmatic ads that require TCF, use a certified CMP.

Does Google load before the visitor chooses?

In Advanced mode GTM and GA4 load with everything denied and send cookieless pings. In Basic mode nothing is requested from Google until analytics or marketing is allowed.

Is it free?

Yes. MIT licensed, source on GitHub.

Start a project

Let's build
something real.

Privacy This site collects anonymous usage data to improve your experience.
Analytics This site collects anonymous usage data to improve your experience.