Socket
Socket
Sign inDemoInstall

@somosus/ngx-cookie-consent

Package Overview
Dependencies
9
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @somosus/ngx-cookie-consent

Angular module to display a cookie consent banner without other dependencies.


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
1.57 MB
Created
Weekly downloads
 

Readme

Source

IMPORTANT: This is a package updated by me and done by @giacomo, I've just publish it here to use the Portuguese version while it's not accepted to the final version of the original package

Angular multi-language module to display a cookie consent banner without other dependencies.

Works with Angular v14+
Available languages: English, German, Italian, Portuguese (Brazil)

Installation

Install the package via npm:

npm install @somosus/ngx-cookie-consent --save

Usage

Import the module

import { NgxCookieConsentModule } from '@somosus/ngx-cookie-consent';

// use your configuration or leave it empty
// const cookieConfig = {};

@NgModule({
    imports: [
        // using own configuration pass the config object
        NgxCookieConsentModule.forRoot(),
    ],
})
<ngx-cookie-consent></ngx-cookie-consent> <router-outlet></router-outlet>
<div *ngxIfConsent="'functional_google_maps'">
  This content is only visible if functional_google_maps consent is given. (In
  this example functional_google_maps is the name of the cookie configured in
  the config object)
</div>

Configuration

NameTypeDefaultDescription
privacyPolicyUrlstring'#'URL to your privacy policy ⚠ required ⚠
imprintUrlstring'#'URL to your imprint ⚠ required ⚠
defaultLanguagestring'en'Default language for the cookie consent banner
availableLanguagesstring[]['en', 'de', 'it']Available languages for the cookie consent banner
showLanguageSwitcherbooleantrueShow language switcher
showBadgeOpenerbooleantrueShow badge opener
openerPositionenum'left-bottom'Position of the badge eg. 'left-top', 'right-top' , 'left-bottom' , 'right-bottom'
customClassstring''Custom class for the cookie consent banner
cookiePrefixstring'cookieconsent_'Prefix for the cookie consent banner
cookieExpiryDaysnumber365Expiry days for the cookie consent banner
showCookieDetailsbooleanfalseShow cookie details
showFunctionalCookiesbooleantrueShow functional cookies
functionalCookiesCookieItem[][]Functional cookies
showMarketingCookiesbooleantrueShow marketing cookies
marketingCookiesCookieItem[][]Marketing cookies
showEssentialCookiesbooleantrueShow essential cookies
essentialCookiesCookieItem[][]Essential cookies
showOtherToolsbooleantrueShow other tools
otherToolsCookieItem[][]Other tools
excludeRoutesstring[][]Exclude routes eg. ['/privacy-policy']

CookieItem interface

NameTypeDescription
keystringKey for the cookie eg. 'functional_google_analytics'
namestringName for the cookie eg. 'Google Analytics'
descriptionstringDescription for the cookie eg. 'Google Analytics is a web analytics service offered by Google that tracks and reports website traffic.'
privacyPolicyUrlstringURL to the privacy policy for the cookie eg. 'https://policies.google.com/privacy'
cookiesCookieDetail[]Cookie details for the cookie

CookieDetail interface

NameTypeDescription
namestringName for the saved cookie eg. '_ga'
descriptionstringDescription for the saved cookie eg. 'This cookie is used to distinguish users.'
durationstringDuration for the saved cookie eg. '2 years'

Contributing

This project has a maintainer that actively monitors its issue queue and responds in a timely manner. This means that bug reports, tasks, feature requests and support request posted in the project's issue should receive timely attention from project's maintainers. Other community members are also welcome to resolve issues posted to the issue queue.

License

ngx-cookie-consent is licensed under the MIT license.

Keywords

FAQs

Last updated on 10 Nov 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc