Monitor the Shaka player
The FastPix Data SDK with Shaka player enables tracking of player analytics, including key video performance metrics such as user interactions, playback quality, and performance.
Key features:
- Track viewer engagement: Gain insights into how users interact with your videos.
- Monitor playback quality: Ensure video streaming by monitoring real-time metrics, including bitrate, buffering, startup performance, render quality, and playback failure errors.
- Error management: Identify and resolve playback failures quickly with detailed error reports.
- Customizable analytics: configure tracking attributes to meet your business requirements, providing flexibility and scalability.
- Centralized dashboard: Visualize and compare metrics on the FastPix dashboard to make data-driven decisions.
Installation and setup
Import the SDK
Basic integration
Enhance tracking with metadata
Advanced configurations
Emit custom events
Step 1
Installation and setup
Step 2
Import the SDK
Step 3
Basic integration
Step 4
Enhance tracking with metadata
Step 5
Advanced configurations
Step 6
Emit custom events
Prerequisites
To track and analyze video performance, initialize the FastPix Data SDK with your Workspace key.
-
Log into your FastPix Dashboard and go to the Workspaces section.
-
Once you’ve identified the correct workspace, copy the Workspace Key associated with it. This key is essential for client-side monitoring and should be included in the JavaScript code on every webpage where you want to track video performance and analytics.
Understand what is a Workspace.

Step 1: Installation and setup
This package can be installed using npm, a CDN, or your preferred package manager:
Using npm:
Using CDN:
PLEASE NOTE
Ensure that a package based on Shaka Player is installed or accessible via a CDN.
Step 2: Import the SDK
Step 3: Basic integration
Ensure that the workspace_id is provided, as it is a mandatory field for FastPix integration, uniquely identifying your workspace. Install and import Shaka Player into your project, and create an HTML5 <video> element to bind it to.
Once the video element is set up, initialize the Shaka Player instance and associate it with the video element. Use the loadShakaPlayer function to pass the Shaka Player instance, player metadata, and the shaka instance, enabling FastPix to track playback data.
Once the video URL is loaded and playback has started, the SDK will begin tracking the analytics.
PLEASE NOTE
To end FastPix data tracking, always call
player.fp.destroy()when callingplayer.destroy()(Shaka Player instance). This ensures proper cleanup of both Shaka Player and FastPix data tracking.
After successfully completing Step 3, you can track viewer metrics in the FastPix dashboard once playback ends. Steps 4, 5, and 6 are optional and can be utilized as needed to enhance your integration.
Step 4: Enhance tracking with user passable metadata
Check out the user-passable metadata documentation to see the metadata supported by FastPix. You can use custom metadata fields like custom_1 to custom_10 for your business logic, giving you the flexibility to pass any required values. Named attributes, such as video_title and video_id, can be passed directly as they are.
DEVELOPMENT TIP
Keep metadata consistent across different video loads to make comparison easier in your analytics dashboard.
Step 5: Advanced configurations with FastPix Data SDK
Enhancing your Shaka Player with advanced options can significantly improve user experience and data tracking. Below are key configurations you can implement when using the FastPix SDK with your Shaka Player instance.
Example:
Step 6: Emit custom events
Advanced error reporting and contextual tracking
By default, FastPix tracks errors that occur during playback failures. However, you can also emit a custom error event for non-severe issues that arise outside of these failures, allowing you to provide additional context for tracking purposes.
TIP
Use custom error codes and messages that are meaningful for your debugging process to streamline troubleshooting.
Changing video streams in player
Effective video view tracking is crucial to track multiple videos back-to-back in the same player in your application. You can reset tracking when loading a new source, such as in video series or episodic content or in cases where the user wants to play any other video.
Emitting avideoChange event:
To inform the FastPix SDK of a new view, emit a videoChange event immediately after loading the new video source. Include relevant metadata about the new video:
PLEASE NOTE
Always ensure that this event is dispatched right after the new source is loaded to maintain accurate tracking.
Example to configure Shaka Player with FastPix Data SDK
Here are platform-specific examples to help you integrate the FastPix Data SDK with your Shaka Player. Use the following React or JavaScript or HTML code into your application:
Changelog
All notable changes to the Shaka Player Video Data SDK is documented below.
Current version
v1.0.6
Security
- Hardened the test harness against SonarQube findings with code sanitization and safer input handling, ensuring user-provided manifest URLs are trimmed and validated before playback.
- Added Subresource Integrity (SRI) hash and
crossoriginattribute to the Shaka Player CDN script to prevent tampered third-party code from executing.
Changed
- Replaced
windowreferences withglobalThisfor safer, environment-agnostic global access. - Refactored player lifecycle handling with dedicated load/destroy controls and proper teardown to avoid resource leaks.
- Added Azure Pipelines configuration (
azure-pipelines.yaml) and SonarQube project settings (sonar-project.properties) for automated code quality and static analysis.
Previous versions
v1.0.5
- Updated
@fastpix/video-data-coreto the latest version (1.0.7).
v1.0.4
- Updated npm authentication from Classic token to Granular token for improved security and fine-grained permissions.
v1.0.3
- Updated
package.jsonto include additional keywords related to Shaka Player and video analytics.
v1.0.2
- Upgraded the Video Data Core SDK to the latest version.
- Updated readme.md with a redirection link for supported dimension parameters.
v1.0.1
Updated Video Data Core SDK with minor fixes and improvements.
v1.0.0
Added:
- Enabled video performance tracking using the FastPix Data SDK for Shaka Player, providing detailed insights into user engagement, playback quality, and real-time streaming diagnostics.
- Included error management and reporting capabilities for tracking playback issues specific to Shaka Player.
- Supports customizable behavior, such as disabling cookies, respecting
Do Not Tracksettings, and configuring advanced error handling for Shaka Player-specific events. - Added custom metadata support to allow users to pass optional fields (
video_id,video_title,video_duration, etc.) for enhanced tracking and reporting. - Introduced event tracking for
videoChangeto handle seamless metadata updates during playback transitions within Shaka Player.