Create a free account
Register at console.openanalyticsapi.com. No credit card required. The free tier includes 1M events/month and unlimited projects.
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.
Add the tracking snippet
Paste this into the <head> of every page on your website:
<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.
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
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.
Track a custom event
Anywhere in your JavaScript, call:
// 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.
Track a conversion
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.
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 -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
/collectendpoint does not accept Bearer tokens — authentication is implicit via the publicsite_id+ abuse protection.