MIRA FIVE

Quickstart

Create a website source, add the script to your site, and see your first pageview and custom event arrive in MIRA FIVE.

This page takes you from nothing to a verified first event in about five minutes. It uses the hosted script, which works on any website. For a framework package, follow its page under SDKs instead; the steps are the same.

Create a project

Sign up at app.mirafive.io. Signing up creates your organization and walks you through your first project.

Add a website source

In the project, go to Data → Sources → Add source and choose Website.

  • Allowed origins: the site's address, for example https://shop.example.com. www. and the bare domain count as one site. localhost and 127.0.0.1 are always allowed, on any port.
  • Collection mode: keep Consentless unless your site already has a consent banner. It needs no banner and stores nothing on the device. See Consent.

Create the source. It comes with a website key (mf_…) and a ready snippet on the Install tab. More about keys: Keys.

Add the script

Paste into the <head> of every page, with your website key:

index.html
<script>window.mirafive=window.mirafive||function(){(mirafive.q=mirafive.q||[]).push(arguments)}</script>
<script defer src="https://cdn.mirafive.io/mira.js" data-key="mf_…"></script>

The first line queues calls made before the script arrives. Pageviews are recorded on load and on every client-side navigation.

Track a custom event

Call track with an event name and optional properties where something happens:

<script>
  document.querySelector('#signup').addEventListener('submit', () => {
    mirafive('track', 'signup', { plan: 'pro' })
  })
</script>

Use short snake_case names for things that happened: signup, checkout_started, invoice_paid. See Track events.

Verify

  1. Open your site on its real domain. Events from localhost are dropped by default, so the script sends nothing during local development unless you allow it (data-track-localhost on the tag, trackLocalhost: true in the SDK).
  2. Open the browser's network tab. Batches leave 5 seconds after the first event or when the tab is hidden. With the script tag you can send one now by running mirafive('flush') in the console.
  3. Look for POST https://events.mirafive.io/v1/batch/mf_… answering 202:
{ "batch": "0192d4a8-7b1c-4e8a-9c1d-2b3e4f5a6b7c", "accepted": 2, "dropped": 0 }
  1. In the dashboard, open Data → Live. Your pageview and the signup event show up within seconds, and the project's setup guide switches to Receiving events.

Check a key from the terminal

To test the key and your network before touching the site, send the reserved $install_check event. MIRA FIVE answers but never stores or counts it:

curl -X POST https://events.mirafive.io/v1/batch/mf_… \
  -H "Content-Type: text/plain" \
  -d '{"v":1,"batch":"0192d4a8-7b1c-4e8a-9c1d-2b3e4f5a6b7c","mode":"consentless","events":[{"name":"$install_check"}]}'
{ "batch": "0192d4a8-7b1c-4e8a-9c1d-2b3e4f5a6b7c", "accepted": 0, "dropped": 1, "reason": "install_check" }

A 401 means the key is wrong; a 403 names the problem. See Verify and debug.

Next steps

On this page