Tutorial Builds a Video View Counter That Filters Autoplay, Refreshes and Bots
A developer guide on DEV Community explains why counting play events inflates video views, since muted autoplay, page refreshes and bots all register. It proposes counting a view only when a player is at least half on screen, actually playing, in a visible tab, for two continuous seconds, a threshold based on the MRC video viewability guideline. The approach pairs a browser script that uses IntersectionObserver and playback events with a Node server that deduplicates viewers per video and filters bots using the isbot library. The author reports that in a scripted test the naive counter recorded five views while the new method recorded one. The article also notes that major platforms define views inconsistently, so developers should choose and document their own definition.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in