What is changing?
The “per-video” analytics API is being deprecated. If you still use this API, you will need to switch to using the GraphQL Analytics API by Feb 1, 2023. After this date, the per-video analytics API will be no longer available.
Why is this API being deprecated?
Cloudflare Stream’s GraphQL Analytics API provides the same functionality and more, with additional filters and metrics, as well as the ability to fetch data about multiple videos in a single request. Queries are faster, more reliable, and built on a shared analytics system that you can use across many Cloudflare products (docs).
Most developers using Stream already use this GraphQL Analytics API. If you’ve made a request to this API recently, we will reach out to you directly via email as well to follow up and make sure you have what you need to migrate.
How do I migrate to the GraphQL Analytics API?
The example GraphQL query below mirrors how the old per-video analytics API works, querying for the number of minutes viewed and the number of views for a specific video UID, based on client-side analytics. Read more about how to make your first query in the Stream GraphQL API docs.
query {
viewer {
accounts(filter:{
accountTag:"<ACCOUNT_ID>"
}) {
videoPlaybackEventsAdaptiveGroups(
filter: {
date_geq: "2020-10-01"
date_lt: "2020-11-01"
uid:"<VIDEO_UID>"
}
orderBy:[uid_ASC]
limit: 1
) {
count
sum {
timeViewedMinutes
}
dimensions{
uid
}
}
}
}
}
Questions?
We want to make this migration as easy as possible for you — comment on this forum topic with any questions, or hop into the #stream channel in the Cloudflare Discord. (invite link)