https://eldebate.com.ar/wp-content/plugins/wp-search-insights/assets/js/search-navigation.js?ver=2.1
1jQuery(document).ready(function ($) { 2 "use strict"; 3 4 const MAX_SEARCH_AGE = 5 * 60 * 1000; // 5 minutes in milliseconds 5 6 // Check if we're on a search results page 7 if (window.location.href.includes('?s=')) { 8 return; // Don't track landing pages on search pages 9 } 10 11 // Get search ID directly 12 let search_id = null; 13 try { 14 const search_id_match = document.cookie.match(/wpsi_search_id=([^;]+)/); 15 if (search_id_match) { 16 search_id = decodeURIComponent(search_id_match[1]); 17 } 18 } catch (e) { 19 // Silently fail 20 } 21 22 // Try to get search term and timestamp data 23 let searchData = null; 24 try { 25 const cookieMatch = document.cookie.match(/wpsi_last_search=([^;]+)/); 26 27 if (cookieMatch) { 28 searchData = JSON.parse(decodeURIComponent(cookieMatch[1])); 29 } else { 30 // Silently fail 31 } 32 } catch (e) { 33 // Silently fail 34 } 35 36 if (!searchData) { 37 return; 38 } 39 40 // If we have a search_id from the cookie, use it (priority) 41 if (search_id && (!searchData.search_id || searchData.search_id !== search_id)) { 42 searchData.search_id = search_id; 43 } 44 45 const currentTime = new Date().getTime(); 46 47 // Check if the search session is still valid AND from the same browser session 48 if (currentTime - searchData.timestamp > MAX_SEARCH_AGE) { 49 // Clear cookies 50 document.cookie = "wpsi_last_search=; path=/; max-age=0"; 51 document.cookie = "wpsi_search_id=; path=/; max-age=0"; 52 return; 53 } 54 55 const currentUrl = window.location.href; 56 const currentDomain = window.location.hostname; 57 58 // Check if this is a conversion (clicked search result) 59 const isConversion = searchData.results && searchData.results.includes(currentUrl); 60 // Check if this is internal navigation (same domain but not in results) 61 const isInternalNavigation = !isConversion && currentUrl.includes(currentDomain); 62 63 // Track the landing page with the appropriate status 64 $.ajax({ 65 type: "POST", 66 url: wpsi_search_navigation.ajaxurl, 67 dataType: 'json', 68 data: { 69 action: 'wpsi_store_landing_page', 70 search_term: searchData.term, 71 search_id: searchData.search_id, 72 landing_page: currentUrl, 73 is_conversion: isConversion ? 1 : 0, 74 is_internal: isInternalNavigation ? 1 : 0, 75 search_timestamp: searchData.timestamp, 76 landing_time: currentTime / 1000, 77 token: wpsi_search_navigation.token 78 }, 79 success: function () { 80 // Clear cookies on success 81 document.cookie = "wpsi_last_search=; path=/; max-age=0"; 82 document.cookie = "wpsi_search_id=; path=/; max-age=0"; 83 }, 84 error: function () { 85 // Also clear cookies on error to prevent stale data 86 document.cookie = "wpsi_last_search=; path=/; max-age=0"; 87 document.cookie = "wpsi_search_id=; path=/; max-age=0"; 88 } 89 }); 90});
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.