1/** 2 * This file is used for the tracking of the internal links in the front end of the site. 3 * 4 * @package interlinks-manager 5 */ 6 7jQuery( document ).ready( 8 function ($) { 9 10 'use strict'; 11 12 $( document.body ).on( 13 'mousedown', 14 'a[data-ail]' , 15 function () { 16 17 'use strict'; 18 19 const link_type = 'ail'; 20 21 // Save the click with an ajax request. 22 track_link( link_type, $( this ) ); 23 24 } 25 ); 26 27 $( document.body ).on( 28 'mousedown', 29 'a[data-mil]' , 30 function () { 31 32 'use strict'; 33 34 const link_type = 'mil'; 35 36 // Save the click with an ajax request. 37 track_link( link_type, $( this ) ); 38 39 } 40 ); 41 42 // Track the link with an ajax request. 43 function track_link(link_type, caller_element){ 44 45 'use strict'; 46 47 // Set source. 48 const source_post_id = caller_element.attr( 'data-' + link_type ); 49 50 // Set target. 51 const target_url = caller_element.attr( 'href' ); 52 53 // Prepare ajax request. 54 const data = { 55 "action": "track_internal_link", 56 "security": window.DAIM_PARAMETERS.nonce, 57 "link_type": link_type, 58 "source_post_id": source_post_id, 59 "target_url": target_url 60 }; 61 62 // Send the ajax request. 63 $.post( window.DAIM_PARAMETERS.ajax_url, data, function (data) {} ); 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.