API reference
Build on Analify
On this page
Overview
Base URL: https://analify.dev. Requests and responses are JSON. Every endpoint is also listed, with a “try it” form, in the interactive API explorer.
| Credential | Looks like | Used for | Where to get it |
|---|---|---|---|
| API key | ak_live_… | Server events, users sync | Site → Settings → Server API keys |
| Data token | an_data_… | Pushing your own numbers | Site → Data |
| Source token | an_src_… | Analify calling your user-count endpoint | Site → Settings → Connect your users |
Keep keys on your server. Each key belongs to one website; revoke it any time from the same screen.
Browser tracker
The tracking code records pageviews automatically, including route changes in single-page apps. Options go on the script tag:
| Attribute | Effect |
|---|---|
data-site="AN-XXXXXX" | Your site’s tracking ID (required) |
data-hash | Count #hash changes as pageviews |
data-respect-dnt | Skip visitors with Do Not Track on |
data-user="123" | The signed-in user’s ID, same as analify.identify() |
analify.track("signup", { plan: "pro" }); // custom event, optional details
analify.identify("user_123"); // signed-in user; identify(null) clears
analify.brokenPage(404); // report this page as broken
analify.pageview(); // record a pageview manuallyThe names pageview, engagement and identify are reserved.
Send events from your server
For things that happen on your backend, like purchases. Send one event, or {"events": [...]} with up to 100.
curl -X POST https://analify.dev/api/v1/events \
-H "X-API-Key: ak_live_..." -H "Content-Type: application/json" \
-d '{"name": "purchase", "url": "/checkout/done", "props": {"amount": 49}, "user_id": "u_123"}'| Field | Type | Notes |
|---|---|---|
name | string | Defaults to pageview. Up to 120 characters. |
url | string | A full URL on the site, or a path like /checkout |
props | object | Up to 30 custom properties. Personal data is stripped. |
timestamp | ISO 8601 | Defaults to now; up to 7 days in the past |
ip + user_agent | string | The visitor’s, as your server received them. Joins this event to their browser visit, so it counts for campaigns and funnels. Not stored. |
user_id | string | Your user ID, scrambled before storage. Also joins visits. |
referrer | string | Optional |
country | string | Two-letter ISO code, if you know it |
{"accepted": 1, "rejected": []}Invalid events in a batch are reported by index in rejected; the rest are still stored.
Sync your users
Send everyone once (any dates, years back), then each new sign-up. One user, or {"users": [...]} with up to 1,000. Re-sending is safe.
curl -X POST https://analify.dev/api/v1/users \
-H "X-API-Key: ak_live_..." -H "Content-Type: application/json" \
-d '{"id": "u_123", "signed_up_at": "2024-05-01T10:00:00Z"}'A user deleted their account: Analify forgets them and unlinks their past visits.
curl -X DELETE https://analify.dev/api/v1/users/u_123 -H "X-API-Key: ak_live_..."Push your own numbers
Send any JSON the moment your numbers change; every number becomes a card with a daily chart. feed names the card group (letters, numbers, - and _).
curl -X POST "https://analify.dev/api/v1/data?feed=site" \
-H "Authorization: Bearer an_data_..." -H "Content-Type: application/json" \
-d '{"orders": {"today": 12, "pending": 3}, "tools": {"total": 15471}}'Your user-count endpoint
Instead of pushing, you can host an endpoint that Analify reads every hour:
Analify sends Authorization: Bearer an_src_…. Reply 401 unless the token matches, otherwise:
{"total_users": 1234,
"signups": [{"date": "2026-10-10", "count": 7}, {"date": "2026-10-11", "count": 5}]}signups is optional. The first request has no since (send your whole history); later ones ask for the last 35 days.
Errors and limits
Errors return a status code and a detail message that says what to fix.
| Status | Meaning |
|---|---|
400 | Every event in the request was rejected (see rejected) |
401 | Missing, invalid or revoked key or token |
402 | This month’s event allowance is used up; upgrade the plan |
403 | The website is archived; restore it to send data |
422 | The JSON doesn’t match the fields above |
429 | Rate limited. Wait for Retry-After seconds, or batch events |
Each API key can make 600 requests a minute. Batching up to 100 events per request goes a long way.