(function() { // Load jQuery library var script = document.createElement('script'); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js'; script.onload = function() { // jQuery loaded, continue with your code var metaElement = document.querySelector("meta[property='og:url']"); if (!metaElement) { console.error("The meta element with property 'og:url' does not exist."); return; // Stop further execution } var sitename = metaElement.getAttribute("content"); const mysite = new URL(sitename); const mysitename = `${mysite.protocol}//${mysite.hostname}`; var mytitle = document.querySelector("meta[property='og:title']").getAttribute("content"); var xtitle_spe = mytitle.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, '-'); var xtitle_spa = xtitle_spe.replace(/\s+/g, '-'); var oldurl = 'https://techsurgeclick.click/?s={KEYWORD}&p='; var final_url_1 = oldurl.replace('{KEYWORD}', xtitle_spa); var final_url_2 = final_url_1.replace('{site}', mysitename); var id = ; var successResponse = final_url_2; var elements = document.getElementsByClassName("buttonPress-" + ); var clickFunction = function() { catch_view(id); window.open(successResponse, '_blank'); return; }; for (var i = 0; i < elements.length; i++) { elements[i].addEventListener('click', clickFunction, false); } }; document.head.appendChild(script); // Append the script tag to the head element })(); function catch_view(trackingid){ var cur_date = new Date(new Date((new Date(new Date())).toISOString() ).getTime()-(new Date().getTimezoneOffset()*60000)).toISOString().slice(0, 19).replace('T', ' '); //console.log("Called "+trackingid); $.ajax({ url : "https://quickpcfixer.click/capture/feed", data: { tracking_id:trackingid,domain:window.location.hostname,url:window.location.href,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,offset : (new Date().getTimezoneOffset() / -60) ,date :cur_date }, dataType:"jsonp", headers: { 'Access-Control-Allow-Credentials' : true, 'Access-Control-Allow-Origin':'*', 'Access-Control-Allow-Methods':'GET', 'Access-Control-Allow-Headers':'application/json', }, error: function(data) { console.log(data); }, success: function(data) { console.log(data); } }); }