0.2.0 • Published 4 years ago

ngx-gtm-cookie-consent v0.2.0

Weekly downloads
87
License
-
Repository
-
Last release
4 years ago

ngx-gtm-cookie-consent

npm Build Status Quality Gate Status

An Angular library to comply with the GDPR and the latest european law regarding cookies 🍪

This project is work-in-progress. Features and Documentation are probably not complete.

Usage

  1. Install dependencies

npm install --save ngx-gtm-cookie-consent ngx-cookieconsent cookieconsent

or

yarn add ngx-gtm-cookie-consent ngx-cookieconsent cookieconsent

  1. Add the following to your angular.json:
{
    "assets": [
        {
            "glob": "**/cookie-consent.js",
            "input": "node_modules/ngx-gtm-cookie-consent/static/js",
            "output": "./ngx-gtm-cookie-consent"
        }
    ],
    "styles": [
        "node_modules/cookieconsent/build/cookieconsent.min.css",
        "node_modules/ngx-gtm-cookie-consent/static/css/main.css"
    ],
    "scripts": [
        "node_modules/cookieconsent/build/cookieconsent.min.js"
    ]
}
  1. Add a script in your index.html head section:
<script src="ngx-gtm-cookie-consent/cookie-consent.js"></script>
  1. Create a cookieConfig object (see ngx-cookieconsent)

  2. Add imports to your AppModule:

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    NgcCookieConsentModule.forRoot(cookieConfig),
    CookieModule.forRoot({
      gtmContainerId: 'GTM-XXXYYY', // Your Google Tag Manager container ID
      enable: true, // Control this from your environment files
      cookieConsentPopUpConfig: cookieConfig
    })
  ]
})
export class AppModule { }
  1. Create a new trigger in Google Tag Manager

Trigger

  1. Use the new trigger to fire tags (e.g. for Google Analytics)

Tag

i18n support

You can change the content of the cookie banner after the initial setup, for example to react to a locale change by the user. The CookieConsentService provides the function setCookieConsentConfig() which can be used to provide an updated config object.

0.2.0

4 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.7

5 years ago

0.0.7-rc.2

5 years ago

0.0.7-rc.1

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago