# Consent Platform — Per-Client Testing Checklist

Run this for every new client and after any change to a client's
`ConsentConfig` or to the shared `consent-manager.js`/`analytics.js`/`dni.js`.

Use a fresh Incognito/Private window for "first visit" tests, and disable
browser cache in DevTools Network tab throughout.

## Pre-flight

- [ ] `https://cdn.adhome.me/js/consent-manager.js` returns 200, Content-Type
      is JS, body starts with the expected header comment
- [ ] `https://cdn.adhome.me/css/consent-manager.css` returns 200, Content-Type is CSS
- [ ] Exactly one `<script src="...consent-manager.js">` tag renders on the page
      (view actual Network response, not just editor source)
- [ ] `window.ConsentConfig` in console matches the intended config
- [ ] `ConsentManager.config` in console matches `window.ConsentConfig`
      (if `client` shows `"unknown"`, stop — fix load order first)

## First visit (no prior consent)

- [ ] Banner appears (if any optional category is `enabled: true`)
- [ ] No analytics/advertising network requests fire before a choice is made
- [ ] `gtag('consent', 'default', ...)` / Consent Mode defaults are set before
      any GA4/Ads/Clarity request goes out (check Network tab ordering)
- [ ] Privacy Policy link (if configured) opens the correct page

## Returning visitor (consent already stored)

- [ ] Banner does NOT reappear
- [ ] Stored choice is respected immediately on load (correct scripts fire,
      others stay blocked) without user interaction
- [ ] `document.cookie` / `localStorage` show the expected `adh_consent` value

## Accept All

- [ ] Clicking Accept All fires `consent_updated` with all enabled
      categories `true`
- [ ] Every enabled optional script now loads (GA4, Clarity, Ads/UET/Meta
      Pixel if applicable, DNI/Scheduler if applicable)
- [ ] Banner closes

## Reject Optional

- [ ] Clicking Reject Optional fires `consent_updated` with all optional
      categories `false`
- [ ] No optional scripts load
- [ ] Banner closes

## Manage Preferences (granular)

- [ ] Opens the preferences modal with correct current state pre-filled
- [ ] Necessary category shown as always-on, disabled toggle
- [ ] Each enabled category can be toggled independently
- [ ] Save Preferences applies exactly the toggled state, no more/less
- [ ] Focus trapping works (Tab cycles within modal, Escape closes)

## Withdrawing consent

- [ ] Reopening preferences and turning OFF a previously-granted category:
  - [ ] fires `consent_updated` with that category `false`
  - [ ] matching cookies for that category are cleared
      (check against `cookiePatterns` for that category)
  - [ ] page reloads (if `reloadOnWithdraw` is true) or otherwise stops
      further use of that category's data
- [ ] Persistent "Privacy Choices" button is reachable after initial choice
      and after scrolling/navigating

## Category-specific firing

- [ ] GA4 fires only after `analytics` granted
- [ ] Clarity fires only after `analytics` granted
- [ ] Google Ads tag fires only after `advertising` granted
- [ ] Microsoft UET fires only after `advertising` granted
- [ ] Meta Pixel fires only after `advertising` granted
- [ ] DNI loads only after its configured category is granted (or
      immediately if configured as `"necessary"` — confirm that's correct
      for this client)
- [ ] Scheduler Pro loads only after its configured category is granted

## GTM specific

- [ ] GTM Preview mode confirms tags fire only after correct consent state
- [ ] `dataLayer` shows `consent_ready` on load and `consent_updated` on
      every change, each with correct `consentAnalytics` /
      `consentAdvertising` / `consentFunctional` / `consentClient` values

## Fail-safe behavior

- [ ] With `localStorage`/cookies manually corrupted (e.g. set
      `adh_consent` to garbage JSON), the site treats state as "no consent"
      and denies optional tracking rather than erroring or defaulting to granted
- [ ] With `window.ConsentConfig` entirely removed, the script does not throw
      and simply shows no banner (console warning present)

## Devices / browsers

- [ ] Mobile Safari (iOS)
- [ ] Mobile Chrome (Android)
- [ ] Desktop Chrome
- [ ] Desktop Safari
- [ ] Desktop Firefox
- [ ] Desktop Edge
- [ ] Incognito/Private mode on at least one mobile and one desktop browser
- [ ] Banner and modal are usable at narrow (375px) width — no horizontal
      overflow, buttons don't overlap

## Regression check after shared file changes

Whenever `consent-manager.js`, `analytics.js`, `dni.js`, or the CSS is
updated centrally, re-run at minimum "First visit", "Accept All", "Reject
Optional", and "GTM specific" above for a representative client of each
`tagMode` (one `"gtm"` site, one `"direct"` site) before considering the
update safe to leave live for all clients.
