1jQuery(document).ready(function ($) { 2 // Track 404 page errors. 3 if ( 4 "on" === miscellaneous_tracking_options.track_404_page.should_track && 5 miscellaneous_tracking_options.track_404_page.is_404 6 ) { 7 if ("gtag" === miscellaneous_tracking_options.tracking_mode) { 8 if ("ga4" === miscellaneous_tracking_options.ga_mode) { 9 if (typeof gtag !== "undefined") { 10 gtag("event", "404_error", { 11 wpa_category: "404 Error", 12 wpa_label: 13 miscellaneous_tracking_options.track_404_page.current_url, 14 }); 15 } 16 } else { 17 if (typeof gtag !== "undefined") { 18 gtag("event", "Page Not Found", { 19 event_category: "404 Error", 20 event_label: 21 miscellaneous_tracking_options.track_404_page.current_url, 22 }); 23 } 24 } 25 } else { 26 if (typeof ga !== "undefined") { 27 ga( 28 "send", 29 "event", 30 "404 Error", 31 "Page Not Found", 32 miscellaneous_tracking_options.track_404_page.current_url 33 ); 34 } 35 } 36 } 37 38 // track javascript errors. 39 if ("on" === miscellaneous_tracking_options.track_js_error) { 40 function trackJavaScriptError(e) { 41 const errMsg = e.message; 42 const errSrc = e.filename + ": " + e.lineno; 43 gtag("event", "js_error", { 44 wpa_category: "JavaScript Error", 45 wpa_action: errMsg, 46 wpa_label: errSrc, 47 non_interaction: true, 48 }); 49 } 50 if (typeof gtag !== "undefined") { 51 window.addEventListener("error", trackJavaScriptError, false); 52 } 53 } 54 55 // Track ajax errors. 56 if ("on" === miscellaneous_tracking_options.track_ajax_error) { 57 if (typeof gtag !== "undefined") { 58 jQuery(document).ajaxError(function (e, request, settings) { 59 gtag("event", "ajax_error", { 60 wpa_category: "Ajax Error", 61 wpa_action: request.statusText, 62 wpa_label: settings.url, 63 non_interaction: true, 64 }); 65 }); 66 } 67 } 68});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.