1jQuery(document).ready(function($) { 2 3 4 // PAGEVIEW tracking 5 6 let idscript = $('script[type="application/ld+json"]').html(); 7 8 9 let idlocation = idscript.search('dealer_id'); 10 11 let idbegins = idlocation + 11; 12 let idends = idbegins + 5; 13 let subStr = idscript.substring(idbegins, idends); 14 15 16 const baseurl = "https://kqq7yiajc4.execute-api.us-east-1.amazonaws.com/Stage1prod/counters?stat=" 17 let countername = subStr + "_ipageviews"; 18 let custparam = "&cust=" + subStr; 19 let fullurl = baseurl + countername + custparam; 20 21 $.ajax({ 22 type: "GET", 23 url: fullurl, 24 crossDomain: true, 25 data: {}, 26 contentType: 'application/json', 27 success: function(result){ console.log("pageview recorded at aws = " + result);}, 28 dataType: "json" 29 }); 30 31 // CALL BUTTON TRACKING 32 // Below watches for clicks to the Call Button 33 // This one is only for INDIVIDUAL sites, because it uses the Dealer_id from the json+ld tag 34 // The code for the indiv will of course be almost exactly the same, except for the subSt var 35 if(window.matchMedia("(max-width: 767px)").matches){ 36 // The viewport is less than 768 pixels wide 37 $("a[href^='tel']").on("click",function(){ 38 let countername = subStr + "_icalls" 39 let custparam = "&cust=" + subStr; 40 let fullurl = baseurl + countername + custparam; 41 42 $.ajax({ 43 type: "GET", 44 url: fullurl, 45 crossDomain: true, 46 data: {}, 47 success: function(result){ console.log("call click recorded at aws = " + result);}, 48 dataType: "json" 49 }); 50 }); 51 } else{ 52 // The viewport is at least 768 pixels wide 53 console.log("This is a tablet or desktop."); 54 } 55 56 57 58});
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.