Events API
Anything that speaks Plausible's Events API works. Post to /api/event :
curl -X POST https://stats.example.com/api/event \
-H "User-Agent: Mozilla/5.0 …" \
-H "X-Forwarded-For: 203.0.113.7" \
-H "Content-Type: application/json" \
-d '{"n":"pageview","u":"https://example.com/pricing","d":"example.com","r":null,"w":1280}'
Fields
| Field | Required | Meaning |
|---|---|---|
n |
yes | Event name. pageview for pageviews |
u |
yes | Full URL, http or https |
d |
yes | Site domain as added in Tidemark |
r |
no | Referrer URL |
w |
no | Window width in pixels, used for the device type |
p |
no | Properties object. See limits |
h |
no | 1 to include the URL fragment in the path |
Long names are also accepted: name , url , domain , props .
Responses
| Status | Body | Meaning |
|---|---|---|
| 202 | ok |
Accepted. Also returned when the event was dropped by a bot filter or shield |
| 400 | message | Missing name, URL or domain, or an invalid URL |
| 404 | Unknown site |
The domain isn't a site in Tidemark |
Server-side notes
The endpoint is cross-origin by design. Visitor identity, location and device come from the request, so a server-side call identifies as your server unless you forward the visitor's User-Agent and X-Forwarded-For .
The request body may be sent as text/plain , which is what the script does to avoid a CORS preflight.