Skip to content

feat: iubenda CMP with TCF consent for ads tracking - #6382

Open
pnvasanth wants to merge 2 commits into
mainfrom
feat/iubenda-cmp-tcf-consent
Open

feat: iubenda CMP with TCF consent for ads tracking#6382
pnvasanth wants to merge 2 commits into
mainfrom
feat/iubenda-cmp-tcf-consent

Conversation

@pnvasanth

@pnvasanth pnvasanth commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Changes

Adds the iubenda Cookie Solution (IAB TCF v2.2) as CMP for GDPR-covered users, behind the new iubenda_cmp GrowthBook flag (default off). Companion PRs: dailydotdev/skadi#352 (deploy first), dailydotdev/daily-api#4027.

  • Iubenda.tsx (webapp only — extension CSP blocks CMP scripts): loads stub → safe-tcf → core in order for GDPR-covered users, mirrors iubenda purposes into the existing ilikecookies* cookies (incl. a new withdrawal path in useCookieConsent that updates the react-query cache), suppresses the homegrown banner for those users.
  • lib/tcf.ts: store over __tcfapi exposing {gdprApplies, tcString, addtlConsent}; mirrors the TC string to localStorage so the next boot sends it as an x-gdpr-consent header (lib/boot.ts).
  • Ad consent fixes: resolveAdConsent previously abused gdpr=1 to mean "not consented" — now gdprApplies states scope and the TC string carries consent; useAdMacroContext recomputes on consent change. The existing ${GDPR_CONSENT_755}/${ADDTL_CONSENT} macros now populate (pixels, measurement tags, click URLs, incl. the extension measurement frame contract).
  • Ad requests: all three ad endpoints carry gdpr/gdpr_consent/addtl_consent; consent is part of the ad queryKey so ads refetch after the banner is answered.
  • Settings → privacy opens iubenda's preferences UI instead of the custom modal when the flag is on.

Behavior changes to be aware of: EU users consented via the old banner now emit gdpr=1 + TC string (previously miscoded gdpr=0) and will see the iubenda banner once; EU extension users truthfully send gdpr=1 with no string (contextual ads).

Rollout checklist

Values pulled from the live daily.dev homepage's iubenda embed (same site/policy so consent is shared across *.daily.dev):

  • Vercel (webapp project): NEXT_PUBLIC_IUBENDA_SITE_ID=1334205
  • Vercel (webapp project): NEXT_PUBLIC_IUBENDA_POLICY_ID=14695236 (referenced by existing code — verify rather than assume it's set)
  • Local dev: add both to packages/webapp/.env (edit-protected, not included in this PR)
  • iubenda dashboard: enable IAB TCF v2.2 + Google Additional Consent Mode for site 1334205 (the homepage config currently has no enableTcf — without it __tcfapi never loads and no TC string is generated)
  • Redeploy after adding the vars (NEXT_PUBLIC_* is inlined at build time)
  • Ramp iubenda_cmp flag (GrowthBook) 0% → EU-targeted

Events

New shared property on all log events: consent_id — the iubenda consent-record correlator (cons.rand from the _iub_cs-* cookie), unset when no iubenda consent exists. Needs coordination with the analytics pipeline.

Preview domain

https://feat-iubenda-cmp-tcf-consent.preview.app.daily.dev

Load the iubenda Cookie Solution (TCF mode) for GDPR-covered webapp
users behind the iubenda_cmp flag, mirror its consent into the existing
ilikecookies* cookies, populate the ad tracker consent macros from
__tcfapi, send gdpr/gdpr_consent/addtl_consent on ad requests, attach
the iubenda consent id to analytics events, and forward the stored TC
string to boot via the x-gdpr-consent header.
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
daily-webapp Ready Ready Preview Jul 28, 2026 11:27am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
storybook Ignored Ignored Jul 28, 2026 11:27am

Request Review


win._iub = win._iub || {};
win._iub.csConfiguration = {
siteId: Number(process.env.NEXT_PUBLIC_IUBENDA_SITE_ID),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have NEXT_PUBLIC_IUBENDA_POLICY_ID which should be NEXT_PUBLIC_IUBENDA_SITE_ID

Comment on lines +88 to +104
lang: 'en',
enableTcf: true,
googleAdditionalConsentMode: true,
perPurposeConsent: true,
askConsentAtCookiePolicyUpdate: true,
invalidateConsentWithoutLog: true,
// consent cookie shared across *.daily.dev, matching the existing
// `_iub_cs-*` bridge from the marketing homepage
localConsentDomain: process.env.NEXT_PUBLIC_DOMAIN,
floatingPreferencesButtonDisplay: false,
banner: {
position: 'float-bottom-center',
acceptButtonDisplay: true,
rejectButtonDisplay: true,
customizeButtonDisplay: true,
closeButtonDisplay: false,
listPurposes: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to make sure it matches with our homepage and marketing site configuration as well, since there we use iubenda already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants