HTTP API
This page document the HTTP APIs. These APIs are used by websites, servers or mobiles application to produce events.
You may want to take a look at the tracking script to add analytics to your website instead of directly interacting with the HTTP API.
Events API
Request to events API are rate limited by IP address (max 60 events per minute)
and
standard 429 Too Many Requests
responses are
returned if limit is exceeded.
Page View Events
You can create page view events using the following operation:
POST /api/v1/events/pageviews
.
-
Origin
header MUST contain origin of request. This is automatically added by browsers. -
X-Prisme-Referrer
orReferer
(with singler
typo) header MUST contains URL of viewed page. -
X-Prisme-Document-Referrer
header MUST contains client referrer, URL from which viewer comes from, if present. -
User-Agent
header MUST contains client User-Agent. This is used to determine browser and device. -
X-Forwarded-For
or value of PRISME_PROXY_HEADER option header (if PRISME_TRUST_PROXY is true) to determine client IP address. This is used to determine clients location. Typically, reverse proxies (such as Envoy used by Prisme Cloud) adds this header.
Server return 400 Bad Request
if URLs from headers are invalid or origin is
not registered.
Custom Events
Since v0.14.0, Prisme supports custom events. You can create custom events using
the following operation: POST /api/v1/events/custom/:name
(:name
corresponding to the name of your event such as click
, sign_up
, etc)
-
Origin
header MUST contain origin of request. This is automatically added by browsers. -
X-Prisme-Referrer
orReferer
(with singler
typo) header MUST contains URL of page that triggered the event. -
Content-Type
MUST beapplication/json
-
Request body MUST contains a valid, preferably flat for better query performance, JSON object. This is where you should put you're custom data.
Health Check
You can check that your instance is running with the following operation:
GET /api/v1/healthcheck
.