Skip to content

Iframes

The pixel measures the page it runs in, so if your player sits in an iframe the pixel goes inside the frame. On the parent page it records the visit and no plays.

Add your snippet to the iframe document, just before its closing </body>.

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>

Use the same tag key as the parent site so both land in one set of reports. Video tracking then works as it does anywhere else.

Both documents are measured, so one view of the parent page records two pageviews: one for the parent, one for the frame. If the frame is on a different origin it also counts as a separate visitor, because a browser gives a cross-origin frame its own storage. Expect parent and frame to read as two rows rather than one journey.

Browsers block cross-origin frame access, so the pixel cannot read the parent page’s URL or title. Name the video from inside the frame:

<script defer src="https://10.vidstats.top/js/p.js?s=YOUR_TAG_KEY"></script>
<script type="module">
webstats('video', 'video', { id: 'tmdb-278', title: 'The Shawshank Redemption', tmdb: '278' });
webstats('content', { type: 'movie', ids: { tmdb: '278' }, title: 'The Shawshank Redemption' });
</script>

The name travels with the data, so your reports read by title even though the frame’s own URL is an embed URL.

If the parent knows which title is playing, pass it with postMessage. Only do this when you control both sides.

// parent page, after the iframe loads
document.getElementById('player-iframe').contentWindow.postMessage(
{ type: 'vidstats-content', title: 'The Shawshank Redemption', tmdb: '278' },
'https://player.example.com', // the iframe's origin, never '*'
);
// inside the iframe
window.addEventListener('message', (e) => {
if (e.origin !== 'https://www.example.com') return; // your parent's origin
if (e.data?.type !== 'vidstats-content') return;
webstats('content', { type: 'movie', ids: { tmdb: e.data.tmdb }, title: e.data.title });
webstats('video', 'video', { id: `tmdb-${e.data.tmdb}`, title: e.data.title, tmdb: e.data.tmdb });
});

Check e.origin on the receiving side, or any page can post a message into your frame and write whatever title it likes into your reports.

You cannot install the pixel inside a YouTube, Vimeo, or hosted-player iframe, so there are no player signals: no watch time, no completion, no retention.

You still get plays. Give the pixel a dwell site type such as Streaming indexer or Anime, and a visitor who stays 5 minutes on the page counts as one play, once per page per day. That is what dwell mode is for, and those plays earn like any other once the page declares its title. See Metrics.

You can also record that the embed was on the page:

webstats('event', 'embed-view', { provider: 'vimeo', id: '123456789' });

That tells you the embed was shown, not whether anyone watched it.

Load the parent page, play a few seconds, then open the Video screen. If you see the visit but no plays, the pixel is on the parent page rather than inside the frame.