1( function () { 2 'use strict'; 3 4 if ( typeof window.pvcTrackData === 'undefined' ) { 5 return; 6 } 7 8 var data = window.pvcTrackData; 9 10 function sendTrackingRequest() { 11 if ( ! data.restUrl || ! data.postId ) { 12 return; 13 } 14 15 // Most browser-automation tools (Selenium, Puppeteer, Playwright) 16 // set navigator.webdriver = true unless the operator specifically 17 // evades it. This is trivially spoofable and not real bot 18 // protection, but it costs nothing to skip these by default. 19 if ( navigator.webdriver ) { 20 return; 21 } 22 23 fetch( data.restUrl, { 24 method: 'POST', 25 headers: { 26 'Content-Type': 'application/json', 27 'X-WP-Nonce': data.nonce 28 }, 29 // Ensures WordPress auth cookies are sent, so the server can 30 // correctly detect logged-in users even though this is a 31 // cross-context (fetch) request. 32 credentials: 'same-origin', 33 // Lets the request complete even if the user navigates away 34 // immediately after the page finishes loading. 35 keepalive: true, 36 body: JSON.stringify( { post_id: data.postId } ) 37 } ).catch( function () { 38 // Fail silently â a missed view count is not worth surfacing 39 // to the visitor or cluttering the console. 40 } ); 41 } 42 43 if ( document.readyState === 'complete' ) { 44 sendTrackingRequest(); 45 } else { 46 window.addEventListener( 'load', sendTrackingRequest ); 47 } 48} )();
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.