diff --git a/includes/tracks/class-wc-site-tracking.php b/includes/tracks/class-wc-site-tracking.php index f923b88ce13..1890045fd9c 100644 --- a/includes/tracks/class-wc-site-tracking.php +++ b/includes/tracks/class-wc-site-tracking.php @@ -115,7 +115,14 @@ class WC_Site_Tracking { // Callback after scripts have loaded. script.onload = function() { if ( 'function' === typeof callback ) { - callback(); + callback( true ); + } + } + + // Callback triggered if the script fails to load. + script.onerror = function() { + if ( 'function' === typeof callback ) { + callback( false ); } } }