kirby-cookie-banner icon indicating copy to clipboard operation
kirby-cookie-banner copied to clipboard

A Cookie Consent Modal for Kirby

A Cookie Consent Modal for Kirby3

Release Last Commit

kirby3-cookie-banner

Commercial Usage

This plugin is free but if you use it in a commercial project please consider to

Installation

  • unzip master.zip as folder site/plugins/kirby3-cookie-banner or
  • git submodule add https://github.com/michnhokn/kirby3-cookie-banner.git site/plugins/kirby3-cookie-banner or
  • composer require michnhokn/kirby3-cookie-banner

Features

For more features check out the wiki.

Setup

  1. Put the cookie-modal snippet right before the closing body tag.
    <?php snippet('cookie-modal', [
        'assets' => true,
        'showOnFirst' => true,
        'features' => [...],
    ]) ?>
    
  2. Set up your features for the cookie modal.
    return [
        'michnhokn.cookie-banner' => [
            'features' => [
                'analytics' => 'Analytics',
                'mapbox' => 'Mapbox'
            ]
        ]
    ];
    
  3. Listen for the cookied:saved event and receive an array of allowed features.
    u('body').on('cookies:saved', event => {
        console.log('Saved cookie features:', event.detail);
    })
    

Learn more in the wiki.

Methods

See all available functions in the wiki.

Misc

Roadmap: Have a look at this project.

License: MIT

Credits: MichnHokn