Docs / Quick Start

Quick Start

Get tracking in under 2 minutes.

1

Create a free account

Register at console.openanalyticsapi.com. No credit card required. The free tier includes 1M events/month and unlimited projects.

2

Create a project

In the console, click New project. Choose Web (mobile SDKs are in private beta — see platform docs) and enter your domain. You'll get a unique site_id.

3

Add the tracking snippet

Paste this into the <head> of every page on your website:

HTML
<script async defer
  src="https://www.openanalyticsapi.com/sdk/oa.js"
  data-site="YOUR_SITE_ID"></script>

data-site is the public site_id identifier for your project — it's safe to expose in client-side code. It is not a secret API key.

Replace YOUR_SITE_ID with the site_id from your project settings.

4

That's it!

The script automatically tracks:

  • Pageviews (including SPA navigation)
  • Session start / end / bounce
  • Browser, OS, device type, screen size
  • Country, city, timezone (from anonymized IP)
  • Referrer and UTM parameters
  • Language preference
5

Verify your first pageview

Open your site in a browser, then check the Realtime tab in the console. You should see a pageview within a few seconds. If nothing appears, open DevTools → Network and look for a request to api.openanalyticsapi.com/collect returning 204.

6

Track a custom event

Anywhere in your JavaScript, call:

JavaScript
// Custom event with properties
window.oa && window.oa('event', 'signup', {
  plan: 'pro'
});

// Identify a known user (optional)
window.oa && window.oa('identify', 'user_123', {
  email_hash: 'sha256_of_email'
});

The window.oa && guard is recommended so calls before the script has loaded don't throw. The snippet itself also queues calls made before it loaded.

7

Track a conversion

JavaScript
window.oa && window.oa('conversion', 'purchase', {
  revenue: 49.99,
  currency: 'USD',
  plan:     'pro'
});

For ad-blocker-resilient tracking, also send conversions from your server (see Step 8). The server-side event is the source of truth.

8

Send a server-side event (optional)

From your backend, POST to the REST API. Use a private oa_live_* key — never expose this token in browser code.

curl
curl -X POST https://api.openanalyticsapi.com/v1/projects/YOUR_PROJECT_ID/events \
  -H "Authorization: Bearer oa_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type":  "conversion",
    "event_name":  "purchase",
    "user_id":     "sha256_of_user_id",
    "url":         "https://example.com/thanks",
    "properties":  {"plan":"pro"},
    "revenue":     49.99,
    "currency":    "USD",
    "timestamp":   1747000000000
  }'

Hash or anonymize user_id before sending. See the Server-side guide for PHP and Node.js examples.

Privacy mode (default)

The snippet runs in cookieless mode by default: IP addresses are anonymized server-side before storage, and users are identified by a daily-rotated fingerprint hash — no persistent tracking cookie is set on your visitors' devices. A cookie banner may not be required, but final consent obligations depend on your jurisdiction and overall site setup. See GDPR & Privacy for opt-out APIs and Do Not Track behavior.

⚠ Site ID vs. API key

  • data-site / site_id — public identifier. Safe in client-side code and HTML source.
  • oa_live_* — secret API token. Server-side only. Never put it in a browser snippet or commit it to a public repo.
  • The frontend /collect endpoint does not accept Bearer tokens — authentication is implicit via the public site_id + abuse protection.

Part of the Open API ecosystem