Kind: global class
- ConsentStringParser
- new ConsentStringParser()
- .module.exports
- .cmpID :
Number - .cmpVersion :
Number - .vendorEncodingType :
Number - .version :
Number - .purposeAllowed(purposeID) ⇒
Boolean - .vendorAllowed(vendorID) ⇒
Boolean - ._getBit(offset) ⇒
Number - ._getInt(offset, size) ⇒
Number - ._processPurposes()
- ._processVendorsList()
- ._vendorInRange(vendorID) ⇒
Boolean
Parser instance for processing IAB consent strings
Kind: static class of ConsentStringParser
Constructor for the parser
Throws:
ErrorThrows for invalid consent strings
| Param | Type | Description |
|---|---|---|
| consentString | String |
The consent string |
CMP ID
Kind: static property of ConsentStringParser
Read only: true
CMP version
Kind: static property of ConsentStringParser
Read only: true
The encoding type used for the vendor(s) list
Kind: static property of ConsentStringParser
Read only: true
The consent string version used by the CMP
Kind: static property of ConsentStringParser
Read only: true
Check if a purpose is allowed
Kind: static method of ConsentStringParser
Returns: Boolean - True if the purpose is allowed, false otherwise
| Param | Type | Description |
|---|---|---|
| purposeID | Number |
The ID of the purpose to check |
Check if a vendor is allowed
Kind: static method of ConsentStringParser
Returns: Boolean - True if the vendor is allowed, false otherwise
| Param | Type | Description |
|---|---|---|
| vendorID | Number |
The ID of the vendor to check |
Get a bit of data from the parsed consent string
Kind: static method of ConsentStringParser
Returns: Number - The requested bit
Access: protected
| Param | Type | Description |
|---|---|---|
| offset | Number |
The offset to fetch from |
Get a number from the parsed consent data Takes a range of bits and converts them into an integer
Kind: static method of ConsentStringParser
Returns: Number - The integer value of the bit range
Access: protected
| Param | Type | Description |
|---|---|---|
| offset | Number |
The offset to read from |
| size | Number |
The amount of bits to read |
Process purposes from allowed purposes ID range
Kind: static method of ConsentStringParser
Access: protected
Process the vendors list by creating ranges of vendor IDs
Kind: static method of ConsentStringParser
Access: protected
Check if a vendor ID appears in any ID range
Kind: static method of ConsentStringParser
Returns: Boolean - True if the vendor ID appears in a range,
false otherwise
Access: protected
| Param | Type | Description |
|---|---|---|
| vendorID | Number |
The vendor ID number |