Installation
How to install the Ometra tracking snippet, including SPAs and how to verify it's working.
Ometra is a single, lightweight script. Add it once to the <head> of your site.
The snippet
Copy your site's snippet from Settings → Install:
<script defer src="https://ometra.io/js/<your-site-token>.js"></script>
The token in the URL identifies your site, so the same snippet keeps working even if you change domains, or serve the same site from both example.com and www.example.com.
Legacy attribute snippet
We also support the classic attribute style, if you prefer to key on the domain:
<script defer data-domain="yourdomain.com" src="https://ometra.io/om.js"></script>
Single-page apps
The script automatically tracks route changes in single-page apps (using the History API), so you don't need to do anything extra for client-side navigation.
Custom events API
Once the script is loaded, a global function is available for custom events:
window.ometra("Signup", { props: { plan: "pro" } });
Verifying it works
- Open Settings → Install — the status turns to "Receiving data" after your first event.
- Note that the script ignores traffic from
localhostby default. To test locally, add thedata-localattribute to the script tag. - The script also respects the visitor's Do Not Track and Global Privacy Control signals, and filters out known bots.
Do I need a cookie banner?
Because Ometra sets no cookies and stores no personal data, most sites won't need a consent banner for our analytics. Privacy law is fact-specific, though — confirm your obligations for your situation.