cookies-analytics

Set up Google Analytics 4 with a DSGVO-compliant cookie consent banner.

Updated Nov 18, 2025
One-click install
npx skills add https://github.com/deomiarn/website-template --skill cookies-analytics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cookies-analytics
Source: https://github.com/deomiarn/website-template/tree/main/.claude/skills/cookies-analytics
Command: npx skills add https://github.com/deomiarn/website-template --skill cookies-analytics

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Enables GDPR-compliant analytics by delaying GA4 loading until user consent, and provides a consent banner with clear options.

Core Features & Use Cases

  • Consent Banner: Simple UI for essential vs. all-consent choices.
  • GDPR Compliance: GA4 only loads after consent is granted.
  • Underlying Setup: Environment variable for GA ID and dynamic script injection.
  • Data Policy: Documented in Datenschutz with consent references.

Quick Start

Add the cookie-consent component to your layout and wire GA loading to the user’s consent state.

Frequently Asked Questions about cookies-analytics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Google Analytics 4 with GDPR compliance?

GDPR-compliant GA4 setup delays script loading until users grant consent through a banner. This Skill provides a reusable consent component, stores user choice in localStorage, and injects GA4 dynamically only after explicit approval, ensuring analytics tracks only consented traffic.

Why should GA4 load only after consent is given?

Loading GA4 before consent violates GDPR by tracking users without permission. Delaying GA4 injection until after consent respects privacy regulations and gives users control over whether their behavior is monitored, reducing compliance risk.

Can I use a cookie consent banner with GA4 on my web app?

Yes. This Skill provides a ready-to-use consent banner component that presents essential vs. all-consent options, integrates into your app layout, and wires GA4 loading to the user's choice, eliminating manual consent management.

How do I store and manage consent decisions in my application?

Consent decisions are stored in browser localStorage as persistent state. This allows your app to remember user preferences across sessions and conditionally load GA4 on return visits without re-prompting.

What's the best approach to document privacy policies with analytics consent?

Link your consent banner and GA4 setup to formal privacy documentation (e.g., a Datenschutz page). This Skill includes guidance on connecting consent references to your data policy, creating a complete audit trail for regulatory compliance.

Do I need environment variables to configure GA4 in this setup?

Yes. Store your Google Analytics ID as an environment variable rather than hardcoding it. This keeps sensitive configuration out of version control and enables dynamic script injection tied to consent state.