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 if ("gtag" === miscellaneous_tracking_options.tracking_mode) { 41 if ("ga4" === miscellaneous_tracking_options.ga_mode) { 42 function trackJavaScriptError(e) { 43 const errMsg = e.message; 44 const errSrc = e.filename + ": " + e.lineno; 45 gtag("event", "js_error", { 46 wpa_category: "JavaScript Error", 47 wpa_action: errMsg, 48 wpa_label: errSrc, 49 non_interaction: true, 50 }); 51 } 52 if (typeof gtag !== "undefined") { 53 window.addEventListener("error", trackJavaScriptError, false); 54 } 55 } else { 56 function trackJavaScriptError(e) { 57 const errMsg = e.message; 58 const errSrc = e.filename + ": " + e.lineno; 59 gtag("event", errMsg, { 60 event_category: "JavaScript Error", 61 event_label: errSrc, 62 non_interaction: true, 63 }); 64 } 65 if (typeof gtag !== "undefined") { 66 window.addEventListener("error", trackJavaScriptError, false); 67 } 68 } 69 } else { 70 function trackJavaScriptError(e) { 71 const errMsg = e.message; 72 const errSrc = e.filename + ": " + e.lineno; 73 ga("send", "event", "JavaScript Error", errMsg, errSrc, { 74 nonInteraction: 1, 75 }); 76 } 77 if (typeof ga !== "undefined") { 78 window.addEventListener("error", trackJavaScriptError, false); 79 } 80 } 81 } 82 83 // Track ajax errors. 84 if ("on" === miscellaneous_tracking_options.track_ajax_error) { 85 if ("gtag" === miscellaneous_tracking_options.tracking_mode) { 86 if ("ga4" === miscellaneous_tracking_options.ga_mode) { 87 if (typeof gtag !== "undefined") { 88 jQuery(document).ajaxError(function (e, request, settings) { 89 gtag("event", "ajax_error", { 90 wpa_category: "Ajax Error", 91 wpa_action: request.statusText, 92 wpa_label: settings.url, 93 non_interaction: true, 94 }); 95 }); 96 } 97 } else { 98 if (typeof gtag !== "undefined") { 99 jQuery(document).ajaxError(function (e, request, settings) { 100 gtag("event", "ajax_error", { 101 event_category: "Ajax Error", 102 event_action: request.statusText, 103 event_label: settings.url, 104 non_interaction: true, 105 }); 106 }); 107 } 108 } 109 } else { 110 if (typeof ga !== "undefined") { 111 jQuery(document).ajaxError(function (e, request, settings) { 112 ga("send", "event", "Ajax Error", request.statusText, settings.url, { 113 nonInteraction: 1, 114 }); 115 }); 116 } 117 } 118 } 119});
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.