I wanted to post this article for a while, just to give a shoutout to a great library.

I’m talking about cookieconsent from Orest Bida.

Since GDPR started to be a thing I looked for all kinds of solutions and used a lot of solutions to solve the consent step.

From the start, I have to mention that this is not a full solution for GDPR.
This library will allow you to manage the scripts and cookies on your site.

Some points in GDPR are related to the right to be forgotten and the rights of data: this library does not cover those.

Here is a list of features available in this library:

  1. Easy Integration
    Plug it in right from the CDN files.
  2. Highly Customizable
    Change colors, position, size, buttons, etc. It will cover all your needs.
  3. Granular Consent Settings
    CookieConsent excels in handling granular consent settings, allowing users to personalize their experience by choosing preferences for different types of cookies.
  4. Multilanguage support
    You’ll be able to customize the content based on the language required.
  5. Rich in Callbacks and Events
    The library gives you enough callbacks/events to handle all the situations that might come up.
  6. Script Management using attributes
    This is great for 3rd party scripts that you don’t have control over or those that are added directly via GTM. You can pass the attribute (data-category for example) and that script will be affected based on your logic from CookieConsent.
  7. Custom Attribute
    Allowing you to trigger core functions without the use of a javascript code. It will use the API methods. One use example: trigger the modal for consent options from a button on the Cookie Policy page.
  8. Revision Management
    Allows you to refresh the consent if there is a change in your cookie policy. You can also add a message that will displayed for the user.

The library has great documentation and a playground where you can test it.

If you want to try a free open-source library for cookies consent, I would recommend this one.