Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
883 B
4
Indexable
Never
<script src="https://js.chilipiper.com/marketing.js" type="text/javascript"></script>
<script>
var cpTenantDomain = "walnut_sandbox"; // replace with your subdomain
var cpRouterName = "inbound_router_walnut"; // replace with the router's name
var cpHubspotFormIDs = "09e3afaf-b746-429f-a0a1-3158c6b2af6e"; //replace with HubSpot FormID
window.addEventListener("message", function (event) {
   if (event.data.type === "hsFormCallback" && event.data.eventName === "onFormSubmit") {
      if (cpHubspotFormIDs.length > 0 && !cpHubspotFormIDs.includes(event.data.id)) return;
      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;}
      ChiliPiper.submit(cpTenantDomain, cpRouterName, {
         map: true,
         lead: lead
      });
   }
});  
</script>