Giter VIP home page Giter VIP logo

iabgpp-es's Introduction

iabgpp-es

Encode/decode consent information with the IAB GPP Framework

(https://iabtechlab.com/gpp/)

Methods available to CMPs

constructor(cmpId: number, cmpVersion: number, customCommands?: CustomCommands)
fireEvent(eventName: string, value: any)
fireErrorEvent(value: string)
fireSectionChange(value: string)
getEventStatus()
setEventStatus(eventStatus: EventStatus)
getCmpStatus()
setCmpStatus(cmpStatus: CmpStatus)
getCmpDisplayStatus(): CmpDisplayStatus
setCmpDisplayStatus(cmpDisplayStatus: CmpDisplayStatus)
getApplicableSections(): number[]
setApplicableSections(applicableSections: number[]): void
getSignalStatus(): SignalStatus
setSignalStatus(signalStatus: SignalStatus): void
setGppString(encodedGppString: string): void
getGppString(): string
setSectionString(sectionName: string, encodedSectionString: string): void
setSectionStringById(sectionId: number, encodedSectionString: string): void
getSectionString(sectionName: string): string
getSectionStringById(sectionId: number): string
setFieldValue(sectionName: string, fieldName: string, value: any): void
setFieldValueBySectionId(sectionId: number, fieldName: string, value: any)
getFieldValue(sectionName: string, fieldName: string): any
getFieldValueBySectionId(sectionId: number, fieldName: string)
getSection(sectionName: string): any
getSectionById(sectionId: number): any
hasSection(sectionName: string): any
hasSectionId(sectionId: number): any
deleteSection(sectionName: string)
deleteSectionById(sectionId: number)
clear()
getObject()
getGvlFromVendorList(vendorList: VendorList): GVL
async getGvlFromUrl(gvlUrlConfig: GVLUrlConfig): Promise<GVL>

Commands available to consumers

__gpp("addEventListener", callback?, parameter?)
__gpp("getField", callback?, parameter?)
__gpp("getSection", callback?, parameter?)
__gpp("hasSection", callback?, parameter?)
__gpp("ping", callback?, parameter?)
__gpp("removeEventListener", callback?, parameter?)

CMP usage Example

<script>
  import {CmpApi} from '@iabgpp/cmpapi'; const cmpApi = new CmpApi(1, 3); cmpApi.setGppString(gppString);
  cmpApi.setFieldValue("uspv1", "OptOutSale", 0); cmpApi.fireUpdate("uspv1"); console.log(cmpApi.getGppString());
</script>

Consumer usage example

<script src="/js/stub/stub.js"></script>
<script>
  console.log(__gpp("ping"));

  __gpp("addEventListener", function (evt) {
    console.log("Received uspv1 event: " + evt);
    console.log(__gpp("getGPPString"));
  }, "uspv1");

  if(__gpp("hasSection", null, "tcfeuv2")) {
    console.log(__gpp("getSection", null, "tcfeuv2"));
  }

  if(__gpp("hasSection", null, "uspv1")) {
    console.log(__gpp("getField", null, "uspv1.OptOutSale"));
  }
</script>

Fields

Section Name Section ID Field Data Type/Value
tcfeuv2 2 Version 6 bit int. Value is 2.
tcfeuv2 2 Created Datetime. Updated when fields are set
tcfeuv2 2 LastUpdated Datetime. Updated when fields are set
tcfeuv2 2 CmpId 12 bit int
tcfeuv2 2 CmpVersion 12 bit int
tcfeuv2 2 ConsentScreen 6 bit int
tcfeuv2 2 ConsentLanguage 2 character country code
tcfeuv2 2 VendorListVersion 12 bit int
tcfeuv2 2 PolicyVersion 6 bit int. Value is 2
tcfeuv2 2 IsServiceSpecific Boolean
tcfeuv2 2 UseNonStandardStacks Boolean
tcfeuv2 2 SpecialFeatureOptins Boolean array of size 12
tcfeuv2 2 PurposeConsents Boolean array of size 24
tcfeuv2 2 PurposeLegitimateInterests Boolean array of size 24
tcfeuv2 2 PurposeOneTreatment Boolean
tcfeuv2 2 PublisherCountryCode 2 character country code
tcfeuv2 2 VendorConsents Integer array of variable size
tcfeuv2 2 VendorLegitimateInterests Integer array of variable size
tcfeuv2 2 PublisherRestrictions Integer array of variable size
tcfeuv2 2 PublisherPurposesSegmentType 3 bit int. Value is 3
tcfeuv2 2 PublisherConsents Boolean array of size 24
tcfeuv2 2 PublisherLegitimateInterests Boolean array of size 24
tcfeuv2 2 NumCustomPurposes 6 bit int
tcfeuv2 2 PublisherCustomConsents Boolean array where size is set by the NumCustomPurposes field
tcfeuv2 2 PublisherCustomLegitimateInterests Boolean array where size is set by the NumCustomPurposes field
tcfeuv2 2 VendorsAllowedSegmentType 3 bit int. Value is 2
tcfeuv2 2 VendorsAllowed Integer array of variable size
tcfeuv2 2 VendorsDisclosedSegmentType 3 bit int. Value is 1
tcfeuv2 2 VendorsDisclosed Integer array of variable size
tcfcav1 5 Version 6 bit int. Value is 2.
tcfcav1 5 Created Datetime. Updated when any fields are set
tcfcav1 5 LastUpdated Datetime. Updated when any fields are set
tcfcav1 5 CmpId 12 bit int
tcfcav1 5 CmpVersion 12 bit int
tcfcav1 5 ConsentScreen 6 bit int
tcfcav1 5 ConsentLanguage 2 character country code
tcfcav1 5 VendorListVersion 12 bit int
tcfcav1 5 TcfPolicyVersion 6 bit int. Value is 2.
tcfcav1 5 UseNonStandardStacks Boolean
tcfcav1 5 SpecialFeatureExpressConsent Boolean array of size 12
tcfcav1 5 PurposesExpressConsent Boolean array of size 24
tcfcav1 5 PurposesImpliedConsent Boolean array of size 24
tcfcav1 5 VendorExpressConsent Integer array of variable size
tcfcav1 5 VendorImpliedConsent Integer array of variable size
tcfcav1 5 PubPurposesSegmentType 3 bit int. Value is 3
tcfcav1 5 PubPurposesExpressConsent Boolean array of size 24
tcfcav1 5 PubPurposesImpliedConsent Boolean array of size 24
tcfcav1 5 NumCustomPurposes 6 bit int
tcfcav1 5 CustomPurposesExpressConsent Boolean array where size is set by the NumCustomPurposes field
tcfcav1 5 CustomPurposesImpliedConsent Boolean array where size is set by the NumCustomPurposes field
uspv1 6 Version 6 bit int. Value is 1
uspv1 6 Notice 2 bit int
uspv1 6 OptOutSale 2 bit int
uspv1 6 LspaCovered 2 bit int
usnat 7 Version 6 bit int. Value is 1
usnat 7 SharingNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 SaleOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 SharingOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 TargetedAdvertisingOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 SensitiveDataProcessingOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 SensitiveDataLimitUseNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 SaleOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 SharingOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 TargetedAdvertisingOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 SensitiveDataProcessing 2 bit int array of size 12. 0=Not applicable, 1=Yes, 2=No
usnat 7 KnownChildSensitiveDataConsents 2 bit int array of size 2. 0=Not applicable, 1=Yes, 2=No
usnat 7 PersonalDataConsents 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 MspaCoveredTransaction 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 MspaOptOutOptionMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 MspaServiceProviderMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usnat 7 GpcSegmentType 2 bit int. Value is 1
usnat 7 GpcSegmentIncluded Boolean. Default is true
usnat 7 Gpc Boolean
usca 8 Version 6 bit int. Value is 1
usca 8 SaleOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usca 8 SharingOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usca 8 SensitiveDataLimitUseNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usca 8 SaleOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usca 8 SharingOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usca 8 SensitiveDataProcessing 2 bit int array of size 9. 0=Not applicable, 1=Yes, 2=No
usca 8 KnownChildSensitiveDataConsents 2 bit int array of size 2. 0=Not applicable, 1=Yes, 2=No
usca 8 PersonalDataConsents 2 bit int. 0=Not applicable, 1=Yes, 2=No
usca 8 MspaCoveredTransaction 2 bit int. 0=Not applicable, 1=Yes, 2=No
usca 8 MspaOptOutOptionMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usca 8 MspaServiceProviderMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usca 8 GpcSegmentType 2 bit int. Value is 1
usca 8 GpcSegmentIncluded Boolean. Default is true
usca 8 Gpc Boolean
usva 9 Version 6 bit int. Value is 1
usva 9 SharingNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usva 9 SaleOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usva 9 TargetedAdvertisingOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usva 9 SaleOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usva 9 TargetedAdvertisingOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usva 9 SensitiveDataProcessing 2 bit int array of size 8. 0=Not applicable, 1=Yes, 2=No
usva 9 KnownChildSensitiveDataConsents 2 bit int. 0=Not applicable, 1=Yes, 2=No
usva 9 MspaCoveredTransaction 2 bit int. 0=Not applicable, 1=Yes, 2=No
usva 9 MspaOptOutOptionMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usva 9 MspaServiceProviderMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 Version 6 bit int. Value is 1
usco 10 SharingNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 SaleOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 TargetedAdvertisingOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 SaleOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 TargetedAdvertisingOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 SensitiveDataProcessing 2 bit int array of size 7. 0=Not applicable, 1=Yes, 2=No
usco 10 KnownChildSensitiveDataConsents 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 MspaCoveredTransaction 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 MspaOptOutOptionMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 MspaServiceProviderMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usco 10 GpcSegmentType 2 bit int. Value is 1
usco 10 GpcSegmentIncluded Boolean. Deafult is true
usco 10 Gpc Boolean
usut 11 Version 6 bit int. Value is 1
usut 11 SharingNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usut 11 SaleOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usut 11 TargetedAdvertisingOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usut 11 SensitiveDataProcessingOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usut 11 SaleOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usut 11 TargetedAdvertisingOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usut 11 SensitiveDataProcessing 2 bit int array of size 8. 0=Not applicable, 1=Yes, 2=No
usut 11 KnownChildSensitiveDataConsents 2 bit int. 0=Not applicable, 1=Yes, 2=No
usut 11 MspaCoveredTransaction 2 bit int. 0=Not applicable, 1=Yes, 2=No
usut 11 MspaOptOutOptionMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usut 11 MspaServiceProviderMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usct 12 Version 6 bit int. Value is 1
usct 12 SharingNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usct 12 SaleOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usct 12 TargetedAdvertisingOptOutNotice 2 bit int. 0=Not applicable, 1=Yes, 2=No
usct 12 SaleOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usct 12 TargetedAdvertisingOptOut 2 bit int. 0=Not applicable, 1=Yes, 2=No
usct 12 SensitiveDataProcessing 2 bit int array of size 8. 0=Not applicable, 1=Yes, 2=No
usct 12 KnownChildSensitiveDataConsents 2 bit int array of size 3. 0=Not applicable, 1=Yes, 2=No
usct 12 MspaCoveredTransaction 2 bit int. 0=Not applicable, 1=Yes, 2=No
usct 12 MspaOptOutOptionMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usct 12 MspaServiceProviderMode 2 bit int. 0=Not applicable, 1=Yes, 2=No
usct 12 GpcSegmentType 2 bit int. Value is 1
usct 12 GpcSegmentIncluded Boolean. Default is true
usct 12 Gpc Boolean

Example Usage / Encoder / Decoder

https://iabgpp.com

iabgpp-es's People

Contributors

chuff avatar iabmayank avatar danielsao avatar jameshartig avatar

Stargazers

Sergei Sevriugin avatar James Scheller avatar Johan Picq avatar Nicolas Raoul avatar Uladzislau Jum avatar Andy Blackwell avatar Maximiliano Ruani avatar Veta Sheina avatar Pavlo Kyrylenko avatar  avatar Andrew Aikens avatar Nejc Sever avatar Nathan Hagen avatar Loic Jaures avatar  avatar  avatar Stephen O'Reilly avatar Rammohan Raju Gadiraju avatar Ramanarayana Narmala avatar Giancarlo Petrini avatar Ricky Blaha avatar Ben Brook avatar Eli Grey avatar Keith Lam avatar

Watchers

Bruce Dou avatar Ricky Blaha avatar Heinz Baumann avatar Neal Rosen avatar Katie Stroud avatar Rammohan Raju Gadiraju avatar Stephen O'Reilly avatar  avatar  avatar Dan Krecichwost avatar Manuel Budemaier avatar Liz Davidson avatar Marco Prontera avatar Joe Del avatar  avatar  avatar  avatar

iabgpp-es's Issues

Unable to load modules in package

I am trying to integrate the stub and cmpapi modules into our CMP, but I am not able to access those modules from javascript. I get a "module not found" error.

This package seems to only be available as "iabgpp" and can be installed by running "npm i iabgpp". I was expecting to be able to install @iabgpp/cmpapi and @iabgpp/stub as individual packages, similarly to the @iabtcf modules.

Is this not being published to npm correctly?

addEventHandler implementation appears to be imcomplete

Here are some of the things I'm seeing that cause me to believe this command is not fully implemented. Please let me know if I'm missing something.

  • I'm seeing a return value from __gpp('addEventHandler') of {param: undefined, next: undefined, callback: ฦ’}, which does not match the IAB spec.
  • Only the stub code includes an eventName property in the response
  • I am unable to trigger an event to fire. After the CMP has loaded, I tried calling cmpApi.setGppString() then cmpApi.fireUpdate().

command queues are processing during stub loading

The stub command queue is getting processed during object initiation of CmpAPI class. As the result, all stub commands coming from the queue are getting processed without user consent. The queue was processed when cmpStatus was loading.

image

https://iabgpp.com out of date?

Hi all,

Would you mind clarifying whether https://iabgpp.com is considered as up-to-date?
If yes, should we report bugs on the present issue tracker?
If no, maybe better disable it or at least add a warning banner? Some companies are using it and getting into issues.

Thanks!

getSection and parsedSections on pingData is not compliant with specification

When using getSection to retrieve a section, the data comes back as an object rather than an array containing an object. This same problem exists for the pingData.

See the specification:

JS exception on Edge iOS related to support for Sets

It seems Edge iOS does not supports Sets as iterable. This results in the script error

Uncaught TypeError: Set is not a function or its return value is not iterable
    at s.setValue (cmp.js:2:32561)
    at new s (cmp.js:2:32147)
    at new a (cmp.js:2:61891)
    at t.GppModel.decode (cmp.js:2:27797)
    at t.CmpApi.setGppString (cmp.js:2:6667)
    ....

This limitation appears to be undocumented, at least not something you'll find on MDN or caniuse.com.

A potential fix would be to create a utility function to support this

function setToArray<T>(set: Set<T>): T[] {
  const arr: T[] = [];
  set.forEach(item => arr.push(item));
  return arr;
}

TCF EU v2 decode issue

Opened a PR here #6 to illustrate a few cases of the new TCF EU v2 encoder is not able to decode some existing consent strings which work fine with the old encoder.

Is decoding of "segmented" sections intentionally permissive?

The spec for the US National section says: "The core segment must always be present". But I'm able to decode GPP strings that don't explicitly include data for the core segment. Is this expected/desired?

Here are some examples...

DBABLA~ decodes as:

{"uspnatv1":{"Version":1,"SharingNotice":0,"SaleOptOutNotice":0,"SharingOptOutNotice":0,"TargetedAdvertisingOptOutNotice":0,"SensitiveDataProcessingOptOutNotice":0,"SensitiveDataLimitUseNotice":0,"SaleOptOut":0,"SharingOptOut":0,"TargetedAdvertisingOptOut":0,"SensitiveDataProcessing":[0,0,0,0,0,0,0,0,0,0,0,0],"KnownChildSensitiveDataConsents":[0,0],"PersonalDataConsents":0,"MspaCoveredTransaction":0,"MspaOptOutOptionMode":0,"MspaServiceProviderMode":0,"GpcSegmentType":1,"Gpc":false}}

DBABLA~YA decodes as:

{"uspnatv1":{"Version":1,"SharingNotice":0,"SaleOptOutNotice":0,"SharingOptOutNotice":0,"TargetedAdvertisingOptOutNotice":0,"SensitiveDataProcessingOptOutNotice":0,"SensitiveDataLimitUseNotice":0,"SaleOptOut":0,"SharingOptOut":0,"TargetedAdvertisingOptOut":0,"SensitiveDataProcessing":[0,0,0,0,0,0,0,0,0,0,0,0],"KnownChildSensitiveDataConsents":[0,0],"PersonalDataConsents":0,"MspaCoveredTransaction":0,"MspaOptOutOptionMode":0,"MspaServiceProviderMode":0,"GpcSegmentType":1,"Gpc":true}}

DBABLA~YA.YA decodes as:

{"uspnatv1":{"Version":1,"SharingNotice":0,"SaleOptOutNotice":0,"SharingOptOutNotice":0,"TargetedAdvertisingOptOutNotice":0,"SensitiveDataProcessingOptOutNotice":0,"SensitiveDataLimitUseNotice":0,"SaleOptOut":0,"SharingOptOut":0,"TargetedAdvertisingOptOut":0,"SensitiveDataProcessing":[0,0,0,0,0,0,0,0,0,0,0,0],"KnownChildSensitiveDataConsents":[0,0],"PersonalDataConsents":0,"MspaCoveredTransaction":0,"MspaOptOutOptionMode":0,"MspaServiceProviderMode":0,"GpcSegmentType":1,"Gpc":true}}

DBABLA~YA.QA decodes as:

{"uspnatv1":{"Version":1,"SharingNotice":0,"SaleOptOutNotice":0,"SharingOptOutNotice":0,"TargetedAdvertisingOptOutNotice":0,"SensitiveDataProcessingOptOutNotice":0,"SensitiveDataLimitUseNotice":0,"SaleOptOut":0,"SharingOptOut":0,"TargetedAdvertisingOptOut":0,"SensitiveDataProcessing":[0,0,0,0,0,0,0,0,0,0,0,0],"KnownChildSensitiveDataConsents":[0,0],"PersonalDataConsents":0,"MspaCoveredTransaction":0,"MspaOptOutOptionMode":0,"MspaServiceProviderMode":0,"GpcSegmentType":1,"Gpc":false}}

The code just uses default values if the string doesn't have any data for the core segment. And if any segment is specified more than once, the last value wins (e.g. in the string "YA.QA", Gpc is false because "QA"--which corresponds to the bit string "010000000000"--comes after "YA"--which corresponds to the bit string "011000000000").

My initial expectation based on the spec was that these strings would be rejected as invalid, but that might just be me. If this is deemed to be undesirable/unexpected behavior, it's worth noting that other sections besides the US National section have the same behavior.

Status / expected timeline for this project

I see that this is not yet released as an npm module, and that there have not been any updates in a couple weeks. Will this code be released as an npm module? If so, what is the anticipated timeline for that release?

Clarification requested re: CompressedBase64UrlEncoder

I'm trying to understand why CompressedBase64UrlEncoder is written the way it is. More specifically, I'm not sure what this while loop is doing and it seems to me like it can be removed:

    while (bitString.length % 8 > 0) {
      bitString += "0";
    }

Imagine the bitString is 6 bits long. That could be represented as a single base64 digit, but this while loop will add two 0's at the end so that the length of the bitString is 8. Then the subsequent while loop will add four more 0's to get the length of the bitString back to a multiple of 6 (i.e. 12). That is 6 bits of padding and it means that the encoded value in this case has a seemingly unnecessary "A" at the end.

For a more concrete example, consider this test case for the Header section:

  it("should encode section ids [2] to DBABMA", (): void => {
    let headerV1 = new HeaderV1();
    headerV1.setFieldValue("SectionIds", [2]);
    expect(headerV1.encode()).to.eql("DBABMA");
  });

The six bits represented by the "A" at the end of "DBABMA" are unnecessary and the Header can be decoded just fine without it. DBABM~ decodes without issue as:

{"tcfeuv2":{"Version":2,"Created":"Fri Jun 02 2023 15:19:38 GMT-0700 (Pacific Daylight Time)","LastUpdated":"Fri Jun 02 2023 15:19:38 GMT-0700 (Pacific Daylight Time)","CmpId":0,"CmpVersion":0,"ConsentScreen":0,"ConsentLanguage":"EN","VendorListVersion":0,"PolicyVersion":2,"IsServiceSpecific":false,"UseNonStandardStacks":false,"SpecialFeatureOptins":[false,false,false,false,false,false,false,false,false,false,false,false],"PurposeConsents":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],"PurposeLegitimateInterests":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],"PurposeOneTreatment":false,"PublisherCountryCode":"AA","VendorConsents":[],"VendorLegitimateInterests":[],"PublisherRestrictions":[],"PublisherPurposesSegmentType":3,"PublisherConsents":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],"PublisherLegitimateInterests":[false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],"NumCustomPurposes":0,"PublisherCustomConsents":[],"PublisherCustomLegitimateInterests":[],"VendorsAllowedSegmentType":2,"VendorsAllowed":[],"VendorsDisclosedSegmentType":1,"VendorsDisclosed":[]}}

EDIT/UPDATE: On closer inspection, I see line 272 of the spec actually states that the Header should be encoded as DBABM. But then down below on line 603 it states the same Header should be encoded as DBABMA.

SIDENOTE: this might be obvious to folks who are already experts in Base64 encoding, but the traditional (i.e. non-compressed) base64 encoded string for a Header with a single section ID of 2 (i.e. the same example we used previously) would be DBABMAAA (e.g. see this test). If we drop that padding in order to compress the encoded GPP string as much as possible, then other utilities/libraries that expect traditional Base64 encoding may not be happy. I ran into this when trying to come up with a one-liner on my Mac to convert a base64 string to a bit string. This command produces no output:

echo -n "DBABM" | base64 -d | xxd -b -g0

But adding the full/traditional padding to the end makes the base64 command happy again:

$ echo -n "DBABMAAA" | base64 -d | xxd -b -g0
00000000: 000011000001000000000001001100000000000000000000  ...0..

It might be worth explicitly mentioning somewhere in the spec that if folks, for some reason, want to decode a base64 encoded values from a GPP string using a standard Base64 utility/library, they might need to add "A" to the end of the string until the overall length of the encoded string is a multiple of 4. Or at least that is my current impression based on the example above. Folks with more Base64 knowledge/expertise should feel free to correct me.

Value gppString in PingData is not updated when section is set to cmpApi.

When setting section value with string section value (cmpApi.setSectionString(sectionName, sectionValue)), gppString is unchanged in PingData object.

Here's the reproducible case where you can see that after setting the UspV1 section value, the gppString in the PingData of the event is still set to "DBAA":

import {CmpApi,CmpDisplayStatus,CmpStatus,SignalStatus,UspV1} from "@iabgpp/cmpapi";
import "@iabgpp/stub";

window.__gpp("addEventListener", (e) => console.log(e));

const cmpApi = new CmpApi(-1, 1);
cmpApi.setApplicableSections([6]);
cmpApi.setCmpStatus(CmpStatus.LOADED);
cmpApi.setSignalStatus(SignalStatus.NOT_READY);
cmpApi.setCmpDisplayStatus(CmpDisplayStatus.VISIBLE);
cmpApi.setSectionString(UspV1.NAME, "1YYY");
cmpApi.setCmpDisplayStatus(CmpDisplayStatus.HIDDEN);
cmpApi.setSignalStatus(SignalStatus.READY);

This happens because the "dirty" boolean flag inside gppModel is not set to true when this method is used (only when fields are updated). I think the case above should be supported. Changes to sections via setSectionString should be reflected in gppString in PingData.

Section Data for Oregon, Texas and Montana?

Hello -

So we've been tracking the progress of privacy legislation here...

https://iapp.org/resources/article/us-state-privacy-legislation-tracker/

...and noted Oregon and Texas had July 2024 implementation dates coming up, plus Montana coming in October. This is followed up with a whole slew in January 2025 (Delaware, Iowa, New Jersey and Tennessee).

Are GPP section definitions and encoder/decoder implementations in the pipeline for these states?

Many thanks,

Jim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.