Installation
How to install the Mandera tracking snippet on your website
Mandera tracking is a single script (analytics.js). Add it once per page to start collecting page analytics, heatmaps, and events.
Basic Installation
Paste this into your page’s <head> (or anywhere in the document — it initializes on window.onload):
<script
src="https://<your-mandera-web-url>/analytics.js"
mandera-org="ORG_ID"
data-property-id="PROPERTY_ID"
async
></script>Attributes
src- Where
analytics.jsis hosted. - If you use Mandera hosted, the dashboard provides the full URL.
- If you self-host Mandera web, it’s typically
https://<your-mandera-web-url>/analytics.js.
- Where
mandera-org- Your organization id.
- The snippet uses this attribute to locate its own
<script>tag, so it must be present.
data-property-id- The property id that analytics and events should be attributed to.
SPA / Client-Side Routing
If your app uses the History API (most SPAs), navigation is tracked automatically:
popstateis listened to for back/forward navigationhistory.pushStateis patched to detect route changes
No extra integration is required.
Disable Tracking
There is no “config object” to toggle tracking from the snippet itself. You disable tracking by controlling when (or if) the script is loaded.
Common patterns:
- Consent-based tracking: only inject the
<script>tag after the user opts in. - Environment-based tracking: omit the
<script>tag in local/dev environments.
For disabling tracking in parts of the page (without removing the script), see data-ma-no-track in the Heatmaps and Events docs.
Verify Installation
After installing, load your site and check DevTools → Network:
- A
POSTrequest to/api/analytics/status-updateconfirms the snippet connected. - Additional requests appear as users interact:
/api/analytics/visitor(page analytics)/api/heatmap(heatmap batches)/api/analytics/event(custom / auto events)
If you don’t see any requests:
- Confirm the snippet’s
srcURL is reachable. - Confirm
mandera-organddata-property-idare set. - Ensure your browser isn’t blocking requests (ad blockers can sometimes block analytics endpoints).