Name movies and shows
Call this once per page, as soon as you know the title:
webstats('content', { type: 'movie', ids: { tmdb: '278' }, title: 'The Shawshank Redemption',});| Key | Required | What it does |
|---|---|---|
type | yes | What kind of thing it is. See content types. |
ids | yes | One or more provider ids. At least one entry, or the call is dropped. |
title | see below | The name shown in reports. |
episode | optional | { ids, season, number, title } for a show episode. |
A tmdb or imdb id resolves on its own. Every other provider resolves on the title
string instead, so if you send mal, isbn, igdb or similar, an accurate title is what
makes it work. Sending both is always safe.
Without this call, reports group by URL: /watch/8f21c tells you nothing, and one film under
two URLs counts twice. It also decides what you earn. See Get paid.
Only watch and detail pages need it. Your home page and listings do not.
A show episode
Section titled “A show episode”webstats('content', { type: 'tvshow', ids: { tmdb: '1399' }, title: 'Game of Thrones', episode: { season: 1, number: 1, title: 'Winter Is Coming' },});The episode number key is number, and season and number must be numbers, not strings.
season: '1' or episode: 1 drops the whole declaration, not just the episode part, so the
page ends up with no title at all.
Episode detail enriches your reports. Identification and earnings work off the parent title, so a show earns the same whether or not you break out the episode.
Other types
Section titled “Other types”Same call, a different type and a provider that suits it:
webstats('content', { type: 'anime', ids: { mal: '16498' }, title: 'Attack on Titan' });webstats('content', { type: 'book', ids: { isbn: '9780451524935' }, title: 'Nineteen Eighty-Four' });All 12 types and the ids each accepts are in Content types and ids.
When to call it
Section titled “When to call it”| Your site | Call it |
|---|---|
| Server-rendered page | In a type="module" <script>, after your snippet |
| Single-page app | When the route’s data arrives, before the player starts |
| Loaded from an API | In the API response handler. See Streaming apps |
| Inside an iframe | Inside the frame, never on the parent. See Iframes |
Content and video together
Section titled “Content and video together”They answer different questions, and most catalog sites send both:
webstats('content', { type: 'movie', ids: { tmdb: '278' }, title: 'The Shawshank Redemption' });webstats('video', '#player', { id: 'tmdb-278', title: 'The Shawshank Redemption', tmdb: '278' });content labels the page, so traffic reports group by title. video labels the player, so
plays and watch time group by title. See Track video.
Verify
Section titled “Verify”Load a watch page, then open Content in your dashboard. The title appears within seconds.
If it does not, check the two things that silently drop a call: an empty ids object, and a
type that is not in the supported list.