mybasev1.0.21

Analytics

Cookieless page views, custom events, and errors from your app, with a script tag or the SDK.

mybase analytics enable shop     # prints the public write key and a script tag
mybase analytics stats shop --range 7d

Add the script tag, or createAnalytics from @mybase-dev/sdk/analytics:

<script defer src="https://mybase.example.com/analytics.js" data-project="shop" data-key="mba_…"></script>

It records page views (including client-side route changes) and uncaught errors; track("signup", { plan }) adds custom events. No cookies; visitors are a daily-rotating hash and IPs are never stored. Guides: SDK analytics, wire format.

Security

  • The write key is public by design. Set allowed origins so other sites can't add events.
  • Never put emails, names, or tokens in events, URLs, or error messages; keep retention short.

More: Security best practices.

Agent notes

  • The write key (mba_…) is public and only adds events: fine in browser code. Never put an mb_… API key in the browser.
  • Events are buffered and written every 10 s, so new data shows up after a short delay.

On this page