# Get viewer analytics in Wowza Video with the Wowza Video REST API Viewer analytics provide information regarding viewers, renditions, devices, and countries. This data is crucial for streaming platforms and content providers to enhance user experience, optimize content libraries, and drive engagement. - Rendition metrics ensure that viewers receive content at the appropriate quality level and viewer count data highlights content popularity. - Device metrics provide insight into device types which helps with optimizing content delivery and user experience. - Country metrics enable content and marketing strategies to be tailored to specific regions. ## Get viewer analytics for a live stream See viewer data for a live stream by sending a `GET` request to the `/analytics/viewers/live_streams/{id}` endpoint. You can use the following sample request, making sure to: - Set `from` and `to` query parameters to query historic viewer data. This sets the range of time you want to view. To get data for streams that are currently live, do not send `from` and `to` values. - Send the `include` query parameter to specify what data you want to return, including `countries`, `renditions`, `devices`, and `trend` data. #### Sample Request Endpoint Reference ``` curl -H "Authorization: Bearer ${WV_JWT}" \ -H "Content-Type: application/json" \ -X "GET" \ "${WV_HOST}/api/${WV_VERSION}/analytics/viewers/live_streams/[live_stream_id]?from=2024-03-14T10:31:54.486Z&to=2024-04-13T10:31:54.486Z&include=countries,renditions,devices,trend" ``` #### Sample Response The response includes: Detailed information for an account including `viewers`, `countries`, `renditions`, `devices`, and `trend` data. ```json { "live_stream": { "id": "tvctq36g", "viewers": 7, "countries": [ { "code": "US", "viewers": 4 }, { "code": "DE", "viewers": 3 } ], "renditions": [ { "name": 720, "viewers": 7 } ], "devices": [ { "name": "Desktop", "viewers": 7 } ], "trend": [ { "sampled_at": "2024-03-15T12:59:00.000Z", "viewers": 7 }, { "sampled_at": "2024-03-16T13:00:00.000Z", "viewers": 7 } ] }, "limits": { "from": "2024-03-14T10:31:54.000Z", "to": "2024-04-13T10:31:54.000Z" } } ``` ## Related API requests - [GET /analytics/viewers/account/{id}](https://developer.wowza.com/docs/wowza-video/api/video/current/tag/analytics_viewers/#tag/analytics_viewers/operation/analyticsAccountViewers) — Fetch viewer analytics for all the streams in an account. - [GET /analytics/viewers/vod_streams/{id}](https://developer.wowza.com/docs/wowza-video/api/video/current/tag/analytics_viewers/#tag/analytics_viewers/operation/analyticsVodStreamViewers) – Fetch viewer analytics for a specific VOD stream. - [GET /analytics/viewers/stream_targets/{id}](https://developer.wowza.com/docs/wowza-video/api/video/current/tag/analytics_viewers/#tag/analytics_viewers/operation/analyticsStreamTargetViewers) – Fetch viewer analytics for a specific stream target. - [GET /analytics/viewers/live_streams](https://developer.wowza.com/docs/wowza-video/api/video/current/tag/analytics_viewers/#tag/analytics_viewers/operation/analyticsLiveStreamsViewers) - Fetch viewer data for the top 100 live streams in an account. - [GET /analytics/viewers/vod_streams](https://developer.wowza.com/docs/wowza-video/api/video/current/tag/analytics_viewers/#tag/analytics_viewers/operation/analyticsVodStreamsViewers) - Fetch viewer data for the top 100 VOD streams in an account.