Add the script with Google Tag Manager
Use this guide if your shop already loads Google Tag Manager (GTM) and you would rather not edit the theme. You add two tags to the container: one loads the script, the other passes on the visitor’s consent.
Before you start
Section titled “Before you start”- The website is added in Quomerce and you have its key,
pk_live_…, from Install & setup. - The shop’s address is in Allowed domains in the site’s settings. The address with
wwwand without it are two different addresses. - You can publish the shop’s GTM container.
1. The tag that loads Quomerce
Section titled “1. The tag that loads Quomerce”-
In GTM, open the shop’s container and go to Tags → New. Name the tag
Quomerce. -
Click Tag Configuration and choose Custom HTML.
-
Paste the snippet from Install & setup, with your key already in it:
Quomerce <script>!function(w,d,u){if(w.qm&&w.qm.s)return;var q=w.qm=w.qm||function(){(q.q=q.q||[]).push(arguments)};q.q=q.q||[];q.s=u;var e=d.createElement("script");e.async=!0;e.src=u;(d.head||d.documentElement).appendChild(e)}(window,document,"https://ingest-prod.quomerce.com/sdk/v0/qm.js");qm("init",{key:"pk_live_…"});</script> -
Leave Support document.write off. Under Advanced Settings → Tag firing options, choose Once per page.
-
Click Triggering and choose Initialization - All Pages. It fires before every other trigger on the page, so Quomerce starts as early as GTM allows.
-
Save.
Do not add consent checks to this tag. Until the visitor agrees, the script stores nothing on the device and records no replay, so it can load for everyone. The next tag tells it when they agree.
2. The tag that passes on consent
Section titled “2. The tag that passes on consent”Skip this step if Consent in Analytics settings is Not required.
The script does not remember the visitor’s choice, so this tag has to fire on every page once the visitor has agreed, and also at the moment they click to agree.
-
Tags → New. Name it
Quomerce – consent, choose Custom HTML and paste:Quomerce – consent <script>window.qm=window.qm||function(){(window.qm.q=window.qm.q||[]).push(arguments)};qm("consent",{analytics:true,replay:true});</script> -
Under Advanced Settings → Consent Settings, choose Require additional consent for tag to fire and add
analytics_storage. GTM then fires the tag only for visitors who agreed to statistics. -
Under Triggering, add All Pages.
-
Add a second trigger for the moment the visitor makes their choice. Your banner pushes an event into the
dataLayerthen, and its name depends on the banner. To find it, click Preview, open the shop, accept the banner, and note the event that appears in Tag Assistant’s left column. Back in GTM, create a Custom Event trigger with that event name and add it to this tag. -
Save.
To have Quomerce’s cookies removed at once when somebody withdraws consent, add a third tag with qm("consent",{analytics:false,replay:false});, fired by your banner’s “consent withdrawn” event. Without it, the next page simply loads with no consent.
Most shops put Quomerce under statistics or analytics in the banner. See Consent and URLs, requests and cookies for what is stored.
3. Cart, checkout and purchases
Section titled “3. Cart, checkout and purchases”If the shop pushes GA4 e-commerce events (view_item, add_to_cart, begin_checkout, purchase…) into the dataLayer, there is nothing more to do: Quomerce reads them there itself, in the default auto mode. You need no GTM tag or trigger per event.
If it does not, see Commerce: auto or manual.
4. Publish and check
Section titled “4. Publish and check”-
Click Preview and open the shop. In Tag Assistant,
Quomerceshould be under Tags Fired on every page, andQuomerce – consentonce you accept the banner. -
Click Submit, then Publish. Nothing reaches shoppers until the container is published.
-
Open the shop in a normal window, accept the banner, view a product, add it to the cart and start checkout. In Quomerce, open Install & setup: the Verification list fills in within a minute. See Check that it works.
When something does not work
Section titled “When something does not work”Nothing reaches Quomerce
- Is the container published? Preview shows your workspace, shoppers only see published versions.
- Is the shop’s address in Allowed domains?
- Does the shop send a
Content-Security-Policyheader? It must allowhttps://ingest-prod.quomerce.com, and GTM’s Custom HTML tags need its nonce or'unsafe-inline'. See Content Security Policy. - Do you have an ad blocker? It may block GTM or Quomerce. Try another browser.
Visits arrive, but no replays, and every page looks like a new visit
That is expected for visitors who declined statistics. If you accepted and still see it, Quomerce – consent did not fire: check in Preview that it is under Tags Fired, not Tags Not Fired, after you accept the banner, and on the next page.
The tag fires twice
That is harmless: the script starts only once per page. Remove the extra trigger anyway, and make sure the snippet is not also pasted in the theme.
Still stuck? See Troubleshooting or write to [email protected].