Scope: source review of the dev mirror /var/www/git/lit-website (HEAD bef231b; the analytics/consent/contact files are unmodified in the working tree). Patches and tests are in work/analytics501/.
Not done: no live site or preview request, no browser run, no lead submitted, no GA data read, no deployment, no edit to the mirror. Nothing here proves behavior in a real browser or in the GA property.
Labels: [C] confirmed from source or a local test. [A] assumption or needs owner or runtime verification.
| # | Severity | Finding | Status |
|---|---|---|---|
| A1 | High | A declined visitor still gets gtag.js loaded from googletagmanager.com and a config hit queued with no consent default | [C] source and harness; real network hit [A] |
| A2 | High | Detailed banner button "Accept all" / "Alle akzeptieren" calls the decline handler and stores analytics:false | [C] |
| A3 | Med | Withdrawal only sends consent update denied. _ga* cookies are not deleted and the script stays loaded | [C] |
| A4 | Med | initGA() is not idempotent. Each consent change appends another gtag.js script and another config | [C] harness: 2 script tags |
| A5 | Med | No consent default, so Consent Mode is not implemented. ad_user_data and ad_personalization are never set | [C] |
| A6 | Med | NEXT_PUBLIC_GA_ID is build-time only. The repo has no .env*, and the Dockerfile has no ARG or ENV for it, so GA may never load | [C] repo; deployed value [A] |
| A7 | Low | trackPageView and trackEvent are never called. There are no contact or CTA events, and no SPA page views | [C] |
| A8 | Low | The banner description is hardcoded English in the provider, so DE and FR visitors see English | [C] |
| A9 | Low | The npm package gtag@^1.0.1 is in package.json but unused (lib/analytics.ts uses its own code) | [C]; recommend removal [A] |
| P1 | High | /api/contact returns 202 when the CRM call fails. Both forms treat response.ok as success, so the visitor sees "success" while the lead exists only in server logs | [C] |
| P2 | High | The route logs full PII (name, email, phone, free text, IP, UA) with console.log, and echoes originalFormData back in the response | [C] |
| P3 | Med | GDPR consent fields (gdprConsentTimestamp, version, basis, retention) are only logged. They are not persisted to the CRM | [C] |
| P4 | Med | The privacy policy states IP anonymization, "automatic deletion after 26 months" and Facebook plug-ins that the code does not match | See §4 |
| P5 | Low | The route has no rate limit, honeypot or captcha, and OPTIONS returns Access-Control-Allow-Origin: * | [C] |
Files: lib/analytics.ts, components/cookie-consent-provider.tsx, components/blocks/cookie-consent.tsx, app/[locale]/layout.tsx:49 (the provider wraps all pages). There is no <Script> or GTM tag in the layout. GA is injected only by initGA().
Flow as implemented:
cookieConsent cookie. The banner shows and GA is not initialized (provider effect, cookie-consent-provider.tsx lines 239–243). [C] This part is correct.initGA() and then enableGA() or disableGA(). initGA() runs even when the saved choice is "decline".initGA(). It pushes js, appends the gtag.js?id=… script tag and pushes config, with no preceding consent default. Per Google's documented behavior, with no default, storage is treated as granted. So the config/page_view command is processed as granted before the later consent update denied. [A: this is documented Google behavior and was not measured on the network.]setConsent, which calls initGA() again.Local harness (harness.ts, output in harness-output.txt): fake window/document, fake ID G-TEST000000, no network.
| Scenario | Original | Patched |
|---|---|---|
| decline | 1 script tag, config queued, _ga* cookies remain | 0 script tags, no commands, _ga* removed |
| accept | no consent default before config | consent default denied → config → update granted |
| accept twice | 2 script tags, 2 × js/config | 1 script tag |
| accept → withdraw | 2 script tags, _ga* remain | _ga* removed, ga-disable-<ID> set |
Notes:
anonymize_ip: true is ignored by GA4 (IP truncation is always on). Harmless, but it is not evidence of a privacy measure. [A: my knowledge of GA4, not verified against this property.]cookie_flags: 'SameSite=None;Secure' is only needed for cross-site contexts. I left it unchanged to preserve behavior.cookieConsent is first-party JSON with no Secure flag. That is acceptable for a consent record.components/contact-form-modal.tsx:192 and app/[locale]/contact-form/page.tsx:170. Both fetch('/api/contact', POST). The GDPR checkbox is required in both (disabled={isSubmitting || !watchGdprConsent}).app/api/contact/route.ts) validates company, email and fullName, then calls Twenty CRM through lib/graphql-client.ts (company, person, note, note target). Env: GRAPHQL_ENDPOINT, TWENTY_API_KEY.error: 'CRM system temporarily unavailable' (route lines 258–272). The forms check response.ok, which is true for 202, so the UI shows submitSuccess. The only record is the stdout log. A missing TWENTY_API_KEY only emits a console warning. [C]logRequest and the phone log write the full form plus IP and UA to stdout (route lines 33–52, 79–87). The success body also echoes originalFormData. Log retention is [A]; it may conflict with the "3 years from last interaction" statement and with data minimization.gdprConsent* and dataRetentionPeriod are sent by the client and are only logged. PersonCreateInput has no field for them, so there is no durable consent record in the CRM. The values are client-supplied and unauthenticated. [C]description is set. A repeat enquiry from a known email with an empty description creates nothing. [C, route lines 126–190]Policy page: app/[locale]/privacy-policy/page.tsx (German text in the file). Stated in §14.3 and nearby:
| Policy statement | Implementation | Verdict |
|---|---|---|
| "Data transfer only with your explicit consent" | Declined visitors still load gtag.js (A1) | Contradicted [C] |
| "You can withdraw consent at any time" via the footer link | Withdrawal does not clear _ga* cookies (A3) | Partly true |
| "IP anonymization enabled" | anonymize_ip is a no-op in GA4 and IPs are not stored by GA4 | Wording outdated [A] |
| "Data deleted automatically after 26 months" | GA4 retention is configured in the property (the options are 2 or 14 months for standard properties) | Needs check in the GA admin [A] |
| Facebook plug-ins (lines ~426, 479) | No Facebook script or pixel in the source | Boilerplate, no matching code [C]; owner to confirm |
| Cookie banner "Accept all" | Declines (A2) | Contradicted [C] |
Also: the policy does not name the CRM (Twenty) as a processor or the log retention for form data. Whether it should is a legal decision for the owner or DPO. [A]
work/analytics501/analytics.patch (3 files; git apply --check OK on the mirror; tsc --noEmit and eslint clean on a throwaway copy with the patch applied; layout classes and visible copy unchanged):
lib/analytics.ts: idempotent initGA(). It sets consent default denied (4 signals) before js and config. enableGA() initializes GA on demand and grants analytics only. disableGA() sets the ga-disable-<ID> flag, sends update denied and deletes _ga, _ga_*, _gid.components/cookie-consent-provider.tsx: GA is initialized only on opt-in, so decline never loads it.components/blocks/cookie-consent.tsx: new handleAcceptAll for the detailed "Accept all" button (A2).work/analytics501/crm202.patch (2 files, 1 line each): treat HTTP 202 as an error in both forms so the visitor sees the error message instead of "success". Owner decision: this changes lead-path behavior, so approve it separately from the analytics patch. The existing submitError text is reused and no new copy is added.
Not patched (need owner or legal input): P2 log minimization, P3 persisting consent, P4 policy wording, A6 build env, A8 banner copy (changing it alters visible text), A9 package removal, P5 abuse protection.
Static and local (done): see harness-output.txt; tsc and eslint pass on the patched copy.
On the CLA private preview over the SSH tunnel, with a fake GA ID or the real one only if the owner approves a test property or a filtered internal stream:
/de. Expected: banner visible, zero requests to googletagmanager.com/google-analytics.com, no _ga* cookies. Run on the original and the patched build.gtag/js is expected. This confirms A1.analytics:true (A2). Check dataLayer order consent default → js → config → consent update._ga* gone, no further hits, one gtag.js script tag in the DOM.GRAPHQL_ENDPOINT at a closed local port in a local next start, submit with an obviously fake address on a non-production instance, and expect an error message (with crm202.patch) or "success" (without it). Do not submit to the production or CRM-connected preview.NEXT_PUBLIC_GA_ID is set in the deploy pipeline (A6) and whether the GA property exists. Needs owner.work/analytics501/: analytics.patch, crm202.patch, harness.ts, harness-output.txt, orig/ and new/ (the three analytics files before and after).