Any website
Paste your snippet just before the closing </body> tag, on every page you want to measure.
Copy your snippet from Pixels. It carries your install tag key and tracking domain.
<script defer src="https://10.vidstats.top/js/p.js?s=YOUR_TAG_KEY"></script><!-- Video pages only. Delete this block on pages with no video. --><script type="module"> window.webstats('content', { type: 'movie', ids: { tmdb: '278' }, title: 'The Shawshank Redemption', });</script>Three rules
Section titled “Three rules”- Keep
defer. Without it the script is fetched synchronously and slows your render. The video module loads only on pages that have a video. - Keep the order. On video pages the
contentcall comes after the pixel and staystype="module". - One snippet per page, not per element. The pixel finds videos, links, and route changes on its own.
What you get without writing code
Section titled “What you get without writing code”| It finds | And records |
|---|---|
| Any page load or route change | A pageview, with referrer, country, device, browser, and screen size |
Any <video> element | Plays, pauses, watch time, 25/50/75/100% milestones, buffering, quality, errors |
| A click on a link to another site | An outbound event with the destination |
| A click on a file link | A download event with the filename |
The exact fields are in Data collected.
You write code only to add what the pixel cannot guess: which movie a page is about (Name movies and shows), and anything specific to your site (Send events).
If your pages share a layout
Section titled “If your pages share a layout”Most static site generators wrap every page in one file. Put the snippet there once, before
its </body>.
| Tool | File |
|---|---|
| Astro | src/layouts/*.astro |
| Eleventy | _includes/layout.njk |
| Hugo | layouts/partials/footer.html |
| Jekyll | _includes/footer.html |
| Plain PHP | footer.php |
Verify
Section titled “Verify”- Load a page on your site.
- View the page source and search for
p.js. If the tag is missing, you edited a file that page does not use. - Open your dashboard. Your own visit shows up within seconds.
Nothing is host-gated, so localhost works for testing.
Tag present but no data? See Troubleshooting.
Using a framework?
Section titled “Using a framework?” WordPress Theme file, functions.php, or a header plugin. No vidstats plugin needed.
Next.js App Router and Pages Router, with the right Script strategy.
React, Vue, and SPAs Route changes are automatic. Here is the fallback if yours is not.
Iframes The pixel measures the page it runs in, so it goes inside the frame.
Streaming apps When the player mounts after an API call, you say when.