Localhost & development
/ingest drops localhost-ish Origins (localhost, 127.0.0.1, *.localhost) by default, because otherwise anyone’s dev server could impersonate your production domain. Allow them for a project in one of two ways:
- Add
localhostas a trusted domain (dashboard, then Settings, then Domains). This is an explicit, permanent allowlist entry, and it also satisfies the checkGET /v1/validatereports fororiginIsLocalorigins. - Enable “Allow local origins” on the project. One toggle covers
localhost,127.0.0.1, and any*.localhostsubdomain, without adding each as a domain. It is the same toggle used for Capacitor/Ionic hybrid apps, so turning it off later affects both.
Either way, point data-api at your local API instance during development if you’re not using the production API:
<script src="https://cdn.analytics.canarycoders.es/lytics.js" data-domain="myapp.com" data-api="http://localhost:3031" defer></script>data-api defaults to https://api.analytics.canarycoders.es; override it any time you point the tracker at a self-hosted or local API origin. Verify the setup with GET /v1/validate?domain=...&origin=http://localhost:5173.
Keep your own visits out of the stats
Section titled “Keep your own visits out of the stats”With local origins allowed, your dev visits land in the same project as production traffic. Run window.lytics.internal(true) once in the browser console and every event that browser sends is tagged as internal traffic: still stored, but hidden from stats unless you opt in with includeInternal.