User Analytics
This guide explains how to retrieve analytics data for users using the Teyuto API.
Authentication
All requests to the Teyuto API require authentication. Include your API token in the Authorization header:
Authorization: YOUR_API_TOKEN
Endpoints
1. Get Generic User Analytics
Retrieve general analytics data for users.
Endpoint: GET /analytics/users
Parameters:
start_date
(required): Start date for the analytics period (format: YYYY-MM-DD HH:MM:SS)end_date
(required): End date for the analytics period (format: YYYY-MM-DD HH:MM:SS)collection_id
(optional): Get analytics for a specific collection
Example Request:
GET https://api.teyuto.tv/v2/analytics/users?start_date=2023-11-11 12:00:00&end_date=2023-12-11 12:00:00&collection_id=55589
Accept: application/json
Authorization: YOUR_API_TOKEN
Example Response:
{
"status": "success",
"sessions": "1000",
"time_watched": "500000"
}
2. Get Analytics for a Specific User
Retrieve analytics data for a particular user.
Endpoint: GET /analytics/users/{user_id}
Parameters:
user_id
(required): The ID of the usercollection_id
(optional): Get analytics of user on a specific collectionstart_date
(required): Start date for the analytics period (format: YYYY-MM-DD HH:MM:SS)end_date
(required): End date for the analytics period (format: YYYY-MM-DD HH:MM:SS)
Example Request:
GET https://api.teyuto.tv/v2/analytics/users/12345?collection_id=3654&start_date=2023-11-11 12:00:00&end_date=2023-11-12 12:00:00
Accept: application/json
Authorization: YOUR_API_TOKEN
Example Response:
{
"status": "success",
"sessions": "50",
"time_watched": "7200"
}
Interpreting the Results
sessions
: The number of viewing sessionstime_watched
: Total watch time in seconds
These analytics can help you understand user engagement and content popularity among your audience.