Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antik-web/cookie-consent

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antik-web/cookie-consent

A lightweight & gdpr compliant cookie consent plugin written in plain javascript, implementing laman.

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

Official cookie consent package for ANTIK websites. This package provides customizable cookie bar combined with Google tag manager functionality, and it is also connected with laman.

Build

1. Firstly, download the package from repository.
2. Provide necessary environment variables to make laman fetching work.

Then, you can build this package using commands below:

npm install
npm run fetch:laman
npm run build

Build files will be located in dist folder.

Usage

Include antik-cookie-consent.min.js in head tag of a website:

<script src="https://cookie-consent.antik.sk/latest/acs.js?w=url.webu.sk"></script>

Pay attention to w get parameter, as it is mandatory for this script to run.

In the body, insert another script element, which will initialize the package and which you can customize cookie bar and package settings with.

Example with all parameters
<script type="text/javascript" defer>
    AntikConsent.run({
        main_color: '#ff0000',
        gtach: ['G-XXXXXXXXXX', 'G-XXXXXXXXXX'],
        lang: 'sk',
        meta_cookie: false,
        analytics_cookies: [
            {
                provider: 'Test, Inc.',
                information: {
                    sk: '<a class=cc-link target=_blank href=https://www.lipsum.org/>Zásady používania údajov spoločnosti Test</a>',
                },
            }
        ],
        marketing_cookies: [
            {
                provider: 'Test, Inc.',
                information: {
                    sk: '<a class=cc-link target=_blank href=https://www.lipsum.org/>Zásady používania údajov spoločnosti Test</a>',
                },
            }
        ],
        cookie_expiration: 182,
        force_consent: false,
        force_reload_cookie: true,
        debug: true
    });
</script>

Executing the run method of AntikConsent will automatically setup cookie consent bar and google tag manager for you. Google tag manager will start to analyze when user agrees usage of the analytics cookies. Otherwise, it will not load.

Example with minimum parameters
<script type="text/javascript" defer>
    AntikConsent.run();
</script>

Options

Table below sums up all the available options (must be passed to the .run() method).

OptionTypeDefaultDescription
main_colorstring#2d4156If provided, the main color of cookie bar will be the one you provided. Hovering the element will have the same color with opacity of 65%. Pay attention, main_color argument must be in #xxxxxx HEX format.
langstringBrowser's languageIf you want to manually select language of cookie consent box, include this parameter with proper language code.
meta_cookiebooleantruePass false value when you do not want to show Meta in analytic and marketing cookie tables.
analytics_cookiesObject || Object[]-Names of used cookies provided in the analytics table in cookie box. You can either provide only one Object (see example above), or Array of Objects. In information key, you need to provide information in specific languages. Also, when you use HTML tags, you dont need to wrap attributes in quotation marks.
marketing_cookiesObject || Object[]-Names of used cookies provided in the marketing table in cookie box. You can either provide only one Object (see example above), or Array of Objects. In information key, you need to provide information in specific languages. Also, when you use HTML tags, you dont need to wrap attributes in quotation marks.
gtachstring || string[]-As we spoke of implementation of GTAG in this package, in this parameter, you have to provide google tag manager id(s) to allow the package to use it. You can either provide a only string with ID, or Array of strings containing multiple IDs. If valid ID is provided, Google is automatically inserted in analytics table and marketing table as well.
force_consentbooleanfalseEnable if you want to block page navigation until user action.
cookie_expirationnumber (integer)182 (specified in env, set during build)Cookie expiration time in days.
force_reload_cookiebooleanfalseRemove cookies before running app. This makes cookie box show everytime user opens a page.
debugbooleanfalseEnable logs.

API

Table below sums up all the available functions of AntikConsent object.

OptionReturnsParametersDescription
runvoidOptions objectRuns the application with specified configuration.
cookieConsentfunction-Function to get raw cookie-consent object.
gtagfunction || null-Function to get gtag function when available.

Keywords

FAQs

Package last updated on 19 Apr 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc