Skip to main content

Video Analytics

Records detailed analytics about video watch events, including duration and playback position.

Endpoint​

POST /api/video-analytics

Authentication​

Authentication is optional. If provided, the analytics will be associated with the authenticated user. If not provided, the analytics will be recorded anonymously.

Request Body​

ParameterTypeRequiredDescription
videoIdintegerYesThe ID of the video content that was watched
watchedDurationnumberYesThe duration (in seconds) that the user watched the video
currentTimenumberYesThe current playback position (in seconds) when the analytics event was recorded

Example:

{
"videoId": 123,
"watchedDuration": 45,
"currentTime": 120
}

Response​

Success Response​

Code: 200 OK

A success response object is returned.

Error Response​

Code: 400 Bad Request

Content: {error}

Notes​

  • This endpoint is specifically designed for tracking video engagement
  • Analytics events are typically logged at regular intervals (approximately every 15 seconds)
  • The system may filter out events where the user is seeking through the video
  • Both the total watched duration and the current playback position are tracked to provide comprehensive analytics
  • This data helps content creators understand how users engage with their videos, including drop-off points and most-watched segments
  • Video analytics are more detailed than standard view events and provide insights into content quality and user engagement

Example​

curl -X POST "https://api.tribesocial.io/api/video-analytics" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"videoId": 123,
"watchedDuration": 45,
"currentTime": 120
}'