...
argument name | type | optional | value | description |
---|---|---|---|---|
command | string |
| ||
version | integer | ✔️ |
| The TCF API version to use. Can be null instead. |
callback | function |
| The callback function that is called with the function call result. |
Description
In order to retrieve user consent, the IAB specification provides two different functions: addEventListener
and getTCData
. Although both can retrieve user consent, addEventListener
is recommended, given it can "follow" the user interaction, making sure that it will eventually return the consent data once the user has finished interacting with the CMP GUI. On the other hand, getTCData
function just returns the current consent status. This means that it may return uninitialized, incomplete or full consent data, depending on the timing it is called. This means that the responsibility to obtain the definite data for the consent falls over the publisher lap. With addEventListener
every consent status change triggers a new call to the given callback, which means that the only thing needed to process the consent data is a simple check for whether or not that consent data is final, thus usable down the line.
...