QM QuantumMetricApi

Created by Alex Avila

what is the QuantumMetricAPI ?
The QuantumMetricAPI is a global JavaScript object (usually accessible via window.QuantumMetricAPI) that provides developers with a set of methods to programmatically interact with the QM tag. It allows us to send custom data, trigger events, and manage user identity in real-time."

1/14

TermDefinition
what is the QuantumMetricAPI ?
The QuantumMetricAPI is a global JavaScript object (usually accessible via window.QuantumMetricAPI) that provides developers with a set of methods to programmatically interact with the QM tag. It allows us to send custom data, trigger events, and manage user identity in real-time."
What is the difference between the Tag and the API?
The Tag is passive (it watches). The API is active (the website tells it what to do).
What is a Method?
Method is a specific command or 'action' that we tell the tag to perform.
Is 'Method' the same thing as 'Function'?
In this context, yes. A method is just a function that "belongs" to an object (like the QuantumMetricAPI).
What is QuantumMetricAPI.getConfig()?
This method returns a JavaScript object containing the current configuration settings of the Quantum Metric tag as it is running in the user's browser.
What kind of 'object' does it return?
A standard JSON-style JavaScript object.
What is QuantumMetricAPI.newSession()?
When this method is called, the current session is immediately finalized and closed, and a brand-new Session ID is generated
What happens to the 'User ID' when a new session starts?
The User ID (Visitor ID) stays the same, but the Session ID changes. QM will still know it’s the same person, just a different visit.
PSE using new page
We've found that QuantumMetricAPI.newPage() is an incredibly effective tool in cases where complex DOM mutations or transitions aren't captured Manually triggering newPage() forces a state refresh, ensuring that the session replay remains a 'source of truth' for the user's actual experience."
QuantumMetricAPI.getReplay()?
This method retrieves the specific, unique URL of the session replay that is currently being recorded.
QuantumMetricAPI.uploadRL()
QuantumMetricAPI.uploadRL() is used to manually send Replay data to Quantum Metric
Why use it? uploadRL()
If you are testing a new page and the replay looks like plain HTML (no styling), a developer can call this in the console to see if uploading the resources fixes the visual.
How is this different from forceElementCSSUpload?
forceElement... is a Configuration (it happens automatically). uploadRL() is a Method (it happens when a developer tells it to).
How can you check all available methods for QuantumMetricAPI?
(Object.getPrototypeOf(QuantumMetricAPI))