EARN UP TO 50% COMMISSION WITH OUR RESELLER ACCOUNTS + REGULAR PASSIVE INCOME SIGN UP TODAY

Magento Platform

4 min read

Magento (Adobe Commerce) gives you three reliable ways to install CookieScan: via the admin panel using Design Configuration, editing a theme layout XML file, or via Google Tag Manager. This guide covers all three.

Before you start

You will need:

  1. An active CookieScan subscription (view plans)
  2. Your banner installation code from the CookieScan dashboard (Cookie Banner → Install Code)
  3. Admin access to your Magento backend
  4. For Method 2: SSH or FTP access to your server

The install code looks like this:

<script src="https://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"></script>

Replace YOUR-COOKIESCAN-ID with the code from your dashboard.

Method 1: Design Configuration (recommended)

The easiest way to add scripts site-wide through the admin.

Step 1 – Open Design Configuration

  1. Log into your Magento admin
  2. Go to Content → Design → Configuration
  3. Find your Global scope (or the Website/Store you want to target) and click Edit

Step 2 – Add script to HTML Head

  1. Expand the HTML Head section
  2. In Scripts and Style Sheets, paste your CookieScan script tag:
    <script src="https://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"></script>
  3. Click Save Configuration

Step 3 – Flush cache

  1. Go to System → Cache Management
  2. Select all cache types
  3. Click Flush Magento Cache

Step 4 – Verify

  1. Visit your store in a new incognito window
  2. The CookieScan banner should appear

Method 2: Edit default_head_blocks.xml (for developers)

Best if you want the script committed to your theme code and deployed through version control.

Step 1 – Locate your theme

Navigate to your custom theme directory on the server, typically:

app/design/frontend/<Vendor>/<theme>/Magento_Theme/layout/default_head_blocks.xml

If the file doesn't exist, create it.

Step 2 – Add the script block

Open default_head_blocks.xml and add inside the <head> tag:

<?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://banner.cookiescan.com/js?id=YOUR-COOKIESCAN-ID"
            src_type="url"/>
  </head>
</page>

Step 3 – Clear cache and deploy

From your Magento root via SSH:

bin/magento cache:flush
bin/magento setup:static-content:deploy -f

Method 3: Install via Google Tag Manager

If GTM is already installed on your Magento store:

  1. In CookieScan, open Cookie Banner → Install Code and switch to the Google Tag Manager Install tab
  2. Copy your CookieScan ID
  3. In GTM, go to Templates → Search Gallery and add the CookieScan template
  4. Create a tag using the template, paste your ID
  5. Trigger: Consent Initialization – All Pages
  6. Submit and publish

Disable Magento's built-in cookie restriction mode (if enabled)

Magento has a basic cookie notice. Disable it so CookieScan manages consent:

  1. Go to Stores → Configuration
  2. Expand Web → Default Cookie Settings
  3. Set Cookie Restriction Mode to No
  4. Save and flush cache

Verify the installation

  1. Visit your store in a new incognito window
  2. The CookieScan banner should appear
  3. Open DevTools (F12) → Network tab → filter by cookiescan
  4. Confirm banner.cookiescan.com loads

You can also use the Verify Installation step in your CookieScan dashboard.

What happens next

Once installed, CookieScan handles the rest:

  • Scans your store for all cookies, including those set by Magento extensions
  • New cookies appear in Cookie Manager → Unclassified to categorise
  • Blocks cookies until user consents
  • Logs every consent decision for audit purposes

Troubleshooting

Banner not appearing

  • Flush Magento cache (System → Cache Management)
  • Clear any Varnish/CDN/full-page cache
  • View page source and confirm the script is present in the <head>
  • Check browser console for errors

Script appears but cookies still firing

  • Magento extensions may set cookies server-side (before the script loads)
  • Run Cookie Manager → Rescan Domain to catalogue all cookies, then categorise them

Conflict with Magento's Cookie Restriction Mode

  • Disable it in Stores → Configuration → Web → Default Cookie Settings

Full documentation

For detailed setup help, see the support guide linked in your CookieScan dashboard, or visit our support guides.