AddThisFeature

Consent and Cookie Preferences

Let users decide about optional tracking before the scripts load.

involved Privacy & Compliance

What it adds

A consent layer that blocks non-essential scripts and storage until the user allows them, and records the choice as proof.

What your agent is told to do

6
  1. 1

    Inventory every script, pixel, embed, and cookie the app sets, and classify each as strictly necessary, functional, analytics, or marketing.

  2. 2

    Block non-essential categories from loading at all until consent exists. Loading a tracker and then asking is not consent.

  3. 3

    Store the choice with a version, timestamp, and how it was given, so a later policy change can re-prompt only the people it affects.

  4. 4

    Give equal weight to accepting and rejecting, and provide a persistent way to reopen preferences and withdraw consent later.

  5. 5

    Apply the same decision on the server: server-side event forwarding, log enrichment, and backend analytics must read the stored consent rather than assuming the browser handled it.

  6. 6

    Do NOT gate the app behind the banner or make rejecting harder than accepting. A modal that traps the page or hides the reject option fails the regulation it was built for.

Edge cases it handles

7
  • Region defaults cannot rest on IP geolocation alone — it is wrong often enough to matter. Combine signals and default to the stricter policy when unsure.
  • Withdrawing consent must actively delete the cookies and local storage already set, not merely stop setting new ones.
  • The consent record itself is personal data; keep it minimal and covered by the retention policy.
  • Third-party embeds such as video players and maps set their own cookies — placeholder them until consent, rather than trusting them.
  • A user with consent on one device has not consented on another; the choice is per-browser unless the user is signed in and you sync it.
  • The banner must be keyboard-navigable and screen-reader-usable, and must not be the first focus trap a user hits.
  • Bots and prerender requests should not create consent records or block essential rendering.

Definition of done

9
  • Every script and cookie is classified and non-essential ones do not load before consent.
  • Accept and reject are equally prominent and equally easy.
  • Consent is stored with version, timestamp, and source.
  • Preferences can be reopened and withdrawn, and withdrawal clears already-set cookies and storage.
  • Server-side tracking respects the stored consent.
  • Regional defaults do not rely solely on IP geolocation.
  • The consent UI is fully keyboard and screen-reader accessible.
  • The feature matches the existing design system.
  • No existing functionality is broken.

Related features

How it works

  1. 1

    Copy the link

    Grab the Markdown instruction URL for this feature.

  2. 2

    Give it to your AI

    Paste it into Claude Code, Cursor, v0, Lovable — whatever you build with.

  3. 3

    It inspects, then implements

    Your agent reads your existing app first, then adds the feature to fit it.

Works with your stack

These instructions are written to adapt. They tell the agent to detect your framework, match your existing design system, and reuse what you already have — rather than assuming a particular stack.

Need it tighter than that? Customize the feature and tell it exactly what you're running.