npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fer-cookie-bot

v1.4.0

Published

FerCookieBot is a JavaScript solution designed for website owners to manage user consents for cookies and tracking technologies, ensuring compliance with data protection regulations like GDPR and CCPA. It now seamlessly integrates with both Google Consent

Downloads

22

Readme

FerCookieBot: JavaScript Consent Management for Google Consent v2 and Facebook Tracking

FerCookieBot is JavaScript solution designed for website owners to manage user consents for cookies and tracking technologies, ensuring compliance with data protection regulations like GDPR and CCPA. It now seamlessly integrates with both Google Consent Mode v2 and Facebook Pixel, offering dynamic consent handling and a respectful, legal approach to user data across major advertising platforms.

FerCookieBot enhances the integration of tracking technologies on your website by automatically generating and managing the necessary script codes for Google Analytics (via gtag.js) and Facebook Pixel. This feature simplifies the setup process, ensuring that your website complies with user consent preferences while eliminating the need for manual code insertion for these services.

Automated Script Injection

Upon initialization, FerCookieBot dynamically inserts the Google Analytics and Facebook Pixel scripts into your webpage based on the provided identifiers (Google Tag ID and Facebook Pixel ID). This automation is designed to respect the consent choices made by your users, loading these tracking technologies only when permission has been granted, thereby adhering to privacy regulations such as GDPR and CCPA.

Setup

No need to manually add separate script tags for Google Analytics or Facebook Pixel in your website's HTML. FerCookieBot handles the inclusion of these scripts dynamically, reducing setup complexity and potential errors.

When initializing FerCookieBot, pass your valid Google Tag ID and Facebook Pixel ID (if necessary) as arguments to the constructor.

Remove Existing Tracking Scripts

If you have previously added Google Analytics or Facebook Pixel scripts directly to your website's HTML, remove those scripts to prevent duplicate tracking and ensure that data collection is managed solely through FerCookieBot.

Features

Consent Dialog: A customizable dialog prompts users for their cookie preferences, enhancing transparency and control over personal data processing.

Local Storage: User preferences are stored locally, ensuring their choices persist across sessions and visits, thereby improving the user experience by eliminating repetitive consent prompts.

Dynamic Preference Management: Users can modify their consent choices at any time, providing ongoing compliance and flexibility.

Google Tag Manager and Facebook Pixel Integration:: Provides seamless integration with Google Tag Manager (gtag.js) and Facebook Pixel, enabling or disabling specific tracking functionalities based on obtained consents. This ensures compliance while maintaining the utility of analytics and advertising cookies.

Multi-Language Support: Dynamically creates consent dialogs based on the user's browser language, enhancing accessibility and user experience for a global audience.

Security and Isolation: Adheres to domain-specific storage rules, safeguarding user preferences and ensuring data isolation in line with web security standards.

To integrate FerCookieBot into your website, follow these steps:

Installation & Initialization

Include the FerCookieBot css in your project.

<link  rel="stylesheet"  href="css/fer-cookiebot.css">

Include the FerCookieBot script in your project.

Create an instance of the FerCookieBot class with your Google Tag ID and Facebook Pixel ID (Pixel and options are optional):

<script type="module">
    import FerCookieBot from './js/fer-cookiebot.min.js';
    const cookieBotOptions = {
        // Your customization options / translations
    };
    /* ADD YOUR GTAG ID, PIXEL_ID, OPTIONS - CREATES GTAG/GA4 TAG, PIXEL TAG AND INITIALIZE COOKIES */
    const cookieBot = new FerCookieBot('YOUR_GOOGLE_TAG_ID');
    /* const cookieBot = new FerCookieBot('YOUR_GOOGLE_TAG_ID', 'YOUR_FACEBOOK_PIXEL_ID', cookieBotOptions); */
</script>

Multi-Language Support

FerCookieBot now offers comprehensive multi-language support, enabling you to present the consent dialog in the user's preferred language. This feature enhances the user experience for a global audience by providing localized consent information, ensuring clarity and improving compliance with international privacy regulations.

FerCookieBot supports the following languages out of the box:

Supported Languages:

  • English (en)
  • German (de)
  • Italian (it)
  • Russian (ru)
  • Polish (pl)
  • Slovenian (sl)
  • Czech (cs)
  • Dutch (nl)
  • Icelandic (is)
  • French (fr)
  • Hungarian (hu)
  • Croatian (hr)

Customizing Language Content

FerCookieBot allows for customization through options passed at initialization. This enables you to specify the exact text and titles for various cookie categories and consent information.

const cookieBotOptions = {
    title: "Consent for the Use of Personal Data",
    necessary_cookies_title: "Necessary Cookies",
    ad_storage_title: "Advertising Cookies",
    ad_user_data_title: "Use of Advertising Data",
    ad_personalization_title: "Ad Personalization",
    analytics_storage_title: "Analytics Cookies",
    functionality_storage_title: "Functionality Cookies",
    personalization_storage_title: "Personalization Cookies",
    security_storage_title: "Security Cookies",
    button_title: "Save Selected",
    accept_all_button_title: "Accept All",
    refuse_all_button_title: "Refuse All",
    consent_text: "This website uses cookies. We use cookies to personalize content and ads, to provide social media features, and to analyze our traffic.",
    consent_link: "<a href='https://policies.google.com/privacy' target='_blank'>Learn More</a>",
    change_cookiebot_preferences: "Change Cookiebot Preferences",
};

Preference Button

Implement a button allowing users to change their cookie preferences at any time:

<button id="changeCookieBotPreferences">Change Cookie Preferences</button>

Remember to replace placeholders (like path/to/fer-cookiebot.js, YOUR_GOOGLE_TAG_ID, and links to documentation or license files) with actual paths and IDs relevant to your project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

BUILD

npm run build