This Package is basically a wrapper for the Laravel Cookie Consent Package from Spatie.
Pull in your package with composer
composer require jonassiewertsen/statamic-cookie-consent
Remember to write some nice CSS to style the consent banner.
Those are the default classes
<div class="js-cookie-consent cookie-consent">
<span class="cookie-consent__message">
Your experience on this site will be improved by allowing cookies.
</span>
<button class="js-cookie-consent-agree cookie-consent__agree">
Allow cookies
</button>
</div>
You can disable the package in your .env file
COOKIE_CONSENT_ENABLED=false
php artisan vendor:publish --provider="Spatie\CookieConsent\CookieConsentServiceProvider" --tag="lang"
php artisan vendor:publish --provider="Spatie\CookieConsent\CookieConsentServiceProvider" --tag="views"
php artisan vendor:publish --provider="Spatie\CookieConsent\CookieConsentServiceProvider" --tag="config"
This Package / Addon is open source. Feel free to contribute or use it however you like!