NAME
GDPR::IAB::TCFv2::PublisherTC - TCF v2.3 publisher TC section parser
SYNOPSIS
use GDPR::IAB::TCFv2::PublisherTC;
my $publisher_tc_data = '...';
my $publisher_tc = GDPR::IAB::TCFv2::PublisherTC->Parse(
data => $publisher_tc_data,
data_size => length($publisher_tc_data) * 8,
options => { json => {} },
);
my $num = $publisher_tc->num_custom_purposes;
if ($publisher_tc->is_purpose_consent_allowed(1)) {
# ...
}
CONSTRUCTOR
Constructor Parse receives a hash of 3 parameters:
Key
datais the binary dataKey
data_sizeis the original binary data sizeKey
optionsis the GDPR::IAB::TCFv2 options (includes thejsonfield to modify the "TO_JSON" method output.
METHODS
num_custom_purposes
Custom purpose IDs are numbered 1 to NumberCustomPurposes. Custom purposes will be defined by the publisher and displayed to a user in a CMP user interface.
If the publisher does not use any Custom Purposes, this method returns 0.
is_purpose_consent_allowed
The user's consent value for each Purpose established on the legal basis of consent, for the publisher.
is_purpose_legitimate_interest_allowed
The Purposes transparency requirements are met for each Purpose established on the legal basis of legitimate interest and the user has not exercised their "Right to Object" to that Purpose.
By default or if the user has exercised their "Right to Object to a Purpose", the corresponding bit for that purpose is set to 0
is_custom_purpose_consent_allowed
The consent value for each custom purpose id
is_custom_purpose_legitimate_interest_allowed
The legitimate Interest disclosure establishment value for each custom purpose id
TO_JSON
Returns a hashref describing the publisher's purpose decisions:
{
consents => ...,
legitimate_interests => ...,
custom_purposes => {
consents => ...,
legitimate_interests => ...,
},
}
Publisher restrictions are emitted by "TO_JSON" in GDPR::IAB::TCFv2::PublisherRestrictions; the "TO_JSON" in GDPR::IAB::TCFv2::Publisher wrapper combines the two views into a single hashref.
Example, by parsing the consent COwAdDhOwAdDhN4ABAENAPCgAAQAAv___wAAAFP_AAp_4AI6ACACAA.argAC0gAAAAAAAAAAAA we can generate this compact hashref.
{
"consents" : [
2,
4,
6,
8,
9,
10
],
"legitimate_interests" : [
2,
4,
5,
7,
10
],
"custom_purposes" : {
"consents" : [],
"legitimate_interests" : []
}
}