NAME
GDPR::IAB::TCFv2::PublisherTC - Transparency & Consent String version 2 publisher tc
SYNOPSIS
my $publisher_tc = GDPR::IAB::TCFv2::PublisherTC->Parse(
data => $publisher_tc_data,
data_size => length($publisher_tc_data),
options => { json => ... },
);
say num_custom_purposes;
say "there is publisher restriction on purpose id 1, type 0 on vendor 284"
if $publisher_tc->check_restriction(1, 0, 284);
CONSTRUCTOR
Constructor Parse
receives an hash of 3 parameters:
Key
data
is the binary dataKey
data_size
is the original binary data sizeKey
options
is the GDPR::IAB::TCFv2 options (includes thejson
field 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 requir'ements 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 with the following format:
{
consents => ...,
legitimate_interests => ...,
custom_purposes => {
consents => ...,
legitimate_interests => ...,
},
restrictions => {
'[purpose id]' => {
# 0 - Not Allowed
# 1 - Require Consent
# 2 - Require Legitimate Interest
'[vendor id]' => 1,
},
}
}
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_purpose" : {
"consents" : [],
"legitimate_interests" : []
},
"restrictions" : {
"7" : {
"32" : 1
}
}
}