Skip to content

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:

  1. Add localhost as a trusted domain (dashboard, then Settings, then Domains). This is an explicit, permanent allowlist entry, and it also satisfies the check GET /v1/validate reports for originIsLocal origins.
  2. Enable “Allow local origins” on the project. One toggle covers localhost, 127.0.0.1, and any *.localhost subdomain, 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.