Przejdź do głównej zawartości

Add the script to any website

Ta treść nie jest jeszcze dostępna w Twoim języku.

The snippet works on any website. Using IdoSell or Next.js? See the IdoSell guide or the Next.js guide.

Copy the snippet from Install & setup, with your key already in it. Paste it high in the <head> of every page:

Every page, inside <head>
<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>
  • You can call qm(...) anywhere, at any time. Calls made before the script loads are queued.
  • The script loads asynchronously and never blocks rendering.
  • Put the snippet in one place only, such as your theme’s header template.
  • You never need to update the snippet when the script changes.
qm("init", {
key: "pk_live_…", // required: the site's public key
commerce: "auto", // "auto" (default) or "manual", see "Commerce: auto or manual"
cookieDomain: ".example.com", // share one session across subdomains
debug: false, // true: log what the script does to the console
});
Option Default Meaning
key — The site’s public key, pk_live_…. Required.
commerce "auto" Where commerce events come from. See Commerce: auto or manual.
cookieDomain The current host Set it to .example.com if visitors move between example.com and shop.example.com, so it stays one session.
debug false Writes what the script did, and what it ignored, to console.debug. The script logs nothing otherwise.
endpoint The script’s own host Where events are sent. You never need it in production.
platformPageDetection true On IdoSell, the script reads the page type from IdoSell’s own page marker. Set false to turn that off; your qm("page", …) calls, rules and URL words still decide.

The snippet already calls init, once per page.

If your shop sends a Content-Security-Policy header, allow the Quomerce host:

script-src ... https://ingest-prod.quomerce.com;
connect-src ... https://ingest-prod.quomerce.com;

The inline snippet also needs your CSP nonce on its <script> tag, or 'unsafe-inline' in script-src.