DmitrMakeev commited on
Commit
21fa4f7
1 Parent(s): 8973272

Create tild_utms.js

Browse files
Files changed (1) hide show
  1. script/tild_utms.js +1 -0
script/tild_utms.js ADDED
@@ -0,0 +1 @@
 
 
1
+ (()=>{var e=function(){var e=window.BH_REGISTER_FORM_LOCATOR||".js-form-proccess";document.querySelectorAll(e).forEach((function(e){return e.addEventListener("tildaform:beforesend",(function(){var t=e.dataset.successUrl,a=new FormData(e),o=new URL(t);new URLSearchParams(window.location.search).forEach((function(e,t){(e=e.trim())&&o.searchParams.set(t.toLowerCase(),e)})),a.forEach((function(t,a){var r,n=e.querySelector('[name="'+a+'"]');((r=n).offsetWidth||r.offsetHeight||r.getClientRects().length)&&t&&(a.includes("tildaspec-phone-part")&&(t=(""+n.dataset.phonemaskCode+t).replace(/\s/g,"").replace(/(\(|-|\))/g,""),a="phone"),(t=t.trim())&&o.searchParams.set(a.toLowerCase(),t))})),window.location.href=o.href}))}))};"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)})();