(function (window, document, $) { 'use strict'; function setupLiveStreamTracking() { // Make sure jQuery and jPlayer are available if (typeof $ === 'undefined' || !$.jPlayer || typeof $.jPlayer.event === 'undefined') { return; } // Make sure GA4 gtag is available if (typeof window.gtag !== 'function') { return; } var $player = $('#jquery_jplayer_1'); if (!$player.length) { return; // jPlayer instance not on this page } // Prevent double-binding if Turbo or other scripts re-run this if ($player.data('wplnLiveTrackingBound')) { return; } $player.data('wplnLiveTrackingBound', true); // Track when jPlayer actually starts playing $player.on($.jPlayer.event.play, function () { window.gtag('event', 'live_stream_play', { event_category: 'Audio', event_label: 'WPLN Live Stream', player_id: 'jquery_jplayer_1' }); }); // Optional: track pauses too $player.on($.jPlayer.event.pause, function () { window.gtag('event', 'live_stream_pause', { event_category: 'Audio', event_label: 'WPLN Live Stream', player_id: 'jquery_jplayer_1' }); }); } // Handle normal page loads and Turbo (Hotwire) navigation if (window.Turbo) { document.addEventListener('turbo:load', setupLiveStreamTracking); } else { // Standard DOM ready $(setupLiveStreamTracking); } })(window, document, jQuery); 6 major Tennessee news events that WPLN helped us understand this year | WPLN News

6 major Tennessee news events that WPLN helped us understand this year