WysLeap
WysLeap Docs

Track a page view

POST
/api/telemetry/pageview

Records a page view. This is the endpoint the tracker script uses in the browser; to send data from a server, use POST /api/v1/events with a secret key.

Authorization

ApiKeyHeader
headerX-API-Key<token>

The site API key from Site Settings, in the X-API-Key header or as _apiKey in the JSON body. It ships in your tracker snippet, so it isn't a secret: the endpoints also check the page's domain against your allowed domains.

Request Body

application/json
  1. body
siteId*string

Your site identifier.

pageUrl*string

Full URL of the page being viewed.

pageTitle?string

Page title (document.title).

referrer?string

Referring URL.

visitorId?string

Visitor ID — auto-generated if omitted.

sessionId?string

Session ID — auto-generated if omitted.

userAgent?string

Browser user-agent string.

screenWidth?integer

Viewport width in pixels.

screenHeight?integer

Viewport height in pixels.

language?string

Browser language (e.g. en-US).

timeZone?string

IANA timezone identifier.

_apiKey?string

Site API key (or send it in the X-API-Key header).

Response Body

Accepted. stored is false when the hit was dropped, e.g. no consent for an EU/EEA, UK or Swiss visitor.

application/json
  1. response
success?boolean
Defaulttrue
stored?boolean

false when the hit was not stored, e.g. a visitor in the EU/EEA, UK or Switzerland without consent.

reason?string

Why the hit was not stored, e.g. consent_required.

Example Request
curl -X POST https://wysleap.com/api/telemetry/pageview \  -H "Content-Type: application/json" \  -d '{    "siteId": "your-site-id",    "pageUrl": "https://example.com/products",    "pageTitle": "Products - Example Store",    "referrer": "https://google.com",    "visitorId": "vis_abc123",    "sessionId": "sess_xyz789",    "userAgent": "Mozilla/5.0...",    "screenWidth": 1920,    "screenHeight": 1080,    "language": "en-US",    "timeZone": "America/New_York",    "_apiKey": "your-api-key"  }'
Example Response
{  "success": true}