Missing vendors or purposes in the consent string or when using the __tcfapi() function

When using the __tcfapi() function, you will sometimes find that some vendors or purposes are missing. Generally, this is not a bug: this is due to TCF V2 functional specifications.

When you go to the preference view and make a granular choice, the function will return values at "True" or "False" for purposes. The list will be created starting from ID 1 and ending with the last vendor or purpose with a "True" value.

If this last purpose with a "True" value has an ID inferior to 10 (last purpose ID) and others have a "False" status, then the list of purpose displayed in the __tcfapi() function and the consent string will end with this last purpose with a "True" value. Following purposes with a superior ID will not show as their status would be at "False".

  • For example, if you make the following choice on the preference view:

 

  • The tcfapi() function will return the following result:
purpose: {
consents: {
1: true
2: false
3: true
4: true
5: true
6: true
7: true
}
legitimateInterests: {
1: false
2: false
3: true
4: true
5: true
6: true
7: true
}
}

  • The consent string will have the following values:
"purposeConsents": { 
"1": true,
"3": true,
"4": true,
"5": true,
"6": true,
"7": true
},
"purposeLegitimateInterests": {
"3": true,
"4": true,
"5": true,
"6": true,
"7": true
}
  • Same behavior will occur when making granular choices on the vendors' view.