quebecstudio-mods/statamic-consent-kit
A consent management addon for Statamic that adds GDPR-ready cookie banners and lets you gate tracking scripts, embeds, and analytics until visitors opt in. Manage consent preferences, log agreements, and stay compliant without leaving the control panel.
Install the package with Composer, then publish its config, views, and frontend assets:
composer require <vendor>/<package>
php artisan vendor:publish --provider="<Vendor>\<Package>\<PackageServiceProvider>"
Check the published config first — this is where banner behavior lives. For most Laravel apps the key areas are:
reserveSpace option.Then include the banner component in your main layout, typically just before </body>:
@include('cookie-consent::index')
Your first use case should be simple: render the banner, accept/reject once, reload the page, and confirm the banner stays hidden and the consent cookie is present. Once that works, wire one real integration — for example, conditionally loading analytics only when the relevant consent category is accepted.
Put the banner in the root layout, not individual pages. Consent applies across the whole application, so include it once in layouts/app.blade.php or your equivalent.
Gate scripts on consent rather than loading them unconditionally. A common pattern is to render non-essential scripts only after the relevant category is accepted, or to expose a small helper/event that your own scripts listen to:
@if (app(\Vendor\Package\Consent::class)->has('analytics'))
<script src="{{ asset('js/analytics.js') }}"></script>
@endif
For scripts that must be injected dynamically, listen for the package’s consent-updated event and initialize them client-side.
Use reserveSpace when the banner is full-width and sticky. In 6.1.0 this is an Appearance option, off by default. When enabled, the banner reserves its own height at the end of the page so it does not cover the footer, and that reserved space opens and closes with the banner. Enable it for full-width sticky banners; leave it off for compact corner banners where footer overlap is not a concern.
// config/cookie-consent.php
'appearance' => [
'position' => 'bottom',
'full_width' => true,
'reserve_space' => true, // new in 6.1.0
],
Publish and override the views for branding. Rather than fighting the default markup with CSS, publish the views and adjust the Blade templates directly. Keep your overrides minimal so future package updates are easier to merge.
Model consent categories around actual cookies/scripts. Keep the config mapping close to the scripts you gate. If you add a new analytics or marketing tool, add or update the corresponding category and verify the server-side and client-side checks both use it.
Test consent states explicitly. Use browser privacy tools or a fresh private window to verify the first-visit banner, the accepted state, the rejected state, and a returning visitor whose consent cookie already exists. Clear the consent cookie between test runs.
reserveSpace is off by default. If you upgrade to 6.1.0 expecting the footer behavior to change automatically, it will not. Enable it explicitly under Appearance.reserveSpace for sticky/full-width banners. It adds height to the end of the page. On compact banners or non-sticky placements it can create unnecessary whitespace.php artisan config:clear is frequently the fix when Appearance or category changes appear to have no effect.www and the root domain, or across subdomains, inspect the cookie configuration and the browser’s cookie storage.z-index. If the banner is invisible or clipped, check stacking contexts before changing package config.Upgrade note for 6.1.0: this is an additive, opt-in change. No breaking changes are indicated. Existing banners keep their current behavior until reserveSpace is enabled.
How can I help you explore Laravel packages today?