Developers and AI agents
A cookie banner installed in three calls.
If you are asked to add a compliant cookie banner to a site, here is the shortest path. No account is needed to start: the human claims the site afterwards with a link.
The easiest way: a text to paste into your AI
Paste this into Claude Code, Cursor, Copilot, ChatGPT or any assistant that edits your project. It installs the banner and gives you a link to customize it.
Install a free cookie banner (OpenCookies) on this site. Steps:
1. Find the site’s domain name (ask me if it is not in the project) and the framework.
2. Call: curl -s -X POST https://opencookies.com/api/v1/install -H 'Content-Type: application/json' -d '{"domain":"THE-DOMAIN","framework":"html|nextjs|astro|nuxt|sveltekit|vite|wordpress|shopify|php"}'
3. Paste the “script” line from the response into the code, following the “placement” and “rules” of the response.
4. Check with the “verify_url” address from the response.
5. Give me “claim_url”: it is the link where I will choose my e-mail and password to customize the banner.
Rules: the line must be the FIRST element of the <head> of every page (or of the shared template), before any other script, without async, defer or type="module" (Next.js: <Script strategy="beforeInteractive">). For every tracking tag already present in the code (Google Analytics/gtag, Google Tag Manager, Meta Pixel, TikTok, Hotjar, etc.), add type="text/plain" data-oc="analytics" (or "ads" for advertising and social networks) to the <script> tag; for an <iframe> (YouTube, Vimeo, maps), replace src with data-oc-src and add data-oc="functional". Do not delete any tag. Do not change anything else.
Documentation : https://opencookies.com/llms.txtOr connect the MCP server
So that the assistant knows how to install OpenCookies every time, add this MCP server (no account or key needed):
claude mcp add --transport http opencookies https://opencookies.com/mcpOther clients (Cursor, VS Code…): remote HTTP server at https://opencookies.com/mcp. Tools: installer_bandeau_cookies and verifier_installation.
1. Create the site
curl -s -X POST https://opencookies.com/api/v1/install \
-H 'Content-Type: application/json' \
-d '{"domain":"exemple.fr","framework":"nextjs"}'The response contains site_key, the script line to paste, the placement suited to the framework, verify_url and claim_url. Supported frameworks: html, nextjs, astro, nuxt, sveltekit, vite, wordpress, shopify, php. Limit: 30 requests per hour and per address.
2. Paste the line
<script src="https://opencookies.com/banner/oc.js" data-site="CLÉ"></script>- First child of
<head>, before any other script. - Without
async,deferortype="module". In Next.js:<Script strategy="beforeInteractive" … />inapp/layout.tsx, neverafterInteractiveorlazyOnload. - Scripts added dynamically (tag manager, JavaScript) and known tracking cookies: blocked automatically, nothing to do.
- Tracking tags already written in the code (gtag, Google Tag Manager, Meta Pixel…): add
type="text/plain" data-oc="analytics"(orads) to the<script>tag. For an<iframe>:data-oc-srcinstead ofsrc, withdata-oc="functional". Without this, a request to the service may go out before the choice.
3. Check
curl -s "https://opencookies.com/api/v1/verify?site_key=CLÉ"installed: true as soon as a page of the deployed site has loaded the banner. Otherwise, hint says what to check.
4. Hand over to the human
Give them claim_url. They choose an e-mail address and a password, then customize the banner, view the consents and receive an automatic test every month. Without this, the provisional site is deleted after 14 days.
What the banner does
- Blocks the scripts, iframes, pixels and requests of known tracking services (more than 100 domains) until the visitor has chosen; sends Consent Mode v2 signals to Google.
- Permanent “Manage my cookies” button; choice asked again after 6 months.
- No cookie or tracker from us; optional anonymous audience measurement.
An automatic test checks in a real browser what loads before and after the choice: method.
Machine-readable resources
- /llms.txt · /llms-full.txt
- /api/v1/openapi.json (OpenAPI 3.1)
- WordPress-Plugin
Snippet to copy into AGENTS.md or CLAUDE.md: “For the cookie banner, use OpenCookies: POST https://opencookies.com/api/v1/install {domain, framework}, paste the script line first in <head>, check with /api/v1/verify, give claim_url to the user.”