Upflow IP Lookup code
unknown
html
3 years ago
1.1 kB
6
Indexable
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> <script src="https://js.chilipiper.com/marketing.js" type="text/javascript"></script> <script> const cpTenantDomain = "upflow"; // REPLACE const cpRouterName = "inbound-router"; // REPLACE // // No changes needed from this point // Get ip country and save value $.getJSON('https://ipapi.co/json', function(data) { CPcountry = data.country || "Not Provided" }) ; // Listen for form submitted message window.addEventListener("message", (event) => { if (event.data.type === "hsFormCallback" && event.data.eventName === "onFormSubmit") { var lead = {}; for (var key in event.data.data) { lead[event.data.data[key].name] = event.data.data[key].value; } if(Object.keys(lead).length <= 1){lead = event.data.data;} console.log(lead); lead.Country_Code__c = CPcountry; ChiliPiper.submit(cpTenantDomain, cpRouterName, { map: true, lead: lead, }); } }); </script>
Editor is loading...