Sign up

Installation guides

Install on a plain HTML site

Paste one script tag into the head of every page.

  1. Copy your snippet

    In MetricRaven, open your site's Settings → Install card and copy the script tag. It already contains your site ID.

  2. Paste it before </head>

    Replace YOUR_SITE_ID with the public site ID from your site's Settings → Install card. The site ID is public and safe in browser code; never put your secret key in a page.

    index.html
    <script
      defer
      src="https://metricraven.com/js/script.js"
      data-site-id="YOUR_SITE_ID"
    ></script>

    Add it to every HTML file you want tracked. If your pages share a template, include or partial (for example a static site generator's base layout), paste it there once instead.

  3. Upload and open the page

    Deploy the updated files and open a page on your live domain.

Verify it works

Open your live website in a normal browser window (not an automated or embedded one). In the browser's Network panel, look for script.js and then a request to /api/v1/collect whose response contains ok: true. Open your site's Traffic tab and choose Refresh; the selected dates must include your visit.

Nothing showing? See Troubleshooting.

Notes

  • Pages opened from disk (file://) or on localhost are not tracked unless you add data-allow-localhost; test on your real domain.
  • The page's hostname must match one of the domains in your site's Settings → Site, or a subdomain of one. Otherwise the collection request is refused with domain_not_allowed.

Optional script attributes are listed in Install & verify. To exclude your own visits, see Exclude your visits.