You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update the default policy version for TCF to 5
On request from IAB EU I started with an error reporting for TCF decoder (this is work in progress still and more will be added in a future PR)
HeinzBaumann
changed the title
Update default version for TCF EU to 5, added error reporting for TCF decoding
Update default policy version for TCF EU to 5, added error reporting for TCF decoding
Apr 22, 2026
The overall direction looks correct: policy 5 as the default, GVL v3 for policy 5, and the initial decode validation for IsServiceSpecific / VendorsDisclosed all look fine.
There are a few issues that I think should be addressed:
Issue: In decode.js around lines 58–61, when policyVersion === 5, the code checks the policy-5 radio but sets the policy-2 radio. This should select tcfeuv2-policy-version-5. Otherwise, decoding a policy-5 string can leave the UI on policy 2, and a re-encode can produce the wrong version.
Policy 4 handling: Policy 4 has been removed from the UI and encode path, but decode only handles 2 and 5. An existing TCF 2.2 string with policy 4 therefore won't match either branch, and the UI can remain on 5. We should decide whether policy 4 is intentionally retired or whether it should still be handled for backward compatibility.
Policy 2 mismatch: Encode still allows policy 2, but decode treats anything other than 5 as invalid. This means a policy-2 string generated by the site can fail its own decoder. We should either remove policy 2 from encode or treat it as a supported/legacy version during decode.
VendorsDisclosed check: Checking VendorsDisclosed.length === 0 does not distinguish an empty vendor list from a missing segment. The validation should check whether the segment is present rather than whether it contains vendor IDs.
From my review, I think a few changes are needed, mainly around the Policy 5 radio bug and keeping the Policy 2/4 encode-decode behavior consistent.
@Tejasshack I reviewed your comments:
Item 1: I fixed that.
Item 2: For TCF EU policy version 4 is no longer valid. So decoding will error with the policy version not being 5. Newly encoing will set that to 5 and create a valid tcstring. That is correct. No change needed there.
Item 3: Policy no is not valid for TCF EU but for TCF CA. If the UI is set to TCF CA policy version 2 is supported and it will work. For TCF EU it is not allowed. This follows the model of the current deploied encoder/decoder. We could enhance this if we want but will need a new issue logged for it.
Item 4: When the vendorDisclosedVendor section is missing we get an empty vendorDisclosedVendor object back from the API, which is equal to haveing the segement w/o anything populated. We look for the API object for this test. The way we check this is what we can do with what we get from the API. For now this is good enough IMO.
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
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.
This PR addressed the following issues:
Update the default policy version for TCF to 5
On request from IAB EU I started with an error reporting for TCF decoder (this is work in progress still and more will be added in a future PR)