Install MetricMind on Angular

Paste the MetricMind script tag into the <head> of src/index.html, then build and deploy. Router page changes are counted automatically.

Add the tag

Replace YOUR_SITE_ID with your site's ID. In MetricMind, open your site, then Settings → Setup. The ID is in the header of the Install it yourself panel, and the Script tag tab there shows the tag with your ID already filled in.

  1. Open src/index.html.
  2. Paste the tag inside <head>.
    <script src="https://cdn.metricmind.si/mm.js" data-site="YOUR_SITE_ID" defer></script>
  3. Build with ng build and deploy as usual.

Check that it works

  1. Open your live site in a normal browser window, with ad blockers off, and load a page or two.
  2. In MetricMind, open your site's Settings → Setup page. The panel at the top says Waiting until the first page view arrives, then Live. It usually takes under a minute. Reload the page if it hasn't changed.
  3. ng serve runs on localhost, which the script ignores. To try it there, add data-allow-local="true" to the tag, and remove it before you ship.

Still on Waiting?

  • An ad blocker in your browser. Some block analytics. Test with extensions off.
  • A different address. Events are accepted from the domain you registered in MetricMind, its www. version and its subdomains. To test on another address, such as your platform's free or staging domain, add it under Settings → Security → Allowed origins.
  • Local testing. The script ignores localhost and private addresses, so test on the live site.
  • The tag didn't arrive. View your page's source and search for mm.js. If it's there, open your browser's developer tools: [MetricMind] Missing data-site in the Console means the tag lost its ID, and in the Network tab /v1/batch should answer 202.

What goes wrong on Angular

Put it in index.html, nowhere else

Not in a component template, where Angular doesn't run script tags, and not in the scripts array of angular.json, which bundles a file into your build and loses the tag's data-site.

Hash routing

If you use withHashLocation(), your addresses look like example.com/#/page. Add data-hash="true" so those count as pages:

<script src="https://cdn.metricmind.si/mm.js" data-site="YOUR_SITE_ID" data-hash="true" defer></script>

security.autoCsp removes the site ID

With security.autoCsp on, the Angular CLI replaces script tags in index.html with a loader that keeps src, type, async, defer, integrity and crossorigin only. data-site is lost and nothing is sent. Leave the tag out of index.html and load it from code instead. Also allow in.metricmind.si in connect-src if your server sends its own policy.

// src/main.ts, at the top
const s = document.createElement("script");
s.src = "https://cdn.metricmind.si/mm.js";
s.defer = true;
s.setAttribute("data-site", "YOUR_SITE_ID");
document.head.appendChild(s);

Privacy

MetricMind sets no cookies and builds no profiles. In the EU, storing an ID on the device can need consent even without cookies, so for the strictest reading turn on storage-free mode (data-storage="none"), which stores nothing in the browser. Your obligations depend on your jurisdiction and the rest of your stack, so check with your counsel.

To turn on storage-free mode, add data-storage="none" to the tag before defer. What changes in that mode.

Next

  • To leave out your own visits, open https://yoursite.com/?mm_optout=1 once in each browser you use (=0 turns it back on).
  • Page views, sources, contact clicks, site search, Web Vitals and errors are collected without more setup. To count your own actions, see events.

Sources

The steps and plan rules come from these pages, as of November 2026. Platforms change their menus, so tell us if something has moved.