Skip to content

WordPress plugin for tracking HTML5 video events in Google Analytics.

License

Notifications You must be signed in to change notification settings

marklchaves/cme-ga4html5vid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cme-ga4html5vid

A WordPress Plugin for HTML5 Video Tracking using Google Analytics (UA)

This plugin supports logged-in user ID tracking for Universal Analytics properties (not GA4).

Play around with the live demo.

A GA4 version may be in the works.


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.

About

WordPress plugin for tracking HTML5 video events in Google Analytics.

Resources

License

Stars

Watchers

Forks

Packages

No packages published