setPublisherPurposes
- 1 Functionality
- 2 Syntax
- 3 Description
- 3.1 Scope
- 4 Examples
- 4.1 Enable publisher consent for purposes 1, 2, 3 and legitimate interest for purposes 4, 5
- 4.2 Enable publisher consent for purpose 1 and stack 40
- 4.3 Enable publisher consent for custom purposes
- 4.4 Enable publisher consent for purpose 1 and custom purpose with id 1
- 4.5 Same as above, but now with consent fetching in order to use it within the publisher's page
- 4.6 Demo example
Functionality
GDPR consent is separated into two main sides: consent for vendors, which are third parties in the site that may use personal data from the users (ad providers, analytics systems, etc.), and consent for the publisher itself, when personal data is processed by the publisher.
While vendor consent is pretty much standard to be available in CMPs, publisher consent may not be needed in every application, given that for a lot of publisher sites, no personal information is directly processed by the publisher. AdConsent makes vendor consent available out of the box, but for the cases where publisher consent is also needed, the function setPublisherPurposes
needs to be called at configuration time to enable publisher consent in AdConsent. This feature applies to GDPR only.
Syntax
function adconsent.gdpr()
argument name | type | optional | value | description |
---|---|---|---|---|
command | string |
|
|
|
parameter | object |
|
|
|
callback | function | ✔️ |
| The callback function that is called with the function call result. |
PubConsentSettings
PubConsentSettings = {
purposes: [<array of Integer>],
legIntPurposes: [<array of Integer>],
stacks: [<array of Integer>],
legIntStacks: [<array of Integer>],
customPurposes: {
definition: [<array of {
id: Integer,
name: String,
description: String,
descriptionLegal: String}>],
purposes: [<array of Integer>],
legIntPurposes: [<array of Integer>]
}
}
PubConsentSettings.purposes
Array holding the IAB standard purposes used by the publisher that are subject to user consent. The number of standard purposes are in a total of 10 and can be checked in the official IAB TCF 2.0 documentation.
PubConsentSettings.legIntPurposes
Array holding the IAB standard purposes used by the publisher that are under the publisher's Legitimate Interest. These purposes are the same as the ones in the previous field, just the way of consenting to them changes. Please check the official IAB TCF 2.0 documentation for their names, definitions and objectives.
PubConsentSettings.stacks
Array holding the IAB standard stacks used by the publisher that are subject to user consent. The stacks are sets of purposes that come together to fit a specific objective, making a better resume to the user than setting the purposes separately. The list of standard stacks is also in the official IAB TCF 2.0 documentation.
Stacks may be used to substitute information about two or more Purposes and/or Special Features. Purposes must not be included in more than one Stack, and must not be presented as part of a Stack and outside of Stacks at the same time. Conversely, any Stacks used must not include the same Purpose more than once, nor include Purposes presented separately from Stacks.
PubConsentSettings.legIntStacks
Array holding the IAB standard stacks used by the publisher that are under the publisher's Legitimate Interest. It works just like the PubConsentSettings.legIntPurposes
field but now applied to stacks.
PubConsentSettings.customPurposes
A publisher may also have purposes of their own, which may not fit in any standard purpose or stack. This field allows the publisher to set a number of custom purposes and define which of them are used as normal consent and which ones are used under legitimate interest.
PubConsentSettings.customPurposes.definition
Array holding the custom purposes definitions. A custom purpose is defined by its id
, name
, description
and descriptionLegal
fields. These fields should be written in English. To provide additional translations to these purposes, the setTranslationFiles API function must be used to accomplish that.
name | type | description |
---|---|---|
id | integer | Each custom purpose must have a unique id, ideally ordered 1, 2, 3, … |
name | string | Name of the custom purpose that will be displayed as header in the purpose view |
description | string | Description of the custom purpose that will be shown as detail in the purpose view |
descriptionLegal | string | Legal description of the custom purpose that will be shown together with |
PubConsentSettings.customPurposes.purposes
Works the same as the previous field with the same name, but now applied to the custom purposes instead of the IAB standard purposes.
PubConsentSettings.customPurposes.legIntPurposes
Works the same as the previous field with the same name, but now applied to the custom purposes instead of the IAB standard purposes.
Description
When enabled, AdConsent creates a new tab in the Customise choices
view, showing the publisher options to be consented or objected by the user.
After the user gives consent, this information is stored in AdConsent in the TCData
object, which means this information can be retrieved through the IAB standard api calls addEventListener
and getTCData
. For more information regarding the above object and functions usage, please refer to the IAB TCF 2.0 CMP API specification.
By enabling publisher consent, the tab Publisher Consent will be displayed:
Scope
The function must be called before AdConsent shows the GUI. Calls after AdConsent has shown the GUI will be ignored.
Examples
Enable publisher consent for purposes 1, 2, 3 and legitimate interest for purposes 4, 5
adconsent.gdpr('setPublisherPurposes', {
purposes: [1, 2, 3],
legIntPurposes: [4, 5]
});
Enable publisher consent for purpose 1 and stack 40
adconsent.gdpr('setPublisherPurposes', {
purposes: [1],
stacks: [40]
});
Enable publisher consent for custom purposes
This example defines 3 custom purposes and asks for consent for purpose 2 and 3 and assumes legitimate interest for purpose 1.
Enable publisher consent for purpose 1 and custom purpose with id 1
Same as above, but now with consent fetching in order to use it within the publisher's page
Demo example
You can see this example live on the demo page -> Customise choices
-> Publisher Consent
.