JavaScript library for building CCPA String. Compliant with the US Privacy String spec 1.0 written by IAB.
-
With NPM
npm install ccpa-string-builder --save
-
With Yarn
yarn add ccpa-string-builder
This library works with Node and Browser environments.
const CCPAStringBuilder = require('ccpa-string-builder')
import CCPAStringBuilder from 'ccpa-string-builder'
To generate the string, use following syntax:
const privacyString = CCPAStringBuilder({
explicitOptOut: true,
optOutSale: true,
lspa: true,
})
will produce 1YYY
const privacyString = CCPAStringBuilder({})
will produce 1---
You may pass either undefined
(Not Applicable) or boolean value for explicitOptOut
, optOutSale
, or lspa
properties. Omitting parameter is the same as passing undefined
.
Definitions of each component can be found here