ENG-2679: Set gdprApplies value on 3rd party TCF stubs in non-TCF bundles#7556
Merged
gilluminate merged 2 commits intomainfrom Mar 5, 2026
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
When a publisher loads the open-source IAB TCF stub before fides.js, the stub's gdprApplies defaults to undefined. Non-TCF bundles (fides.js, fides-headless.js) now call setGdprApplies(false) during init so that compliant ad scripts waiting on a boolean value can proceed. Also consolidates the __tcfapi type declaration into global.d.ts and updates the TCF stub callback signatures accordingly. Made-with: Cursor
Made-with: Cursor
1e87859 to
f88dc5e
Compare
Contributor
Greptile SummaryThis PR fixes a real-world interoperability issue where third-party ad scripts using the IAB TCF
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: f88dc5e |
jpople
approved these changes
Mar 5, 2026
Contributor
jpople
left a comment
There was a problem hiding this comment.
Tested locally, working as expected.
mfbrown
pushed a commit
that referenced
this pull request
Mar 12, 2026
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket ENG-2679
Description Of Changes
When a publisher loads the open-source IAB TCF stub (
__tcfapi) on their page before fides.js, the stub defaultsgdprAppliestoundefined. If the non-TCF fides bundle is served (i.e. the visitor's experience doesn't require TCF),gdprApplieswould remainundefinedforever — leaving compliant ad scripts stuck waiting for a boolean value.This adds a new
updateTcfStubGdprApplies()function that is called during initialization of non-TCF bundles (fides.js,fides-headless.js). It detects any existing TCF stub and callssetGdprApplies(false)to unblock those downstream scripts.Also consolidates the
__tcfapitype declaration fromfides-tcf.tsintoglobal.d.tsso the type is available to all bundles, and updates the TCF stub callback signatures to use the more permissive global type.Code Changes
clients/fides-js/global.d.ts- Add globalWindow.__tcfapitype declarationclients/fides-js/src/lib/cmp-stubs.ts- AddupdateTcfStubGdprApplies()functionclients/fides-js/src/fides.ts- CallupdateTcfStubGdprApplies()during initclients/fides-js/src/fides-headless.ts- CallupdateTcfStubGdprApplies()during initclients/fides-js/src/fides-tcf.ts- Remove duplicate__tcfapitype (now in global.d.ts)clients/fides-js/src/lib/tcf/stub.ts- Update callback signatures to match global typeclients/fides-js/__tests__/lib/cmp-stubs.test.ts- Unit tests forupdateTcfStubGdprApplies()clients/privacy-center/cypress/e2e/fides-js/consent-banner.cy.ts- E2E test verifying the stub is updatedSteps to Confirm
Add the IAB TCF CMP stub to
clients/privacy-center/public/fides-js-demo.htmlbefore the fides.js<script>block (right after the<meta>tag, before the existing script):Then visit the demo page with a geolocation that serves a non-TCF experience (e.g.
?geolocation=us-ca).After fides.js initializes, call
window.__tcfapi("ping", 2, console.log)in the browser consoleVerify the ping response shows
gdprApplies: false(notundefined)Load a TCF experience (e.g.
?geolocation=eea) on the same page and verify TCF functionality is unaffectedPre-Merge Checklist
CHANGELOG.mdupdatedMade with Cursor