JavaScript API
Ta treść nie jest jeszcze dostępna w Twoim języku.
Use the call form, qm("command", …args). It works at any time, also before the script loads. The method form, qm.command(…), works only after it has loaded. Types are in qm.d.ts.
| Command | Arguments | What it does |
|---|---|---|
init |
{ key, commerce?, cookieDomain?, debug?, endpoint?, platformPageDetection? } |
Starts the script. Once per page; the snippet does it. See options. |
consent |
{ analytics?, replay? } |
Passes on the visitor’s choice. Every page load. See Consent. |
page |
{ type } |
Sets this page’s type. |
track |
name, props? |
A custom event. Both modes. |
identify |
customerId |
Links the session to a customer, as a hash. See Custom events and customers. |
ids |
callback |
Calls callback with { sessionId, visitorId, stored }, or null when the script is not running. See Save session ids on orders. |
qm("init", { key: "pk_live_…" });qm("consent", { analytics: true, replay: true });qm("page", { type: "thank_you" });qm("track", "size_guide_opened", { category: "shoes" });qm("identify", "customer-1042");qm("ids", (ids) => console.log(ids?.sessionId, ids?.visitorId));Commerce
Section titled “Commerce”Sent only in manual mode; ignored in auto mode.
| Command | Arguments |
|---|---|
commerce.productViewed |
product |
commerce.cartAdded |
product, quantity? |
commerce.cartRemoved |
product, quantity? |
commerce.cartViewed |
cart |
commerce.checkoutStarted |
cart |
commerce.shippingMethodSelected |
method |
commerce.paymentMethodSelected |
method |
commerce.paymentRedirected |
method, provider |
commerce.paymentReturned |
method, provider, "success" | "failure" | "unknown" |
commerce.couponApplied |
code, accepted |
commerce.purchase |
order |
commerce.searchPerformed |
term, resultCount? |
commerce.itemListViewed |
list, itemCount? |
commerce.itemSelected |
product, list?, index? |
commerce.wishlistAdded |
product |
commerce.promotionViewed |
promotion |
commerce.promotionSelected |
promotion |
commerce.signedUp |
method? |
commerce.loggedIn |
method? |
The shapes of product, cart, order, list and promotion are in Manual mode.
qm.versionis the loaded script’s version, such as"0.1.0".- Unknown commands and wrong arguments are ignored (logged with
debug: true). No command throws.
HTML attributes
Section titled “HTML attributes”| Attribute | Effect |
|---|---|
data-qm-mask |
Text inside is masked in replays. |
data-qm-block |
The element is not recorded; the replay shows an empty box. |
| URL | What |
|---|---|
https://ingest-prod.quomerce.com/sdk/v0/qm.js |
The script. v0 follows every compatible release. |
https://ingest-prod.quomerce.com/sdk/v0/qm.d.ts |
The TypeScript types. |
https://ingest-prod.quomerce.com |
Where events and replays are sent. |
https://app.quomerce.com |
The Quomerce app. |