(function func() { }()); (function func() { }()); (function func() { }()); if ("click" == "form_first_page") { redirectlogs(); } /** * log action */ function redirectlogs() { var url = new URL(window.location.href); var revenue = url.searchParams.get("revenue"); fetch("https://t.onramplab.com/api/redirectlogs", { method: 'POST', headers: { 'Content-Type': 'application/json; charset=UTF-8', }, body: JSON.stringify({"current_url": "https://t.onramplab.com/container.js?campaign_id=97&site_id=922&type=form_first_page", "site_id": 922, "campaign_id": 97, "revenue": revenue }) }) .then(dataWrappedByPromise => dataWrappedByPromise.text()) .then(function(data) { console.log('request succeeded with JSON response', data); }).catch(function(error) { console.log('request failed', error); }); }