Platforms

How to add a cookie consent banner to a Shopware 6 store

In Shopware 6, add the snippet from a theme plugin that extends the storefront's meta.html.twig, in the head block that holds the tracking scripts. Then switch off "Use default cookie notification" under Settings, then General, then Basic information, so the built-in consent manager no longer shows, and move the Google tag out of the sales channel's analytics settings, because that tag waits for Shopware's own consent cookie.
Published 21 October 2026 · By the Cookiequiet team · Markdown

Steps

Copy your snippetIn the Cookiequiet dashboard, open your website and copy the install snippet: one script tag with your site key, data-consent-mode and data-auto-block set to 1, and defer.
Extend meta.html.twig in your theme pluginIn your theme or a small plugin, create src/Resources/views/storefront/layout/meta.html.twig that extends the storefront's template and overrides the layout_head_javascript_tracking block.
Paste the snippet before the parent blockInside the block, put the snippet first, then {{ parent() }} so Shopware's own tracking scripts still render after it. Clear the cache with bin/console cache:clear.
Turn off the default cookie notificationIn the Administration, go to Settings, then General, then Basic information, and in Legal and compliance switch off Use default cookie notification. Save.
Move the Google tagRemove the Google Analytics ID from the sales channel's analytics settings and paste the Google tag after the snippet, marked with type="text/plain" and data-cq-category="analytics", or load it through Google Tag Manager.
Add the Cookie preferences linkIn Catalogues, then Categories, create a category of type Link, external, with #cq-preferences as the link target, and place it in the footer navigation.
Test the storefrontOpen the store in a private window, click Reject all and check that no _ga or _fbp cookie is set. Accept all, reload, and check the consent log.

Where to paste the snippet in Shopware 6

Shopware 6 has no Administration field for head code. Scripts in the head come from the storefront template layout/meta.html.twig, which you extend from your theme or a small plugin, the way Shopware's developer documentation describes for script tags. The block layout_head_javascript_tracking holds the tracking scripts Shopware prints itself, so the snippet goes there, before them:

twig
{# <plugin root>/src/Resources/views/storefront/layout/meta.html.twig #}
{% sw_extends '@Storefront/storefront/layout/meta.html.twig' %}
​
{% block layout_head_javascript_tracking %}
<script src="https://cookiequiet.com/cq.js" data-site="YOUR_SITE_KEY" data-consent-mode="1" data-auto-block="1" defer></script>
{{ parent() }}
{% endblock %}

Keep {{ parent() }}: without it, the block's original content would not render. Install and activate the plugin if it is new, then clear the cache (bin/console cache:clear). Shopware Store extensions that add code to the head do the same job without a plugin of your own, as long as they print it in the head.

Shopware ships its own cookie consent manager, with the categories Technically required, Comfort functions, Statistics and Marketing. In current Shopware 6 versions, the switch is in the Administration: Settings, then General, then Basic information, card Legal and compliance, option Use default cookie notification. Shopware's help text says to deactivate it only when you use a third-party solution, which is the case here. Turn it off and save, so visitors see one banner.

Shopware's own cookies stay: the session- cookie for the cart and login and timezone are technically required, and cookie-preference and cookie-config-hash (30 days) belonged to the built-in manager. The free cookie scanner lists what your extensions add.

What happens to Shopware's Google Analytics integration?

The Google Analytics ID you enter in a sales channel's analytics settings is printed by Shopware itself. Its template sets Google's consent defaults to denied and only loads the tag once Shopware's own consent cookie for Google Analytics is set, which its consent manager writes. With that manager off, the integration stays silent. Two options:

  • Paste the tag yourself. Remove the ID from the sales channel and add the Google tag to the same block, after the snippet, marked so it runs only with analytics consent:
html
<script type="text/plain" data-cq-category="analytics" src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script type="text/plain" data-cq-category="analytics">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXX');
</script>
  • Use Google Tag Manager for e-commerce events, with Consent Mode fed by data-consent-mode="1", as in the Google Tag Manager guide.

Other extensions that register their cookies with Shopware's consent manager and wait for it should be checked one by one: either the extension lets you load it unconditionally (then mark its script or let the auto-blocker hold it), or it keeps waiting for a consent that no longer comes. Scripts injected with JavaScript from about 80 known trackers are held by Cookiequiet's auto-blocker until their category is granted; see blocking scripts until consent.

Shopware's own FAQ uses a link category for its cookie settings, and the same works for Cookiequiet: Catalogues, then Categories, create a category named "Cookie preferences", set its type to Link, the link type to External, switch off the protocol option and enter #cq-preferences as the target. Activate it and place it in the footer navigation. Cookiequiet opens the preferences centre from any link with that address.

How to test

  1. Open the storefront in a private window. Shopware's cookie bar should be gone and Cookiequiet's banner shown.
  2. Click Reject all and check the cookies: cq_consent, the session- cookie, and no _ga or _fbp.
  3. Add a product to the cart and open the checkout: the session cookie keeps the cart.
  4. Clear the cookies, click Accept all, reload: the marked tags run. Check the consent log in the dashboard.

Cookiequiet is free for one store with geo-targeting included, and Starter is €3 per website per month with no pageview limit, see pricing.

Questions

Yes. In current Shopware 6 versions, go to Settings, then General, then Basic information, and switch off Use default cookie notification in the Legal and compliance card. Shopware recommends this only when a third-party solution replaces it.
Shopware's built-in integration loads the Google tag only after its own consent manager has stored consent for it. Remove the ID from the sales channel and paste the Google tag after the Cookiequiet snippet, marked for analytics.
Not needed. A few lines in your theme's meta.html.twig add the snippet to the head of every storefront page, and the rest is set in the Cookiequiet dashboard.
The session cookie that holds the cart and login, and the timezone cookie, are technically required. Shopware lists them as protected cookies that its own consent manager never removes.

Put a quiet banner on your website today

Free for one website with every core feature, no card and no trial clock. Upgrade a website to Starter for $3 a month to match your brand with AI and drop the branding, or to Pro for $9 to design it with the AI agent.