Track a custom event
Records a custom event: purchases, sign-ups, button clicks, or any other interaction that matters to you. Use Title Case for event names, e.g. Sign Up Success, not sign_up_success.
This is the endpoint the tracker uses in the browser (WysLeap.trackEvent); to send events from a server, use POST /api/v1/events with a secret key.
ApiKeyHeaderX-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.
application/json- body
siteId*stringYour site identifier.
eventName*stringEvent name in Title Case (e.g. "Purchase Completed").
eventData?Any JSON-serializable metadata for the event.
visitorId?stringVisitor ID to associate the event with.
sessionId?stringSession ID to associate the event with.
pageUrl?stringURL where the event occurred.
_apiKey?stringSite API key (or send it in the X-API-Key header).
Accepted. stored is false when the hit was dropped, e.g. no consent for an EU/EEA, UK or Swiss visitor.
application/json- response
success?booleantruestored?booleanfalse when the hit was not stored, e.g. a visitor in the EU/EEA, UK or Switzerland without consent.
reason?stringWhy the hit was not stored, e.g. consent_required.
curl -X POST https://wysleap.com/api/telemetry/event \ -H "Content-Type: application/json" \ -d '{ "siteId": "your-site-id", "eventName": "Purchase Completed", "eventData": { "productId": "prod_123", "productName": "Premium Plan", "currency": "USD" }, "visitorId": "vis_abc123", "pageUrl": "https://example.com/checkout/success", "_apiKey": "your-api-key" }'{ "success": true}