Mandera Docs
Getting started

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.js is 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.
  • 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:

  • popstate is listened to for back/forward navigation
  • history.pushState is 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 POST request to /api/analytics/status-update confirms 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 src URL is reachable.
  • Confirm mandera-org and data-property-id are set.
  • Ensure your browser isn’t blocking requests (ad blockers can sometimes block analytics endpoints).

On this page