This guide shows you how to add the Kukie.io cookie consent banner to your Magento 2 (Adobe Commerce) store using a layout XML file in your theme.
Prerequisite: You need a Kukie.io account and at least one site added. If you haven't done this yet, follow Create Your Account & Add Your First Site first.
Step 1: Get Your Embed Code
Log in to your Kukie.io dashboard, navigate to your site, and copy the embed code from the Setup tab. It looks like this:
<script src="https://cdn.kukie.io/s/YOUR-SITE-KEY/c.js" async></script>
Replace YOUR-SITE-KEY with the actual site key shown in your dashboard.
Step 2: Add the Script to Magento
In Magento 2, add external scripts through a layout XML file in your theme:
- In your custom theme, create or edit the file:
app/design/frontend/YourVendor/YourTheme/Magento_Theme/layout/default_head_blocks.xml - Add the following content:
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> <script src="https://cdn.kukie.io/s/YOUR-SITE-KEY/c.js" src_type="url" async="async"/> </head> </page> - Clear Magento's cache:
bin/magento cache:flush
Magento's built-in cookie notice: Magento ships with its own cookie restriction mode. If it's enabled, disable it to avoid conflicts: Stores → Configuration → General → Web → Default Cookie Settings → Cookie Restriction Mode → No.
Step 3: Verify the Installation
Visit your website in a new browser window (or incognito/private mode). You should see the Kukie.io consent banner appear. If it does not show, check the following:
- Open your browser's Developer Tools (F12) and look for the script in the Network tab — it should load with a
200status - Check the Console tab for any JavaScript errors
- Make sure you published/saved your changes in Magento
- Clear any platform-level cache if applicable
For a detailed verification walkthrough, see How to Verify Your Banner Installation.
Next Steps
- Run Your First Cookie Scan to discover all cookies on your site
- Customise Your Banner Design to match your brand
- Set Up Region Rules to comply with GDPR, CCPA, and other regulations
- Enable Google Consent Mode v2 if you use Google Analytics or Google Ads
Need help? If you run into any issues, contact our support team and we'll help you get set up.