Closed HeinzBaumann closed 1 year ago
While implementing the changes into our code, we found that the event order is not explizit enough, especially when vendors will start relying on "signalStatus" event. I'd therefore suggest to add some clarification to addEventListerner or another place.
Suggested text (please check & correct my english):
Event order A CMP must send all approriate events and it must send them in a specific order so that listeners (e.g. vendors) can understand when a task has ended. Whenever the CMP starts to change or is about to change any of the existing sections or whenever the CMP is processing user input for an existing GPP string, it must always first set "signalStatus" to "not ready" and fire the corresponding event. It can then then perform the tasks (e.g. change the sections along with fireing the section change events). Only when all tasks are completed for the moment, the CMP can set the "signalStatus" to "ready" and fire the corresponding event. In other words: The event "signalStatus" shall always be the first (if applicable) and last in a chain of events being fired by the CMP.
Example 1: The following example illustrates the events that being fired assuming support for IAB TCF Canada for a new visitor:
Example 2: The following example illustrates the events that being fired assuming support for IAB TCF Canada for a returning visitor with a preexisting choice:
Clarification on addEventListerner data property for signalStatus missing: Please add "The data property will contain the new signalStatus value." to the table under EventListener Object.
The second example at "Using the CMP API" is still using return values instead of callbacks. updated example code:
if(gpp) { gpp('addEventListener', function (evt) { //callback will receive all events, we only want to react on signalStatus ready events if(evt.eventName !== 'signalStatus' || evt.data !== 'ready'){return ;}
//if only the TCString is needed, it get be taken directly from pingData.gppString var gppString = evt.pingData.gppString;
//get the data from the TCF Canada section __gpp('getSection',function(data, success)){ if(data === null){return ;}
var vendorConsent = data[0].VendorExpressConsent; var vendorImpConsent = data[0].VendorImpliedConsent; var purposeConsent = data[0].PurposesExpressConsent; // ... do something Canadian ! } }, 'tcfcav1'); }
as noted in the meeting, would be very helpful to see @janwinkler 's excellent parsedSections suggestion return parsedSections: {tcfcav1: [{SID : 5}, {Version; 1 ...}, {...} ], or something of that nature [ eg applicableAPIs], so maintaining sid to api maps will not be necessary for every api consumer.
While I like the parsedSections
suggestion, I don't think it solves the problem of mapping from prefix to SID. It spares the necessity of calling getSection
in a loop.
The other, hidden suggestion in @patmmccann comment would solve the mapping problem: include the SID in each section. Perhaps getSection
could return something like this:
{
sid: 7,
api: "usnat",
subSections: [
/* Core Sub-section */
{
Version:1,
Created: Date (Thu Apr 13 2023 18:07:12 GMT+0200),
LastUpdated: Date (Thu Apr 13 2023 18:07:12 GMT+0200),
CmpId: 31,
CmpVersion: 123,
ConsentScreen: 5,
...
},
/* Publisher Purposes Sub-section (optional) */
{
subsectionType:3,
PubPurposesExpressConsent : [1,2,3,4,5],
PubPurposesImpliedConsent : [6,7,8,9],
...
}
]
}
@dgirardi @patmmccann although im not against adding the section IDs, Im still not sure I understand the issue with the mapping: If I as a vendor decide to support lets say US Nat., then I will anyway need to build a lot of custom logic (e.g. which fields to use and how). Adding a mapping "7=usnat" in my code doesnt seem too complicated ;-) And all other APIs/section IDs that are not mapped, i can simply ignore them (because my code wouldnt anyway know what to do with the data).
Adding a mapping "7=usnat" in my code doesnt seem too complicated ;-)
It isn't; the issue is maintaining the mapping. And as we see in #73 ; not even existing mappings can be considered stable. Publishers often take years to upgrade header bidding libraries. Prebid understanding a new mapping shouldn't require a software library upgrade. The cmp should present the mappings to its consumers.
@patmmccann But thats what i mean: once the mapping is created, it should never change (the recent changes i see more as a bug in the spec an not a real change). hence the only situation when you would need to update your mapping, is when you anyway work on your code to support a new legislation or new tcf version or something. anyhow, lets cut the conversation here and add the sid to the section and make us all happy ;-)
Great work!
Open for public comment until May 26th, 2023 Changes in this PR to support GPP API v1.1
Changes in PR to support TCF 2.2: