Configure analytics and consent

Use this when marketing needs analytics or conversion tracking in the online shop.

Before you start

Get legal approval for the consent behavior and confirm which tool owns tracking, such as a consent manager, analytics platform, or tag manager.

Steps

  1. Open Shops and select the shop.
  2. Open Checkout and set the Mode in the Analytics section. Privacy-preserving is the default and sends no events to your tag manager; select Consent-managed when conversion and e-commerce events should reach the data layer after the customer grants consent.
  3. Open Code snippets.
  4. Add approved consent or analytics code under Custom HTML.
  5. Add approved styling only under Custom CSS.
  6. Save the shop.
  7. Test a full checkout with consent accepted and rejected.
  8. Confirm the analytics tool receives only the approved events.
Shop code snippets for analytics and consent
Use Code snippets for approved consent and analytics code after legal and technical review.

Choose the snippet position

The online shop loads custom HTML differently depending on its configured position:

  • Head snippets are part of the initial page response. Use this position only for small scripts that must run before the visible page, such as a consent manager that blocks tracking until the visitor makes a choice.
  • Body snippets wait until the initial page load has finished. They then start when the browser is idle, with a finite maximum wait. Browsers without idle scheduling use a task after page load instead. Use this position for analytics, tag managers, badges, and optional widgets so they do not compete with the initial shop content.
  • Body scripts that depend on one another keep their configured order unless a script is explicitly asynchronous. An ordered external body script that does not load within 10 seconds is skipped so later snippets can continue.
  • A `<noscript>` fallback remains available when the visitor has disabled JavaScript.

Loading a script during idle time after page load keeps it off the initial loading path, but third-party code can still use significant processing time afterwards. Remove duplicate tags, use asynchronous loading when execution order is not required, and load interactive widgets only when the visitor needs them.

What to test

TestWhy it matters
Consent acceptedConversion tracking should fire when allowed.
Consent rejectedNon-essential tracking should stay blocked.
Checkout completedConversion event should match a real order.
Payment failedFailed checkout should not count as a purchase.
Mobile browserConsent banners can hide checkout controls on small screens.
Initial page loadOptional body snippets should not delay the visible shop.

Expected result

Tracking follows the approved consent rule and does not interfere with checkout, payment, or customer documents.

Troubleshooting

ProblemWhat to check
Conversion is missingThe Analytics Mode (must be Consent-managed), granted consent, snippet position, blocked scripts, and thank-you page behavior.
Duplicate conversionsTag manager triggers, repeated page loads, and payment retry flow.
Checkout layout breaksCustom CSS, banner size, mobile viewport, and snippet errors.
A later snippet is missingWhether an earlier ordered body script failed or exceeded the 10-second loading limit.

Ready to Get Started?

Book a free demo or reach out — we’d love to hear from you.