Advanced video tracking
Parse.ly automatically detects and tracks supported video players when the page loads. The following configurations give you more control over this behavior for advanced use cases like Single Page Applications, iframe-embedded players, or sites with multiple video platforms. These configurations assume you’ve completed video tracking setup.
Detect dynamically loaded video players
By default, the Parse.ly tracker will automatically discover any supported video players that are present on the page at the time it loads. If your site is a Single Page Application (SPA), or lazily initializes videos in response to scroll, you can still automatically track those players. You just need to call PARSELY.video.detectVideos() to re-run automatic player detection any time you add a new player instance to the page. This is not necessary for new video assets dynamically loaded into an existing player instance, as they will be tracked automatically.
Specify which players to track
Note
Because automatic detection happens as soon as the Parse.ly tracker is loaded, this (and other configuration options) must be set before loading the tracker.
By default, the Parse.ly tracker will automatically detect and track any instance of the supported video players. However, in some cases you may wish to limit automatic tracking to a specific video player or subset of video players. To do this, simply specify an array of strategies that should be tracked like this:
<script>
window.PARSELY = window.PARSELY || {
// ... other Parsely configuration options
video: {
// ... other Parsely video configuration options
allowedStrategies: [
// edit array to only include desired video players
"brightcove",
"jwplayer",
"kaltura",
"mediaelementjs",
"theplatform",
"videojs",
"vimeo",
"wistia",
"youtube"
]
}
// ... other Parsely configuration options
};
</script>If defined, the PARSELY.video.allowedStrategies array will limit automatic detection and tracking to only the specified strategies, which each correspond to a specific video player. Elements in the array should be a string identifying the predefined Parse.ly strategy names.
Parse.ly strategy names
brightcove, jwplayer, kaltura, mediaelementjs, theplatform, videojs, vimeo, wistia, youtube
Disable automatic video discovery
In some cases, you may want more granular control over the discovery of tracked videos than the automatic tracking interface provides. In these cases, you can set PARSELY.video.autotrack = false to disable the automatic discovery of video embeds. For example:
<script>
window.PARSELY = window.PARSELY || {
video: {
autotrack: false
}
// other configuration options
};
</script>
<!-- START Parse.ly Include -->
<!-- ...insert the parse.ly tracker code here... -->
<!-- END Parse.ly Include -->
When automatic discovery is disabled, you can use the v1 video tracking interface to track your videos.
Tracking videos that play in iFrames
Some sites load video players in iframes, either on the page or in a popup modal windows. To track such videos, the iframed page must also include a version of the Parse.ly tracker, with some additional customization. For example purposes, let’s consider a post page at https://example-site.com/postid that contains an iframe, which loads https://example-site.com/videoid, a page that only contains a video player.
The videoid “child” page needs the tracker to be able to capture video events. But we don’t want to track page views for it, because its only purpose is to contain the video, and we’re already tracking views for the page on which it’s embedded.
To track videos in iframes, configure the iframed page with:
- Include the basic tracking code to capture video events
- Disable on-load page view tracking to prevent duplicate
pageviewevents - Pass
document.referreras theurlOverrideparameter to associate video events with the parent page URL
Put all three together, and this is what the tracking code for https://example-site.com/videoid should look like:
<script>
window.PARSELY = window.PARSELY || {
autotrack: false,
config: {
heartbeat_should_honor_autotrack: true
},
video: {
onPlay: function(playerApi, videoId, metadata) {
PARSELY.video.trackPlay(videoId, metadata, document.referrer);
}
}
};
</script>
<!-- START Parse.ly Include -->
<!-- ...insert the parse.ly tracker code here... -->
<!-- END Parse.ly Include -->
Last updated: January 09, 2026