How do I add a cookie banner to Shopify?
On Shopify, you add the banner once to your theme code, in layout/theme.liquid. KEKSONAUT passes your visitors' choice to Shopify's Customer Privacy API. Shopify applies it to the surfaces it manages itself, such as pixels and checkout. The banner presents the choices. To make optional services wait for consent, also adjust their installation and then test the published website.
What you need before installation
- Your website is registered in KEKSONAUT and your banner is published. Find the Settings ID on the installation page.
- You can edit your Shopify theme code and change the settings under Settings → Customer privacy.
- You know which analytics, advertising and embed services the website uses and can adjust their existing installations.
Set up step by step
Prepare your website in your account
Add your website to KEKSONAUT. Select the services you use, review their categories and publish your banner. Your installation page provides the code with your Settings ID.Open the right insertion point
In Shopify admin, open Online Store → Themes and duplicate your live theme first as a backup. Then choose “…” → Edit code on the live theme and open theme.liquid in the Layout folder.Set up the code or plugin
Paste the installation code directly after the opening <head> tag, before the line with content_for_header, and save. Do not change content_for_header itself. Then, under Settings → Customer privacy → Cookie banner, remove Shopify's banner where Shopify offers “Remove cookie banner”, and select the same regions in which your KEKSONAUT banner asks for consent.Make optional services wait for consent
Configure tracking scripts and embeds using the blocking guide. Inline code needs an explicit service assignment. A visible banner alone does not hold back every service that has already started.Publish and test
Open your public website in a private browser window. Test a first visit, rejection, acceptance and withdrawal. Also test navigation and whether optional services wait for the matching consent.
Your installation code
Add the code at the insertion point described above. Preserve existing entries and load the runtime only once per document.
Paste your Settings ID — the code below updates automatically. Find it on your website's installation page in your account. The ID is public and is not an API key.
Add your Settings ID to get your finished installation code. Without an ID, you can copy the template with the SETTINGS_ID placeholder.
<script async src="https://api.keksonaut.com/runtime.js"
data-settings-id="SETTINGS_ID"
data-api-base="https://api.keksonaut.com"></script>What matters for your platform
Pixels under Settings → Customer events only follow the choice when their Permission is set to “Required”. The Customer Privacy API does not control scripts that apps or your theme add directly; set those up with the blocking guide. Your theme code does not load on checkout pages; checkout uses the choice Shopify already holds. Outside the regions set in Shopify, Shopify allows processing until a refusal arrives.
Official Shopify documentationExample: hold back an inline script
Replace direct execution with a deferred script and assign it to the service actually registered in your account. The service slug must match your account. This example is for Google Analytics 4; it does not replace a complete analytics setup.
<script type="text/plain" data-cm-service="google-analytics-4">
// Your existing analytics code
</script>How to check that installation works
Test the published website in a private browser window. Inspect the services you use and their requests; a visible banner alone does not confirm blocking.
- First visit and rejection: Optional services remain blocked.
- Selective consent: Only the permitted services start.
- Reopen settings and withdraw: The refusal still applies on the next page load.
- Navigation: The document contains only one banner script and the saved choice is still respected.
Consider your audience and services
The installation determines where the banner loads. Also review the choices your visitors need and the signals your services receive for your audience's region and your actual setup.
Frequently asked questions
Do I need an API key in the embed code?
No. The public embed code uses your website's Settings ID. An API key for management functions, such as in the WordPress plugin, must stay out of public code.
Does installation immediately block every tracker?
No. A visible banner alone does not hold back every service that has already started. Configure tracking scripts and embeds using the blocking guide.
Can I start with Free?
Yes. Free has no time limit and covers one website with 5,000 page views per month.
Do I need a Shopify app for this?
No. KEKSONAUT is not an app from the Shopify App Store. You add the installation code to theme.liquid; the banner script itself passes the choice to Shopify's Customer Privacy API. It never passes on a choice the visitor has not made as consent.
How do I avoid two cookie banners on Shopify?
Remove Shopify's banner under Settings → Customer privacy → Cookie banner and uninstall other consent apps. Set the same consent regions in Shopify as in KEKSONAUT: according to Shopify, non-essential data can otherwise be processed before consent. For third-party banners, Shopify also recommends naming Shopify in the banner text and linking Shopify's Consumer Privacy Policy from your privacy policy.