Analytics API
Views, watch time, retention and how it played, for a project, a video or a live broadcast.
import { Crumbcast } from "crumbcast"; const crumbcast = new Crumbcast({ token: process.env.CRUMBCAST_TOKEN, baseUrl: "https://your-crumbcast",}); const stats = await crumbcast.analytics.getVideoAnalytics({ id: videoId, days: 90,}); console.log(stats.views, "views", stats.watch_seconds, "s"); // 100 numbers: the share still watching at each 1%const half = stats.retention.findIndex((share) => share < 0.5);import os from crumbcast import Crumbcast crumbcast = Crumbcast( token=os.environ["CRUMBCAST_TOKEN"], base_url="https://your-crumbcast",) stats = crumbcast.analytics.get_video_analytics(video_id, days=90) print(stats["views"], "views", stats["watch_seconds"], "s") # 100 numbers: the share still watching at each 1%half = next((i for i, share in enumerate(stats["retention"]) if share < 0.5), None)use Crumbcast\Crumbcast; $crumbcast = new Crumbcast( token: getenv('CRUMBCAST_TOKEN'), baseUrl: 'https://your-crumbcast',); $stats = $crumbcast->analytics->getVideoAnalytics($videoId, days: 90); echo $stats['views'], ' views, ', $stats['watch_seconds'], ' s'; // 100 numbers: the share still watching at each 1%$half = array_search(true, array_map(fn ($share) => $share < 0.5, $stats['retention']), true);const api = "https://your-crumbcast/api/v1";const headers = { Authorization: `Bearer ${process.env.CRUMBCAST_TOKEN}` }; const stats = await fetch(`${api}/videos/${videoId}/analytics/?days=90`, { headers }) .then((response) => response.json()); console.log(`${stats.views} views, ${stats.watch_seconds} seconds watched`); // 100 numbers: the share of viewings still watching at each 1%const half = stats.retention.findIndex((share) => share < 0.5);if (half >= 0) { console.log(`Half the viewers are gone by ${half}% of the video`);}What you get
- Views and watch timeBy day, for periods up to a year, and the sites embedding it most.
- RetentionThe share of viewings still watching at each 1% of a video.
- Audience and qualityCountries, devices and browsers, startup time, rebuffering and renditions.
- Live broadcastsThe most watching each minute, and the viewers on YouTube and Twitch.