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.
Related
Section titled “Related”TroubleshootingReading the /v1/validate response field by field.
Capacitor & IonicWhy production hybrid apps share this toggle.