Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@protodigital/cookie-controller
Advanced tools
A lightweight cookie consent solution to help you comply with the EU Cookie Law and GDPR.
The Proto Cookie Controller is a lightweight JavaScript library that enables you to easily implement a cookie consent solution on your website. It offers a range of features that enable you to support GDPR compliance.
Similar to other Proto libraries, there is a focus of config in HTML and the library avoids inserting any HTML into the DOM and requires no CSS. This means you can easily customise the look and feel of the cookie controller to match your website's design.
data-cookie-action="save"
attribute - if not present, cookie prefferences will be saved on checkbox change.To install the Proto Cookie Controller library, run the following command:
npm install @protodigital/cookie-controller
To use the Proto Cookie Controller library, import the CookieController
class from the library and instantiate.
import CookieController from "@protodigital/cookie-controller";
new CookieController({
onConsentChange: (data) => {
console.log(data);
},
versioning: {
current: "1.0.0",
onNewVersion: (oldVersion, newVersion) => {
console.log(oldVersion, newVersion);
},
},
});
All config is optional, though you will need to supply a onConsentChange callback and save the data to ensure compliance with the consent recording requirements of GDPR.
<div data-cookie-details>
<button data-cookie-action="dismiss">Close</button>
<button data-cookie-action="accept">Accept Recommended</button>
<button data-cookie-action="reject">Reject</button>
<a href="https://www.example.com/privacy-policy" target="_blank">
Cookie Policy
</a>
<ul>
<li>
<input id="analytics" type="checkbox" data-cookie-config="analytics" />
<label for="analytics">Analytics</label>
</li>
<li>
<input id="marketing" type="checkbox" data-cookie-config="marketing" />
<label for="marketing">Marketing</label>
</li>
</ul>
<!-- If not present, cookie prefferences will be saved on checkbox change -->
<button data-cookie-action="save">Save My Preferences</button>
</div>
<div data-cookie-alert>
<button data-cookie-action="accept">Accept All</button>
<button data-cookie-action="reject">Reject</button>
<button data-cookie-action="details">Details</button>
<button data-cookie-action="dismiss">Close</button>
</div>
<button data-cookie-action="details">Open Cookie Modal</button>
For a more detailed example, checkout the tailwind.html example.
destroy()
Destroy the cookie controller instance and remove all event listeners. Useful for using within SPA's.
getCookieConsent(key)
Returns the current consent status of a cookie key (true/false).
Our cookie controller is developed with GDPR considerations in mind, supporting adherence to GDPR principles. While this tool offers functionalities aligning with GDPR requirements, full compliance depends on how it is implemented within your website's broader context and architecture.
Here are some tips for achieving compliance:
data-cookie-config
attribute, as they are for informational purposes only.Please note this is not an exhaustive list, and we recommend seeking legal advice to ensure full compliance.
FAQs
A lightweight cookie consent solution to help you comply with the EU Cookie Law and GDPR.
We found that @protodigital/cookie-controller demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.