WP Manifestindependent plugin directory
manifest / analytics / cme-ga4html5vid

cme Google Analytics for HTML5 Video Tracking

WordPress plugin for tracking HTML5 video events in Google Analytics.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/spcktr/cme-ga4html5vid/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A WordPress Plugin for HTML5 Video Tracking using Google Analytics

Supports logged-in user ID tracking.

Play around with the live demo.


Install

  1. Download the latest release (zip file) from GitHub.
  2. Log in to your WordPress site as an admin.
  3. Navigate to Plugins > Add New.
  4. Click Upload Plugin.
  5. Select the zip file downloaded in step 1.
  6. Click Install Now.
  7. Click Activate.

Next: Write your filter hook for your user ID custom dimension index.

PHP Filter Hook

Add a call to the cme_user_id_custom_dimension_index filter hook to your child theme’s functions.php file. Change the custom dimension index to match the user ID custom dimension index in your Google Analytics property.

add_filter( 'cme_user_id_custom_dimension_index', function($custom_dimension_index) {
    return '5'; // Change this to match your CD index number that's set in GA.
} );

Screen Captures

Google Analytics Realtime HTML5 Video Events Report

Google Analytics Realtime HTML5 Video Events Report

Google Analytics Custom Report Showing HTML5 Video Events by User ID

Google Analytics Custom Report Showing HTML5 Video Events by User ID


Credits

This solution is based on Julius Fedorovicius’ article, HTML5 Video Tracking Recipe for Google Tag Manager posted on Analytics Mania.