PHPackages                             nilsenpaul/complete-cookie-consent - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nilsenpaul/complete-cookie-consent

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

nilsenpaul/complete-cookie-consent
==================================

This plugin provides a complete and easy way to let your site's visitors choose the cookies you're allowed to set.

2.0.0(1y ago)921.7k↓41.7%3[17 issues](https://github.com/nilsenpaul/craft-complete-cookie-consent/issues)[2 PRs](https://github.com/nilsenpaul/craft-complete-cookie-consent/pulls)proprietaryPHPPHP ^8.2

Since Apr 8Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nilsenpaul/craft-complete-cookie-consent)[ Packagist](https://packagist.org/packages/nilsenpaul/complete-cookie-consent)[ RSS](/packages/nilsenpaul-complete-cookie-consent/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (33)Used By (0)

Complete Cookie Consent plugin for Craft CMS 3.x
================================================

[](#complete-cookie-consent-plugin-for-craft-cms-3x)

This plugin will help you comply with [EU Cookie law](https://www.privacypolicies.com/blog/eu-cookie-law/). As that law states, all European visitors of your site should not only be made aware of, but also consent to the cookies your site sets. This plugin will help you obtain consent for one or more cookie groups.

License
-------

[](#license)

This plugin requires a commercial license which can be purchased through the [Craft Plugin Store](https://plugins.craftcms.com/complete-cookie-consent).
The license fee is $29 plus $9 per subsequent year for updates (optional).

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 3.0.0 or later.

**Installation**

1. Install with Composer via `composer require nilsenpaul/complete-cookie-consent` from your project directory
2. Install plugin in the Craft Control Panel under Settings &gt; Plugins
3. Alter the plugin's settings to cater to your site's needs

You can also install Complete Cookie Consent via the **Plugin Store** in the Craft Control Panel.

Setup
-----

[](#setup)

Using the plugin's settings page, you have total control over the appearance and functionality of your cookie consent banner:

- Activate and de-activate the banner from the plugin settings page
- Only show the banner for logged in admins, for testing purposes
- Change the colors of the banner and banner button
- Change the text of the banner title, banner text and button text
- Include the plugin's CSS to give your banner a base style, or use your own CSS
- Choose a position for the banner: top, right, bottom, left or center
- Change the name and expiration time for the preferences cookie
- Change cookie types, make cookie types required or checked by default
- Add geolocation to your cookie consent process by using an automatically downloaded GeoIpLite database, or by adding an [ipApi](https://ipapi.com/) API key: only show the banner to EU visitors

[![Banner screenshot](resources/img/settings-cookietypes.png)](resources/img/settings-cookietypes.png)

Usage
-----

[](#usage)

After you've installed the plugin, and activated the cookie consent banner, the banner will be shown on your site. Depending on your setup, an external geolocation API will be used to determine if a cookie banner is needed.

[![Banner screenshot](resources/img/cookie-banner.png)](resources/img/cookie-banner.png)

### Consent mode (implied/explicit)

[](#consent-mode-impliedexplicit)

The Complete Cookie Consent plugin lets you choose between two consent modes: Implied and Explicit. With implied consent, the cookie banner will only be shown on every visitor's first page load. With explicit consent, the visitor will have to make a choice before the banner disappears.

#### What should I choose?

[](#what-should-i-choose)

This is *NOT* legal advice. It's hard to find out what rules apply to your website, especially because every European country has its own set of rules (or no rules or enforcement whatsoever). If you want to play safe, go for explicit consent. If you decide to go for implied consent, make sure you [create a form](#updating-cookie-consent-preferences-with-your-own-form) on your site for visitors to change their preferences.

### Honoring your visitor's cookie preferences

[](#honoring-your-visitors-cookie-preferences)

Cookie consent wouldn't be of much use if you wouldn't act upon the preferences of your users. That's why the `ccc` JavaScript object is set, containing the preferences of the current visitor:

```
window.addEventListener('ccc.loaded', function(e) {
    console.log(ccc.consentSubmitted)
    # prints true or false. Only true if visitor submitted their preferences

    console.log(ccc.consentImplied)
    # prints true or false. True if consent mode is set to 'implied' and the visitor did not submit their own preferences

    console.log(ccc.consent.[cookieTypeHandle])
    # prints true or false, depending on your visitor's choice (or the default settings, if consent mode is 'implied')
});

```

You can use these values to load (or prevent loading of) whatever you want.

### Cookie Consent variable

[](#cookie-consent-variable)

The plugin provides a template variable, to get the current visitor's consent info:

```
{% set consentInfo = craft.ccc.consentInfo %}

{{ consentInfo.consentSubmitted }}{#
