Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.2 KB

README.md

File metadata and controls

49 lines (32 loc) · 1.2 KB

CCPA String Builder - JavaScript helper library

JavaScript library for building CCPA String. Compliant with the US Privacy String spec 1.0 written by IAB.

Installation

  • With NPM npm install ccpa-string-builder --save

  • With Yarn yarn add ccpa-string-builder

Usage

This library works with Node and Browser environments.

CommonJS

const CCPAStringBuilder = require('ccpa-string-builder')

JavaScript modules

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