ReferenceExtensions
google-analytics
Options for the Google Analytics 4 extension that tracks video engagement and playback events
Adds the Google Analytics 4 (GA4) extension to the player. It renders nothing — place it anywhere inside the player, and it follows whatever media the player attaches, dispatching standard GA4 Enhanced Measurement video events and playback interaction events to window.dataLayer. See Google Analytics for how telemetry works.
Import
Or load it from the CDN:
Anatomy
Options
metadata and onEvent take non-primitive values, so they’re properties only, with no matching attribute. Set them on the element, typed as the GoogleAnalyticsExtension class that @videojs/html/extensions/google-analytics exports.
Collection limits
Google Analytics 4 enforces collection limits on event parameters:
- 25 parameters per event: The extension sends 8 standard parameters (
video_current_time,video_duration,video_percent,video_provider,video_stream_type,video_title,video_url, andvisible), leaving room for up to 17 custom dimensions inmetadata. - Parameter names: Up to 40 characters in length.
- String values: Up to 100 characters in length.