Files
ipal-kit/docs/agent/skills/ipal-consent-check/SKILL.md
T

8.3 KiB

name, description
name description
ipal-consent-check Proves in a real browser (Playwright) that an ipal-kit site respects cookie consent — no Meta/Clarity/LinkedIn/TikTok/Ads requests and no tracking cookies before a decision or after "reject", Google only with Consent Mode "denied" signals, tags starting after "accept". Use after adding analytics, pixels, embeds (YouTube, maps, chat) or third-party scripts, before handing a site over, and whenever GDPR/RODO or cookie banner behaviour is in question.

ipal-consent-check

GDPR: non-Google tags load only after consent; Google (GA4/GTM) may load earlier only with the Consent Mode "denied" signal and without cookies. That early load happens only in Consent Mode advanced (the default); with <SiteProviders analytics={{ consentMode: 'basic' }}> no request goes to googletagmanager.com before analytics or marketing consent — check the project's choice in "Project decisions".

Steps

  1. Once per project:
    pnpm add -D playwright && pnpm exec playwright install chromium
    
  2. Start the app (pnpm build && pnpm start) and check a page with tags (ideally the homepage and a page with a form/video):
    node .agents/skills/ipal-consent-check/scripts/consent-check.mjs http://localhost:3000/pl
    
    --wait 6000 when tags start slowly (defer mode in Analytics).
  3. Output: three runs in clean profiles — no decision, "Accept", "Reject" + reload. Every [ERROR] is a violation — fix it:
Violation Cause → fix
pixel loaded without consent script wired by hand / copied Analytics → ID in Site integrations, <Analytics> from the plugin (analytics.md)
tracking cookie set without consent same; or GTM fires a tag without an ad_storage condition (analytics.md → GTM)
GA hit with consent GRANTED setDefaultConsent not before the tag — <Analytics> must be inside <ConsentProvider> (SiteProviders does this itself)
YouTube / Maps before consent (warning) ConsentScript (consent.md), youtube-nocookie.com or "click to load"
  1. The "after accept" section shows what starts after consent — compare it with the IDs in Site Integrations (e.g. is Meta Pixel there, if the client has one). Nothing starts but IDs are filled in → report it as a problem to diagnose (ipal-debug).
  2. Banner not found (data-ipal="banner") → <CookieBanner/> is not rendered, or an older ipal-kit version without data-ipal attributes on the buttons → ipal-upgrade.

The script needs buttons with data-ipal="accept" / "reject" — the plugin's CookieBanner has them in every settings mode (inline, modal, detailed). A custom banner in the project violates AGENT.md §7.

When the project has ipalKit({ cookieScanner: true }) (cookie-scanner.md), the editor fills the list in the panel and you check it:

  1. Not on yet → turn it on, pnpm generate:importmap, pnpm payload migrate:create cookie-scanner (Postgres), commit the migration. Embeds and widgets the plugin does not inject (YouTube, maps, chat): add them as cookieScanner.declarations (or an integrations entry with isEnabled) — never a hand-typed list in code.
  2. Privacy → Cookie review → Scan cookies. "Integrations in use" must match the IDs in Site Integrations; a filled ID that is missing → ipal-debug.
  3. Run the browser scan below and paste every cookie it reports as unknown into More cookie names, scan again. Entries with Found by = "Unknown — fill in" need provider, category and purpose: ask the client, do not guess.
  4. The editor accepts or rejects every draft (bulk edit works). Accepted → Cookie banner → Cookies, every language; existing text there is never overwritten. Open the banner's "Settings" and check each category lists its cookies.
  5. Database lookups come with category functional when the Open Cookie Database says "Functional" (it files some trackers there) — lower to necessary only when the cookie really is needed for the site to work.

When the project has cookieScanner: { crawl: true } (cookie-scanner.md → Browser crawl):

  1. Not on yet and the client wants it → turn it on; env IPAL_COOKIE_SCAN_URL + IPAL_COOKIE_SCAN_TOKEN (openssl rand -hex 32) in Coolify; ask the team to add <host>=<token> to the scanner service's IPAL_CRAWLER_SITES; generate:importmap, migrate:create cookie-crawl. Never add Playwright or Chromium to the site.
  2. Cookie review → Check site. "Check site" disabled → the box names the missing variable. Failed → Privacy → Cookie check → Error ("Could not reach the scanner service" = URL / DNS / firewall; a Cloudflare challenge page = allow the Coolify server's IP).
  3. Filter the list by Violation: every entry is a non-necessary cookie or key stored before consent — fix it as in the table above (or, if it really is necessary, set its category and accept it). Cookie check → Violations also lists tracker requests before consent.
  4. Classify the new drafts (Found by = "Unknown — fill in"), then crawl again: 0 violations is the goal before handover.
  5. Optional: recipients in Cookie check → Warning e-mails to, and a weekly Coolify scheduled task curl -X POST -H "Authorization: Bearer $IPAL_COOKIE_SCAN_TOKEN" $NEXT_PUBLIC_SERVER_URL/api/ipal/cookie-crawl. Record both in AGENTS.md → "Project decisions".

After every change of tools (new pixel, chat, map, video) and before handing the site over (with cookieScanner on, use step 1 below to find what really appears in the browser, then feed the unknown names to the panel scan above instead of step 2):

  1. Scan the running site (without consent and after "Accept all", homepage + up to 10 pages from the sitemap):
    node .agents/skills/ipal-consent-check/scripts/cookie-scan.mjs http://localhost:3000 --lang pl
    
    Output: cookie-scan/cookies.json and cookie-scan/cookies.md (table). [ERROR] = a non-necessary cookie set before consent — fix it as in the table above. [WARNING] unknown — find the provider and purpose, set category (necessary|functional|analytics|marketing) and purpose in cookies.json. Do not guess — ask if you do not know.
  2. Import into the panel (Cookie banner → Cookie list), each language separately (scan with --lang en for English):
    LOCALE=pl pnpm payload run .agents/skills/ipal-consent-check/scripts/import-cookies.ts cookie-scan/cookies.json
    
    It merges by name and does not overwrite editor changes (OVERWRITE=1 forces it). It does not delete cookies the scan did not see — the editor does that in the panel. The same list feeds the <CookieBanner settings="detailed"> window (an expandable list under each category) — after the import open "Settings" in the banner and check that every category shows its cookies and that the labels (Cookie banner → Settings window → Cookie list headings) are in that language.
  3. The cookie policy page shows the table from the panel — do not paste the list into the policy text:
    import { getCookieTable } from '@intecion/ipal-kit'
    import { CookieTable } from '@intecion/ipal-kit/rsc'
    import { getCachedPayload, getSiteShell } from '@/lib/content'
    const rows = await getCookieTable({ payload: await getCachedPayload(), locale })
    const { consent } = await getSiteShell(locale)   // category names from Cookie banner
    <CookieTable rows={rows} categories={consent.categories} labels={labels} />
    
    labels = { name, category, provider, purpose, duration } (all required). The plugin panel has only provider / purpose / duration (Cookie banner → Settings window → Cookie list headings = consent.details); take the name and category headers from (localized) fields of the project block. The table is unstyled (classNames: table, caption, tr, th, td; optional caption). A project "Cookie table" block on the policy page is a good place — then the editor decides where it appears.

Lifetime: Chrome caps every cookie at max. 400 days (13 months) — the scan shows what really stays in the browser. localStorage keys (e.g. ipal-theme — the chosen theme) are listed separately.