VideoPress video tracking in Google Tag Manager
New in 2.0.0. Google Tag Manager for WordPress reports how your visitors watch the VideoPress videos embedded on your site. VideoPress is the video hosting built into Jetpack and WordPress.com, so this covers videos you uploaded through either one.
This page describes GTM4WP 2.0.0 and newer. VideoPress tracking did not exist in the legacy 1.x versions of the plugin.
The option is experimental and carries an Experimental badge in the plugin settings.
Turning VideoPress tracking on
Open the plugin settings, go to the Media events section, expand the Media players group and check VideoPress video events. The option is switched off by default.
How the plugin listens
VideoPress works differently from the other players. It has no JavaScript library to talk to. The player sits inside an iframe and reports what it is doing by sending messages to the page around it, so the plugin listens for those messages instead of controlling a player object.
One listener covers every VideoPress video on the page. The plugin only starts listening once it finds an iframe pointing at videopress.com or video.wordpress.com, so a page with no VideoPress video pays nothing at all.
No player API is fetched for this player, so there is no extra 3rd party request and nothing for a consent manager or an ad blocker to stop. The video itself still comes from Automattic’s servers, as it always did.
A video inserted after the page loads, for example in a popup or a section loaded by AJAX, needs the Track dynamically inserted players option in the Advanced group so that the plugin notices it and starts listening.
Only genuine VideoPress messages are accepted
Any page on the web can send a message to your page, so a listener that trusted every message it received would let anything push events into your data layer and pollute your reports.
The plugin checks two things before it acts on a message. The sender has to be videopress.com, a subdomain of it, or video.wordpress.com. The message also has to name an event that starts with videopress_. Anything else is ignored without a sound.
Playback states
The gtm4wp.mediaPlayerStateChange event fires with these values in the mediaPlayerState variable:
| mediaPlayerState | Fires when |
|---|---|
play | Playback starts. |
pause | The visitor pauses the video. |
ended | The video reaches its end. |
seeked | The visitor jumps to another position. |
The VideoPress player announces some of these twice, once when an action begins and again when it completes. The plugin pushes a state only when it differs from the last one it reported for that video, so a single tap on play produces one play rather than two.
There is no buffering state for this player.
Player events
VideoPress is the only player whose list of events is open ended. The plugin handles the messages it knows about as states and progress, and forwards every other videopress_ message it receives as a gtm4wp.mediaPlayerEvent, using whatever the player called it with the prefix removed.
The practical effect is that this page cannot give you a closed list of event names, because the list belongs to the VideoPress player rather than to the plugin, and it can grow when Automattic updates it. If you plan to build a tag on a specific event here, watch your data layer in Google Tag Manager preview mode first and use the names you actually see. None of these forwarded events carry a mediaPlayerEventParam.
What mediaData holds for a VideoPress video
| Variable | Contents |
|---|---|
mediaData.id | The VideoPress GUID of the video. |
mediaData.author | Always empty. The player reports no uploader. |
mediaData.title | The GUID again, the same value as the ID. The player reports no title. |
mediaData.url | The public VideoPress address, built from the GUID. |
mediaData.duration | The length in seconds. The player reports milliseconds and the plugin converts them. |
The mediaType variable is videopress in every event.
The GUID is not readable, so map it to a name if you want reports that make sense. You uploaded these videos, so you can build that mapping from your own media library.
Google Tag Manager built-in Video variables
Every VideoPress media event also populates the built-in Video variables of Google Tag Manager, with Video Provider set to videopress. The section on built-in Video variables explains how to enable and use them. Video Title holds the GUID.
Video Visible takes a little more work for this player. Because the plugin never wires an element here and only listens for messages, it has to work out which embed each message came from. It matches the message to the frame that sent it, and falls back to finding the embed whose address carries the same GUID. That keeps the measurement correct even with two embeds of the same video on one page.
Building a trigger in Google Tag Manager
To fire a tag when a visitor starts a VideoPress video:
- Create a Data Layer Variable named
mediaPlayerState. - Create a Custom Event trigger whose event name is
gtm4wp.mediaPlayerStateChange. - Add the condition
mediaPlayerStateequalsplayto the trigger. - Attach the trigger to your tag. To identify the video, create a second Data Layer Variable named
mediaData.id.
Limitations
mediaData.titleis the VideoPress GUID rather than a readable title, andmediaData.authoris always empty.- The set of player event names is not fixed. It follows whatever the VideoPress player sends, so check your data layer before you build a trigger on one.
- Forwarded player events carry no parameter.
- There is no
bufferingstate. - There is no 100 percent milestone. Measure a full watch with the
endedstate, as described under playback percentage milestones.
Related pages
The overview of media player tracking describes the events, data layer variables and playback milestones that every player shares. See also Cloudflare Stream and HTML5 video and audio, the other two ways to measure video you host yourself.

