POST /track/session/end
Ends a tracking session, calculates the final engagement score, and persists it.
Request Body
json
{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"visitor_id": "a1b2c3d4e5f6...",
"exit_page": "https://example.com/about",
"timestamp": 1740000060000
}| Field | Required | Description |
|---|---|---|
session_id | Yes | Session ID to end |
exit_page | No | Last page the user was on |
visitor_id | No | Visitor ID |
timestamp | No | End timestamp (defaults to Date.now()) |
Response (200)
json
{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"ended_at": 1740000060000
}Background Processing
- Update session record: set
ended_at,exit_page, computeduration - Calculate final engagement score from all session events
- Persist engagement score to session record
Errors
| Status | Condition |
|---|---|
| 400 | Invalid JSON body |
| 400 | Missing session_id |