@fynd-design-engineering/fynd-one-v2 3.4.30 → 3.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{var E=n=>{let t=new URLSearchParams(window.location.search).get(n);return t?t.trim():null},T=()=>{let n=E("utm_medium")?.toLowerCase();return n==="cpc"||n==="ads"},P="fynd_website_ad.",L=n=>`${P}${n}`,_=n=>{let t=n.closest("form");return t&&(t.getAttribute("data-name")||t.getAttribute("name")||t.id)||null},g=()=>{if(window.__adsTrackingInitializedGeneral||!T())return;window.__adsTrackingInitializedGeneral=!0;let n={"fynd_website.current_page":window.location.pathname},t=(e,i)=>{let r=L(e);window.trackEvent?.(r,{...n,...i||{}})};document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('[data-ph="sign-up"]').forEach(a=>a.addEventListener("click",()=>t("sign_up.clicked"))),document.querySelectorAll('[data-ph="sign-in"]').forEach(a=>a.addEventListener("click",()=>t("sign_in.clicked"))),document.querySelectorAll('[data-ph="book-a-demo"]').forEach(a=>a.addEventListener("click",()=>t("book_a_demo.clicked")));let e=document.querySelectorAll("[ph-form-field]"),i=new Set,r=function(){let a=_(this)||"unknown-form";i.has(a)||(i.add(a),t("form.started",{started_form:a}))};e.forEach(a=>{let d=a.tagName.toLowerCase(),c=a.type?.toLowerCase();d==="button"||d==="input"&&c==="submit"||a.addEventListener("focus",r),d==="button"||d==="input"&&c==="submit"?a.addEventListener("click",r):d==="select"?a.addEventListener("change",r):a.addEventListener("input",r)}),document.querySelectorAll('[type="submit"]').forEach(a=>{a.addEventListener("click",function(){let d=_(this);setTimeout(()=>{window.validationPassed===!0&&t("form.submitted",d?{submitted_form:d}:{})},10)})})})};var w="2741377816069290";function A(){typeof window>"u"||window.fbq||function(n,t,e,i,r,a,d){n.fbq||(r=n.fbq=function(){r.callMethod?r.callMethod.apply(r,arguments):r.queue.push(arguments)},n._fbq||(n._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[],a=t.createElement(e),a.async=!0,a.src="https://connect.facebook.net/en_US/fbevents.js",d=t.getElementsByTagName(e)[0],d.parentNode.insertBefore(a,d))}(window,document,"script",void 0)}function b(){try{let n=null;if(typeof window.getUserJourney=="function"&&(n=window.getUserJourney()),!n){let i=sessionStorage.getItem("userJourney");i&&(n=JSON.parse(i))}let t={},e=n?.formDetails;return e?.email&&(t.email=e.email),e?.phone&&(t.phone=e.phone),e?.firstName&&(t.first_name=e.firstName),e?.lastName&&(t.last_name=e.lastName),e?.city&&(t.city=e.city),e?.state&&(t.state=e.state),e?.zip&&(t.zip=e.zip),n?.country&&(t.country=n.country),n?.userId&&(t.external_id=String(n.userId)),Object.keys(t).forEach(i=>{let r=i;t[r]||delete t[r]}),Object.keys(t).length?t:null}catch{return null}}function D(n){if(!n)return null;let t={};return n["fynd_website.form_email"]&&(t.email=n["fynd_website.form_email"]),n["fynd_website.form_phone"]&&(t.phone=n["fynd_website.form_phone"]),n["fynd_website.form_first_name"]&&(t.first_name=n["fynd_website.form_first_name"]),n["fynd_website.form_last_name"]&&(t.last_name=n["fynd_website.form_last_name"]),n.city&&(t.city=n.city),n.state&&(t.state=n.state),n.zip&&(t.zip=n.zip),n.country&&(t.country=n.country),n.external_id&&(t.external_id=n.external_id),Object.keys(t).forEach(e=>{let i=e;t[i]||delete t[i]}),Object.keys(t).length?t:null}function S(n="evt"){return`${n}_${Date.now()}_${Math.random().toString(36).slice(2)}`}function u(...n){window.fbq&&window.fbq(...n)}function M(n,t){let e=t||{},i=D(e)||b();switch(n){case"fynd_website.form.submitted":{let r=e.event_id||S("lead"),a=e.submitted_form||e["fynd_website.form_name"]||"unknown_form";return{type:"track",name:"Lead",params:{form_id:e["fynd_website.form_id"]||void 0,form_name:a,value:0,currency:"INR"},options:{eventID:r},userData:i}}case"fynd_website.sign_up.clicked":return{type:"trackCustom",name:"SignUpClick",params:{},userData:i};case"fynd_website.sign_in.clicked":return{type:"trackCustom",name:"SignInClick",params:{},userData:i};case"fynd_website.book_a_demo.clicked":return{type:"trackCustom",name:"BookDemoClick",params:{source_page:e?.["fynd_website.source_page"]},userData:i};case"fynd_website.form.started":return{type:"trackCustom",name:"FormStarted",params:{form_id:e?.["fynd_website.form_id"]||void 0,form_name:e?.["fynd_website.form_name"]||void 0},userData:i};case"fynd_website.page.loaded":return{type:"track",name:"PageView",params:{},userData:i};default:return null}}function h(n={}){let{enableAdvancedMatching:t=!0,enableSpaPageViews:e=!0,hasConsent:i}=n;A();let r=t?b():null;if(i&&!i()){let d=window.setInterval(()=>{i()&&(window.clearInterval(d),u("init",w,r||{}),p(e))},250)}else u("init",w,r||{}),p(e);let a=window.trackEvent;window.trackEvent=function(d,c){try{if(typeof a=="function"&&a.call(window,d,c),i&&!i())return;let o=M(d,c);if(!o)return;o.type==="track"?o.options?.eventID?u("track",o.name,o.params||{},{eventID:o.options.eventID}):u("track",o.name,o.params||{}):u("trackCustom",o.name,o.params||{})}catch(o){console.warn("Meta tracking error:",o)}}}function p(n){if(u("track","PageView"),n){let r=function(){setTimeout(()=>u("track","PageView"),0)};var t=r;let e=history.pushState,i=history.replaceState;history.pushState=function(...a){let d=e.apply(this,a);return r(),d},history.replaceState=function(...a){let d=i.apply(this,a);return r(),d},window.addEventListener("popstate",r)}}var v=()=>{let n={};try{let t=null;if(typeof window.getUserJourney=="function"&&(t=window.getUserJourney()),!t){let e=localStorage.getItem("userJourney");e&&(t=JSON.parse(e))}if(t?.formDetails){let e=t.formDetails;e.formId&&(n.form_id=e.formId),e.formName&&(n.form_name=e.formName),e.firstName&&(n.form_first_name=e.firstName),e.lastName&&(n.form_last_name=e.lastName),e.email&&(n.form_email=e.email),e.phone&&(n.form_phone=e.phone)}if(t?.aiData){let e=t.aiData;e.context&&(n.aidata_context=e.context),e.platform&&(n.aidata_platform=e.platform),e.type&&(n.aidata_type=e.type),e.detectionMethod&&(n.aidata_detection=e.detectionMethod)}}catch(t){console.warn("Error getting user journey data for GA tracking:",t)}return n},y=()=>{let t={"fynd_website.source_page":window.location.pathname,"fynd_website.product":"fynd.com website","fynd_website.device_type":"Unknown","fynd_website.utm_source":new URLSearchParams(window.location.search).get("utm_source")||"","fynd_website.utm_medium":new URLSearchParams(window.location.search).get("utm_medium")||"","fynd_website.utm_campaign":new URLSearchParams(window.location.search).get("utm_campaign")||"","fynd_website.referrer":document.referrer};try{let e=null;if(typeof window.getUserJourney=="function"&&(e=window.getUserJourney()),!e){let i=localStorage.getItem("userJourney");i&&(e=JSON.parse(i))}if(e){if(t["fynd_website.journey_touchpoints"]=e.userJourney||e,e.formDetails){let i=e.formDetails;i.formId&&(t["fynd_website.form_id"]=i.formId),i.formName&&(t["fynd_website.form_name"]=i.formName),i.firstName&&(t["fynd_website.form_first_name"]=i.firstName),i.lastName&&(t["fynd_website.form_last_name"]=i.lastName),i.email&&(t["fynd_website.form_email"]=i.email),i.phone&&(t["fynd_website.form_phone"]=i.phone)}if(e.userJourney?.length>0){t["fynd_website.journey_total_pages"]=e.userJourney.length,t["fynd_website.journey_touchpoints_count"]=e.userJourney.length,t["fynd_website.journey_first_page"]=e.userJourney[0].page,t["fynd_website.journey_current_page"]=e.userJourney[e.userJourney.length-1].page;let i=new Date(e.userJourney[0].time),r=new Date(e.userJourney[e.userJourney.length-1].time);t["fynd_website.journey_session_duration"]=Math.floor((r.getTime()-i.getTime())/1e3),t["fynd_website.journey_entry_time"]=e.userJourney[0].time,t["fynd_website.journey_exit_time"]=e.userJourney[e.userJourney.length-1].time}if(e.deviceCategory&&(t["fynd_website.device_type"]=e.deviceCategory),e.browser&&(t["fynd_website.journey_browser"]=e.browser),e.device&&(t["fynd_website.journey_device"]=e.device),e.origin&&(t["fynd_website.journey_origin"]=e.origin),e.utmPath&&(t["fynd_website.journey_utm_path"]=e.utmPath),e.scrollDepth&&(t["fynd_website.journey_scroll_depth"]=e.scrollDepth),e.aiData){let i=e.aiData;i.context&&(t["fynd_website.aidata_context"]=i.context),i.platform&&(t["fynd_website.aidata_platform"]=i.platform),i.type&&(t["fynd_website.aidata_type"]=i.type),i.detectionMethod&&(t["fynd_website.aidata_detection"]=i.detectionMethod)}}}catch(e){console.warn("Error getting user journey data for tracking:",e)}if(t["fynd_website.device_type"]==="Unknown"){let e=navigator.userAgent;/iPad/.test(e)||/Android/.test(e)&&!/Mobile/.test(e)||/Tablet/.test(e)?t["fynd_website.device_type"]="Tablet":/Mobile|iPhone|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop/.test(e)?t["fynd_website.device_type"]="Mobile":t["fynd_website.device_type"]="Desktop"}try{let e=document.cookie.match(/(?:^|;\s*)user-id=([^;]*)/);t["fynd_website.uuid"]=e?decodeURIComponent(e[1]):null}catch(e){console.warn("Error reading user-id cookie:",e),t["fynd_website.uuid"]=null}return t},j=(n,t,e)=>{if(window.dataLayer){let i={event:n,event_category:"form_interaction",event_label:n,...t};e?.submitted_form&&(i.submitted_form=e.submitted_form),window.dataLayer.push(i)}else console.warn("dataLayer not available for GA tracking")},m=(n,t)=>{try{let e=y(),i=t?{...e,...t}:e;if(window.posthog){let c={...i};if(n==="fynd_website.form.submitted")try{let o=window.getUserJourney?.()||JSON.parse(localStorage.getItem("userJourney")||"{}"),s={};o?.formDetails?.firstName&&(s.name=o.formDetails.firstName),o?.formDetails?.email&&(s.email=o.formDetails.email),o?.formDetails?.phone&&(s.mobile=o.formDetails.phone),Object.keys(s).length>0&&(c.$set=s)}catch(o){console.warn("Error extracting person properties:",o)}window.posthog.capture(n,c)}let r=v(),a=r.aidata_context||r.aidata_platform||r.aidata_type||r.aidata_detection;(n.includes("form")||Object.keys(r).length>0||t?.submitted_form||!!a)&&j(n,r,t)}catch(e){console.error("Error tracking event:",e)}},k=n=>{let t=n.closest("form");return t&&(t.getAttribute("data-name")||t.getAttribute("name")||t.id)||null};document.addEventListener("DOMContentLoaded",()=>{let n=y();window.posthog&&window.posthog.capture("$pageview",n)});window.addEventListener("load",()=>{m("fynd_website.page.loaded")});document.addEventListener("DOMContentLoaded",()=>{let n=document.querySelectorAll('[data-ph="sign-up"]'),t=document.querySelectorAll('[data-ph="sign-in"]'),e=document.querySelectorAll('[href="#footer-form"]'),i=document.querySelectorAll('[data-ph="book-a-demo"]'),r=document.querySelectorAll('[data-ph="call"]');document.querySelectorAll('[type="submit"]').forEach(s=>{s.addEventListener("click",function(){let f=k(this);setTimeout(()=>{window.validationPassed===!0&&m("fynd_website.form.submitted",f?{submitted_form:f}:{})},10)})}),n.forEach(s=>{s.addEventListener("click",()=>m("fynd_website.sign_up.clicked"))}),t.forEach(s=>{s.addEventListener("click",()=>m("fynd_website.sign_in.clicked"))}),e.forEach(s=>{s.addEventListener("click",()=>m("fynd_website.scroll_to_form.clicked"))}),i.forEach(s=>{s.addEventListener("click",()=>m("fynd_website.book_a_demo.clicked"))}),r.forEach(s=>{s.addEventListener("click",()=>m("fynd_website.call.clicked"))});let d=document.querySelectorAll("[ph-form-field]"),c=new Set,o=function(){let f=k(this)||"unknown-form";c.has(f)||(c.add(f),m("fynd_website.form.started"))};d.forEach(s=>{let f=s.tagName.toLowerCase(),l=s.type?.toLowerCase();f==="button"||f==="input"&&l==="submit"||s.addEventListener("focus",o),f==="button"||f==="input"&&l==="submit"?s.addEventListener("click",o):f==="select"?s.addEventListener("change",o):s.addEventListener("input",o)})});window.getPosthogTrackingProperties=y;window.trackEvent=m;window.getGaTrackingProperties=v;g();h({enableAdvancedMatching:!0,enableSpaPageViews:!0,hasConsent:()=>window.__ad_consent==="granted"||!0});})();
|
|
1
|
+
"use strict";(()=>{var E=n=>{let t=new URLSearchParams(window.location.search).get(n);return t?t.trim():null},P=()=>{let n=E("utm_medium")?.toLowerCase();return n==="cpc"||n==="ads"},T="fynd_website_ad.",L=n=>`${T}${n}`,_=n=>{let t=n.closest("form");return t&&(t.getAttribute("data-name")||t.getAttribute("name")||t.id)||null},g=()=>{if(window.__adsTrackingInitializedGeneral||!P())return;window.__adsTrackingInitializedGeneral=!0;let n={"fynd_website.current_page":window.location.pathname},t=(e,i)=>{let r=L(e);window.trackEvent?.(r,{...n,...i||{}})};document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('[data-ph="sign-up"]').forEach(a=>a.addEventListener("click",()=>t("sign_up.clicked"))),document.querySelectorAll('[data-ph="sign-in"]').forEach(a=>a.addEventListener("click",()=>t("sign_in.clicked"))),document.querySelectorAll('[data-ph="book-a-demo"]').forEach(a=>a.addEventListener("click",()=>t("book_a_demo.clicked")));let e=document.querySelectorAll("[ph-form-field]"),i=new Set,r=function(){let a=_(this)||"unknown-form";i.has(a)||(i.add(a),t("form.started",{started_form:a}))};e.forEach(a=>{let o=a.tagName.toLowerCase(),c=a.type?.toLowerCase();o==="button"||o==="input"&&c==="submit"||a.addEventListener("focus",r),o==="button"||o==="input"&&c==="submit"?a.addEventListener("click",r):o==="select"?a.addEventListener("change",r):a.addEventListener("input",r)}),document.querySelectorAll('[type="submit"]').forEach(a=>{a.addEventListener("click",function(){let o=_(this);setTimeout(()=>{window.validationPassed===!0&&t("form.submitted",o?{submitted_form:o}:{})},10)})})})};var w="2741377816069290";function A(){typeof window>"u"||window.fbq||function(n,t,e,i,r,a,o){n.fbq||(r=n.fbq=function(){r.callMethod?r.callMethod.apply(r,arguments):r.queue.push(arguments)},n._fbq||(n._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[],a=t.createElement(e),a.async=!0,a.src="https://connect.facebook.net/en_US/fbevents.js",o=t.getElementsByTagName(e)[0],o.parentNode.insertBefore(a,o))}(window,document,"script",void 0)}function b(){try{let n=null;if(typeof window.getUserJourney=="function"&&(n=window.getUserJourney()),!n){let i=sessionStorage.getItem("userJourney");i&&(n=JSON.parse(i))}let t={},e=n?.formDetails;return e?.email&&(t.email=e.email),e?.phone&&(t.phone=e.phone),e?.firstName&&(t.first_name=e.firstName),e?.lastName&&(t.last_name=e.lastName),e?.city&&(t.city=e.city),e?.state&&(t.state=e.state),e?.zip&&(t.zip=e.zip),n?.country&&(t.country=n.country),n?.userId&&(t.external_id=String(n.userId)),Object.keys(t).forEach(i=>{let r=i;t[r]||delete t[r]}),Object.keys(t).length?t:null}catch{return null}}function D(n){if(!n)return null;let t={};return n["fynd_website.form_email"]&&(t.email=n["fynd_website.form_email"]),n["fynd_website.form_phone"]&&(t.phone=n["fynd_website.form_phone"]),n["fynd_website.form_first_name"]&&(t.first_name=n["fynd_website.form_first_name"]),n["fynd_website.form_last_name"]&&(t.last_name=n["fynd_website.form_last_name"]),n.city&&(t.city=n.city),n.state&&(t.state=n.state),n.zip&&(t.zip=n.zip),n.country&&(t.country=n.country),n.external_id&&(t.external_id=n.external_id),Object.keys(t).forEach(e=>{let i=e;t[i]||delete t[i]}),Object.keys(t).length?t:null}function S(n="evt"){return`${n}_${Date.now()}_${Math.random().toString(36).slice(2)}`}function u(...n){window.fbq&&window.fbq(...n)}function M(n,t){let e=t||{},i=D(e)||b();switch(n){case"fynd_website.form.submitted":{let r=e.event_id||S("lead"),a=e.submitted_form||e["fynd_website.form_name"]||"unknown_form";return{type:"track",name:"Lead",params:{form_id:e["fynd_website.form_id"]||void 0,form_name:a,value:0,currency:"INR"},options:{eventID:r},userData:i}}case"fynd_website.sign_up.clicked":return{type:"trackCustom",name:"SignUpClick",params:{},userData:i};case"fynd_website.sign_in.clicked":return{type:"trackCustom",name:"SignInClick",params:{},userData:i};case"fynd_website.book_a_demo.clicked":return{type:"trackCustom",name:"BookDemoClick",params:{source_page:e?.["fynd_website.source_page"]},userData:i};case"fynd_website.form.started":return{type:"trackCustom",name:"FormStarted",params:{form_id:e?.["fynd_website.form_id"]||void 0,form_name:e?.["fynd_website.form_name"]||void 0},userData:i};case"fynd_website.page.loaded":return{type:"track",name:"PageView",params:{},userData:i};default:return null}}function h(n={}){let{enableAdvancedMatching:t=!0,enableSpaPageViews:e=!0,hasConsent:i}=n;A();let r=t?b():null;if(i&&!i()){let o=window.setInterval(()=>{i()&&(window.clearInterval(o),u("init",w,r||{}),p(e))},250)}else u("init",w,r||{}),p(e);let a=window.trackEvent;window.trackEvent=function(o,c){try{if(typeof a=="function"&&a.call(window,o,c),i&&!i())return;let s=M(o,c);if(!s)return;s.type==="track"?s.options?.eventID?u("track",s.name,s.params||{},{eventID:s.options.eventID}):u("track",s.name,s.params||{}):u("trackCustom",s.name,s.params||{})}catch(s){console.warn("Meta tracking error:",s)}}}function p(n){if(u("track","PageView"),n){let r=function(){setTimeout(()=>u("track","PageView"),0)};var t=r;let e=history.pushState,i=history.replaceState;history.pushState=function(...a){let o=e.apply(this,a);return r(),o},history.replaceState=function(...a){let o=i.apply(this,a);return r(),o},window.addEventListener("popstate",r)}}var v=()=>{let n={};try{let t=null;if(typeof window.getUserJourney=="function"&&(t=window.getUserJourney()),!t){let e=localStorage.getItem("userJourney");e&&(t=JSON.parse(e))}if(t?.formDetails){let e=t.formDetails;e.formId&&(n.form_id=e.formId),e.formName&&(n.form_name=e.formName),e.firstName&&(n.form_first_name=e.firstName),e.lastName&&(n.form_last_name=e.lastName),e.email&&(n.form_email=e.email),e.phone&&(n.form_phone=e.phone)}if(t?.aiData){let e=t.aiData;e.context&&(n.aidata_context=e.context),e.platform&&(n.aidata_platform=e.platform),e.type&&(n.aidata_type=e.type),e.detectionMethod&&(n.aidata_detection=e.detectionMethod)}}catch(t){console.warn("Error getting user journey data for GA tracking:",t)}return n},y=()=>{let t={"fynd_website.source_page":window.location.pathname,"fynd_website.product":"fynd.com website","fynd_website.device_type":"Unknown","fynd_website.utm_source":new URLSearchParams(window.location.search).get("utm_source")||"","fynd_website.utm_medium":new URLSearchParams(window.location.search).get("utm_medium")||"","fynd_website.utm_campaign":new URLSearchParams(window.location.search).get("utm_campaign")||"","fynd_website.referrer":document.referrer};try{let e=null;if(typeof window.getUserJourney=="function"&&(e=window.getUserJourney()),!e){let i=localStorage.getItem("userJourney");i&&(e=JSON.parse(i))}if(e){if(t["fynd_website.journey_touchpoints"]=e.userJourney||e,e.formDetails){let i=e.formDetails;i.formId&&(t["fynd_website.form_id"]=i.formId),i.formName&&(t["fynd_website.form_name"]=i.formName),i.firstName&&(t["fynd_website.form_first_name"]=i.firstName),i.lastName&&(t["fynd_website.form_last_name"]=i.lastName),i.email&&(t["fynd_website.form_email"]=i.email),i.phone&&(t["fynd_website.form_phone"]=i.phone)}if(e.userJourney?.length>0){t["fynd_website.journey_total_pages"]=e.userJourney.length,t["fynd_website.journey_touchpoints_count"]=e.userJourney.length,t["fynd_website.journey_first_page"]=e.userJourney[0].page,t["fynd_website.journey_current_page"]=e.userJourney[e.userJourney.length-1].page;let i=new Date(e.userJourney[0].time),r=new Date(e.userJourney[e.userJourney.length-1].time);t["fynd_website.journey_session_duration"]=Math.floor((r.getTime()-i.getTime())/1e3),t["fynd_website.journey_entry_time"]=e.userJourney[0].time,t["fynd_website.journey_exit_time"]=e.userJourney[e.userJourney.length-1].time}if(e.deviceCategory&&(t["fynd_website.device_type"]=e.deviceCategory),e.browser&&(t["fynd_website.journey_browser"]=e.browser),e.device&&(t["fynd_website.journey_device"]=e.device),e.origin&&(t["fynd_website.journey_origin"]=e.origin),e.utmPath&&(t["fynd_website.journey_utm_path"]=e.utmPath),e.scrollDepth&&(t["fynd_website.journey_scroll_depth"]=e.scrollDepth),e.aiData){let i=e.aiData;i.context&&(t["fynd_website.aidata_context"]=i.context),i.platform&&(t["fynd_website.aidata_platform"]=i.platform),i.type&&(t["fynd_website.aidata_type"]=i.type),i.detectionMethod&&(t["fynd_website.aidata_detection"]=i.detectionMethod)}}}catch(e){console.warn("Error getting user journey data for tracking:",e)}if(t["fynd_website.device_type"]==="Unknown"){let e=navigator.userAgent;/iPad/.test(e)||/Android/.test(e)&&!/Mobile/.test(e)||/Tablet/.test(e)?t["fynd_website.device_type"]="Tablet":/Mobile|iPhone|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop/.test(e)?t["fynd_website.device_type"]="Mobile":t["fynd_website.device_type"]="Desktop"}try{let e=document.cookie.match(/(?:^|;\s*)user-id=([^;]*)/);t["fynd_website.uuid"]=e?decodeURIComponent(e[1]):null}catch(e){console.warn("Error reading user-id cookie:",e),t["fynd_website.uuid"]=null}return t},j=(n,t,e)=>{if(window.dataLayer){let i={event:n,event_category:"form_interaction",event_label:n,...t};e?.submitted_form&&(i.submitted_form=e.submitted_form),window.dataLayer.push(i)}else console.warn("dataLayer not available for GA tracking")},m=(n,t)=>{try{let e=y(),i=t?{...e,...t}:e;if(window.posthog&&(window.posthog.capture(n,i),n==="fynd_website.form.submitted"))try{let c=window.getUserJourney?.()||JSON.parse(localStorage.getItem("userJourney")||"{}"),s={};c?.formDetails?.firstName&&(s.name=c.formDetails.firstName),c?.formDetails?.email&&(s.email=c.formDetails.email),c?.formDetails?.phone&&(s.mobile=c.formDetails.phone),Object.keys(s).length>0&&(console.log("\u{1F4CA} PostHog Person Properties - Form Submission:",s),window.posthog.setPersonProperties(s))}catch(c){console.warn("Error setting person properties:",c)}let r=v(),a=r.aidata_context||r.aidata_platform||r.aidata_type||r.aidata_detection;(n.includes("form")||Object.keys(r).length>0||t?.submitted_form||!!a)&&j(n,r,t)}catch(e){console.error("Error tracking event:",e)}},k=n=>{let t=n.closest("form");return t&&(t.getAttribute("data-name")||t.getAttribute("name")||t.id)||null};document.addEventListener("DOMContentLoaded",()=>{let n=y();window.posthog&&window.posthog.capture("$pageview",n)});window.addEventListener("load",()=>{m("fynd_website.page.loaded")});document.addEventListener("DOMContentLoaded",()=>{let n=document.querySelectorAll('[data-ph="sign-up"]'),t=document.querySelectorAll('[data-ph="sign-in"]'),e=document.querySelectorAll('[href="#footer-form"]'),i=document.querySelectorAll('[data-ph="book-a-demo"]'),r=document.querySelectorAll('[data-ph="call"]');document.querySelectorAll('[type="submit"]').forEach(d=>{d.addEventListener("click",function(){let f=k(this);setTimeout(()=>{window.validationPassed===!0&&m("fynd_website.form.submitted",f?{submitted_form:f}:{})},10)})}),n.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.sign_up.clicked"))}),t.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.sign_in.clicked"))}),e.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.scroll_to_form.clicked"))}),i.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.book_a_demo.clicked"))}),r.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.call.clicked"))});let o=document.querySelectorAll("[ph-form-field]"),c=new Set,s=function(){let f=k(this)||"unknown-form";c.has(f)||(c.add(f),m("fynd_website.form.started"))};o.forEach(d=>{let f=d.tagName.toLowerCase(),l=d.type?.toLowerCase();f==="button"||f==="input"&&l==="submit"||d.addEventListener("focus",s),f==="button"||f==="input"&&l==="submit"?d.addEventListener("click",s):f==="select"?d.addEventListener("change",s):d.addEventListener("input",s)})});window.getPosthogTrackingProperties=y;window.trackEvent=m;window.getGaTrackingProperties=v;g();h({enableAdvancedMatching:!0,enableSpaPageViews:!0,hasConsent:()=>window.__ad_consent==="granted"||!0});})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../bin/live-reload.js", "../../src/posthog-and-ga/adtracking-general.ts", "../../src/posthog-and-ga/meta-tracking.ts", "../../src/posthog-and-ga/main.ts"],
|
|
4
|
-
"sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n // console.log(\"Live reload disabled: not running on localhost\");\n}\n", "// adTracking.general.ts \u2014 General ad events for paid traffic (utm_medium=cpc|ads)\n\ndeclare global {\n interface Window {\n trackEvent: (eventName: string, properties?: any) => void;\n validationPassed?: boolean;\n __adsTrackingInitializedGeneral?: boolean;\n }\n }\n \n const getSearchParam = (name: string): string | null => {\n const v = new URLSearchParams(window.location.search).get(name);\n return v ? v.trim() : null;\n };\n \n const isAdTraffic = (): boolean => {\n const medium = getSearchParam(\"utm_medium\")?.toLowerCase();\n return medium === \"cpc\" || medium === \"ads\";\n };\n \n const AD_EVENT_PREFIX = \"fynd_website_ad.\";\n const makeEvent = (suffix: string) => `${AD_EVENT_PREFIX}${suffix}`;\n \n // helper: find nearest form and get a friendly name\n const getParentFormName = (element: HTMLElement): string | null => {\n const parentForm = element.closest(\"form\") as HTMLFormElement | null;\n if (!parentForm) return null;\n return (\n parentForm.getAttribute(\"data-name\") ||\n parentForm.getAttribute(\"name\") ||\n parentForm.id ||\n null\n );\n };\n \n /**\n * Initialize general ads tracking.\n * Fires only when utm_medium is \"cpc\" or \"ads\".\n * Adds `fynd_website.current_page` = current page path.\n */\n export const initGeneralAdsTracking = () => {\n if (window.__adsTrackingInitializedGeneral) return;\n if (!isAdTraffic()) return;\n \n window.__adsTrackingInitializedGeneral = true;\n \n const baseProps: Record<string, any> = {\n \"fynd_website.current_page\": window.location.pathname,\n };\n \n const emit = (suffix: string, props?: Record<string, any>) => {\n const name = makeEvent(suffix);\n window.trackEvent?.(name, { ...baseProps, ...(props || {}) });\n };\n \n document.addEventListener(\"DOMContentLoaded\", () => {\n // Buttons\n document.querySelectorAll('[data-ph=\"sign-up\"]').forEach((btn) =>\n btn.addEventListener(\"click\", () => emit(\"sign_up.clicked\"))\n );\n document.querySelectorAll('[data-ph=\"sign-in\"]').forEach((btn) =>\n btn.addEventListener(\"click\", () => emit(\"sign_in.clicked\"))\n );\n document.querySelectorAll('[data-ph=\"book-a-demo\"]').forEach((btn) =>\n btn.addEventListener(\"click\", () => emit(\"book_a_demo.clicked\"))\n );\n \n // Form started\n const formFields = document.querySelectorAll<HTMLElement>(\"[ph-form-field]\");\n const triggeredForms = new Set<string>();\n \n const handleFormStarted = function (this: HTMLElement) {\n const formName = getParentFormName(this) || \"unknown-form\";\n if (!triggeredForms.has(formName)) {\n triggeredForms.add(formName);\n emit(\"form.started\", { started_form: formName });\n }\n };\n \n formFields.forEach((field) => {\n const tag = field.tagName.toLowerCase();\n const type = (field as HTMLInputElement).type?.toLowerCase();\n \n if (!(tag === \"button\" || (tag === \"input\" && type === \"submit\"))) {\n field.addEventListener(\"focus\", handleFormStarted);\n }\n if (tag === \"button\" || (tag === \"input\" && type === \"submit\")) {\n field.addEventListener(\"click\", handleFormStarted);\n } else if (tag === \"select\") {\n field.addEventListener(\"change\", handleFormStarted);\n } else {\n field.addEventListener(\"input\", handleFormStarted);\n }\n });\n \n // Form submitted\n document.querySelectorAll('[type=\"submit\"]').forEach((button) => {\n button.addEventListener(\"click\", function (this: HTMLElement) {\n const formName = getParentFormName(this);\n setTimeout(() => {\n if (window.validationPassed === true) {\n const props = formName ? { submitted_form: formName } : {};\n emit(\"form.submitted\", props);\n }\n }, 10);\n });\n });\n });\n };", "// meta-tracking.ts \u2014 Meta Pixel integration (standards-compliant) for Fynd website\n// - Initializes Meta Pixel (fbq) with Advanced Matching (when available)\n// - Mirrors your existing window.trackEvent() calls to Meta events\n// - Maps Fynd events -> Meta standard/custom events for better optimization\n// - Adds SPA PageView handling + eventID generation for future CAPI dedup\n// - Safe to import once anywhere in your app bootstrap\n\nimport { UserJourney } from \"../utils/types/user-journey\";\n\n// ---------- Config ----------\nconst META_PIXEL_ID = \"2741377816069290\";\n\ntype AdvancedUser = {\n email?: string;\n phone?: string;\n first_name?: string;\n last_name?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n external_id?: string;\n};\n\ntype InitOptions = {\n /**\n * If true, attempts to pull user info from window.getUserJourney/sessionStorage\n * and pass as Advanced Matching data (improves match rate for retargeting).\n */\n enableAdvancedMatching?: boolean;\n\n /**\n * If true, listens for SPA route changes and fires PageView on history changes.\n * Set true if you use a client-side router.\n */\n enableSpaPageViews?: boolean;\n\n /**\n * Optional predicate: return false to block Meta calls until consent is granted.\n * Example: () => window.__ad_consent === 'granted'\n */\n hasConsent?: () => boolean;\n};\n\n// ---------- fbq bootstrap ----------\ndeclare global {\n interface Window {\n fbq?: (...args: any[]) => void;\n _fbq?: any;\n trackEvent: (eventName: string, properties?: any) => void;\n getUserJourney: () => UserJourney | null;\n }\n}\n\nfunction loadMetaPixel(): void {\n if (typeof window === \"undefined\") return;\n if (window.fbq) return;\n\n (function (f: any, b: any, e: any, v: any, n?: any, t?: any, s?: any) {\n if (f.fbq) return;\n n = f.fbq = function () {\n (n as any).callMethod ? (n as any).callMethod.apply(n, arguments) : (n as any).queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n (n as any).push = (n as any);\n (n as any).loaded = true;\n (n as any).version = \"2.0\";\n (n as any).queue = [];\n t = b.createElement(e);\n t.async = true;\n t.src = \"https://connect.facebook.net/en_US/fbevents.js\";\n s = b.getElementsByTagName(e)[0];\n s.parentNode!.insertBefore(t, s);\n })(window, document, \"script\", undefined);\n}\n\n// ---------- Advanced Matching helpers ----------\nfunction getAdvancedUserFromJourney(): AdvancedUser | null {\n try {\n let journey: any = null;\n if (typeof window.getUserJourney === \"function\") {\n journey = window.getUserJourney();\n }\n if (!journey) {\n const stored = sessionStorage.getItem(\"userJourney\");\n if (stored) journey = JSON.parse(stored);\n }\n\n const u: AdvancedUser = {};\n const fd = journey?.formDetails;\n if (fd?.email) u.email = fd.email;\n if (fd?.phone) u.phone = fd.phone;\n if (fd?.firstName) u.first_name = fd.firstName;\n if (fd?.lastName) u.last_name = fd.lastName;\n if (fd?.city) u.city = fd.city;\n if (fd?.state) u.state = fd.state;\n if (fd?.zip) u.zip = fd.zip;\n if (journey?.country) u.country = journey.country;\n if (journey?.userId) u.external_id = String(journey.userId);\n\n // Remove empties\n Object.keys(u).forEach((k) => {\n const key = k as keyof AdvancedUser;\n if (!u[key]) delete u[key];\n });\n\n return Object.keys(u).length ? u : null;\n } catch {\n return null;\n }\n}\n\nfunction getAdvancedUserFromProps(props?: any): AdvancedUser | null {\n if (!props) return null;\n const u: AdvancedUser = {};\n if (props[\"fynd_website.form_email\"]) u.email = props[\"fynd_website.form_email\"];\n if (props[\"fynd_website.form_phone\"]) u.phone = props[\"fynd_website.form_phone\"];\n if (props[\"fynd_website.form_first_name\"]) u.first_name = props[\"fynd_website.form_first_name\"];\n if (props[\"fynd_website.form_last_name\"]) u.last_name = props[\"fynd_website.form_last_name\"];\n if (props.city) u.city = props.city;\n if (props.state) u.state = props.state;\n if (props.zip) u.zip = props.zip;\n if (props.country) u.country = props.country;\n if (props.external_id) u.external_id = props.external_id;\n\n Object.keys(u).forEach((k) => {\n const key = k as keyof AdvancedUser;\n if (!u[key]) delete u[key];\n });\n\n return Object.keys(u).length ? u : null;\n}\n\n// ---------- Utility ----------\nfunction genEventId(prefix: string = \"evt\"): string {\n return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2)}`;\n}\n\nfunction safeFbq(...args: any[]): void {\n if (!window.fbq) return;\n window.fbq(...args);\n}\n\n// ---------- Core mapping (Fynd -> Meta) ----------\n/**\n * Maps your event names to Meta\u2019s recommended events.\n * Returns {name, params, options} ready for fbq('track'|'trackCustom', ...)\n */\nfunction mapFyndToMeta(eventName: string, properties?: any): {\n type: \"track\" | \"trackCustom\";\n name: string;\n params?: Record<string, any>;\n options?: { eventID?: string };\n userData?: AdvancedUser | null;\n} | null {\n const props = properties || {};\n // Try to extract user for Advanced Matching\n const userData = getAdvancedUserFromProps(props) || getAdvancedUserFromJourney();\n\n switch (eventName) {\n case \"fynd_website.form.submitted\": {\n // Choose 'Lead' as default (use CompleteRegistration for account creation flows)\n const eventID = props.event_id || genEventId(\"lead\");\n const formName = props.submitted_form || props[\"fynd_website.form_name\"] || \"unknown_form\";\n return {\n type: \"track\",\n name: \"Lead\",\n params: {\n form_id: props[\"fynd_website.form_id\"] || undefined,\n form_name: formName,\n value: 0,\n currency: \"INR\",\n },\n options: { eventID },\n userData,\n };\n }\n\n case \"fynd_website.sign_up.clicked\":\n return { type: \"trackCustom\", name: \"SignUpClick\", params: {}, userData };\n\n case \"fynd_website.sign_in.clicked\":\n return { type: \"trackCustom\", name: \"SignInClick\", params: {}, userData };\n\n case \"fynd_website.book_a_demo.clicked\":\n return {\n type: \"trackCustom\",\n name: \"BookDemoClick\",\n params: {\n source_page: props?.[\"fynd_website.source_page\"],\n },\n userData,\n };\n\n case \"fynd_website.form.started\":\n return {\n type: \"trackCustom\",\n name: \"FormStarted\",\n params: {\n form_id: props?.[\"fynd_website.form_id\"] || undefined,\n form_name: props?.[\"fynd_website.form_name\"] || undefined,\n },\n userData,\n };\n\n // Page lifecycle\n case \"fynd_website.page.loaded\":\n return { type: \"track\", name: \"PageView\", params: {}, userData };\n\n default:\n // Ignore other events by default; you can add more mappings here\n return null;\n }\n}\n\n// ---------- Public API ----------\n/**\n * Initialize Meta tracking and tee into window.trackEvent so existing code just works.\n */\nexport function initMetaTracking(options: InitOptions = {}): void {\n const { enableAdvancedMatching = true, enableSpaPageViews = true, hasConsent } = options;\n\n // 1) Load fbq\n loadMetaPixel();\n\n // 2) Init with/without Advanced Matching\n const initialUser = enableAdvancedMatching ? getAdvancedUserFromJourney() : null;\n if (hasConsent && !hasConsent()) {\n // Defer init until consent flips to true (lightweight poller)\n const iv = window.setInterval(() => {\n if (hasConsent()) {\n window.clearInterval(iv);\n safeFbq(\"init\", META_PIXEL_ID, initialUser || {});\n postInit(enableSpaPageViews);\n }\n }, 250);\n } else {\n safeFbq(\"init\", META_PIXEL_ID, initialUser || {});\n postInit(enableSpaPageViews);\n }\n\n // 3) Tee into window.trackEvent to mirror to Meta\n const originalTrackEvent = window.trackEvent;\n window.trackEvent = function (eventName: string, properties?: any): void {\n try {\n // First, call original (so PostHog/GA remain unchanged)\n if (typeof originalTrackEvent === \"function\") {\n originalTrackEvent.call(window, eventName, properties);\n }\n // Then forward to Meta (respect consent if provided)\n if (hasConsent && !hasConsent()) return;\n\n const mapped = mapFyndToMeta(eventName, properties);\n if (!mapped) return;\n\n // Pass Advanced Matching userData by re-calling init? No\u2014Meta supports user data on event via fbq 2nd arg in init or as 'init' options.\n // For events, best practice is to include user data via \"Advanced Matching\" settings or CAPI.\n // Here we rely on init advanced matching; optionally, you can include userData with custom calls via setUserProperties (not available on Pixel).\n if (mapped.type === \"track\") {\n if (mapped.options?.eventID) {\n safeFbq(\"track\", mapped.name, mapped.params || {}, { eventID: mapped.options.eventID });\n } else {\n safeFbq(\"track\", mapped.name, mapped.params || {});\n }\n } else {\n // trackCustom\n // We cannot pass user data as a separate arg here; advanced matching should be handled at init or via CAPI.\n safeFbq(\"trackCustom\", mapped.name, mapped.params || {});\n }\n } catch (e) {\n // swallow to avoid interrupting primary trackers\n // eslint-disable-next-line no-console\n console.warn(\"Meta tracking error:\", e);\n }\n };\n}\n\n/**\n * Manually send a CompleteRegistration when your \u201Cform submitted\u201D is actually an account creation.\n * Reuse the same eventID for later CAPI dedup if you mirror server-side.\n */\nexport function trackCompleteRegistration(registrationMethod: string = \"email\", eventID?: string, props?: any) {\n const options = eventID ? { eventID } : undefined;\n // Respect optional consent gate if your app uses one:\n // if (window.__ad_consent !== 'granted') return;\n safeFbq(\"track\", \"CompleteRegistration\", { registration_method: registrationMethod }, options);\n}\n\n/**\n * Optional helper if you want to send a Lead directly (outside of window.trackEvent).\n */\nexport function trackLead(formId?: string, formName?: string, valueINR: number = 0, eventID?: string) {\n const params: Record<string, any> = { value: valueINR, currency: \"INR\" };\n if (formId) params.form_id = formId;\n if (formName) params.form_name = formName;\n const options = { eventID: eventID || genEventId(\"lead\") };\n safeFbq(\"track\", \"Lead\", params, options);\n}\n\n// ---------- Internal: post init tasks ----------\nfunction postInit(enableSpaPageViews: boolean) {\n // Fire initial PageView (Meta does this automatically when you call fbq('track','PageView')\u2014we mimic GA's $pageview behavior)\n safeFbq(\"track\", \"PageView\");\n\n if (enableSpaPageViews) {\n // Hook into history API to catch virtual route changes\n const origPushState = history.pushState;\n const origReplaceState = history.replaceState;\n\n function onLocationChange() {\n // Delay slightly to allow DOM/router to settle\n setTimeout(() => safeFbq(\"track\", \"PageView\"), 0);\n }\n\n history.pushState = function (...args: any[]) {\n const ret = origPushState.apply(this, args as any);\n onLocationChange();\n return ret;\n };\n\n history.replaceState = function (...args: any[]) {\n const ret = origReplaceState.apply(this, args as any);\n onLocationChange();\n return ret;\n };\n\n window.addEventListener(\"popstate\", onLocationChange);\n }\n}\n\n// ---------- (Optional) noscript pixel for non-JS fallbacks ----------\n// In your HTML <noscript>, add:\n// <img height=\"1\" width=\"1\" style=\"display:none\"\n// src=\"https://www.facebook.com/tr?id=2741377816069290&ev=PageView&noscript=1\"/>", "// main.ts \u2014 Core tracking: PostHog + GA (GTM dataLayer) + optional ad tracking bootstrap\nimport { FormDetails, UserJourney } from \"../utils/types/user-journey\";\nimport { AdConfig, initAdsTracking } from \"./adTracking\";\nimport { initGeneralAdsTracking } from \"./adtracking-general\";\nimport { initMetaTracking } from \"./meta-tracking\";\n\n// ---------- Types ----------\ninterface GTMEvent {\n event: string;\n event_category: string;\n event_label: string;\n form_id?: string;\n form_name?: string;\n form_first_name?: string;\n form_last_name?: string;\n form_email?: string;\n form_phone?: string;\n submitted_form?: string;\n [key: string]: any;\n}\n\ninterface GATrackingProperties {\n form_id?: string;\n form_name?: string;\n form_first_name?: string;\n form_last_name?: string;\n form_email?: string;\n form_phone?: string;\n submitted_form?: string;\n aidata_context?: string;\n aidata_platform?: string;\n aidata_type?: string;\n aidata_detection?: string;\n}\n\ninterface TrackingProperties {\n \"fynd_website.source_page\": string;\n \"fynd_website.product\": string;\n \"fynd_website.device_type\": string;\n \"fynd_website.utm_source\": string;\n \"fynd_website.utm_medium\": string;\n \"fynd_website.utm_campaign\": string;\n \"fynd_website.referrer\": string;\n \"fynd_website.form_id\"?: string;\n \"fynd_website.form_name\"?: string;\n \"fynd_website.form_first_name\"?: string;\n \"fynd_website.form_last_name\"?: string;\n \"fynd_website.form_email\"?: string;\n \"fynd_website.form_phone\"?: string;\n \"fynd_website.journey_total_pages\"?: number;\n \"fynd_website.journey_session_duration\"?: number;\n \"fynd_website.journey_first_page\"?: string;\n \"fynd_website.journey_current_page\"?: string;\n \"fynd_website.journey_device\"?: string;\n \"fynd_website.journey_browser\"?: string;\n \"fynd_website.journey_device_name\"?: string;\n \"fynd_website.journey_origin\"?: string;\n \"fynd_website.journey_touchpoints\"?: any;\n \"fynd_website.journey_touchpoints_count\"?: number;\n \"fynd_website.journey_utm_path\"?: string;\n \"fynd_website.journey_entry_time\"?: string;\n \"fynd_website.journey_exit_time\"?: string;\n \"fynd_website.journey_scroll_depth\"?: number;\n \"fynd_website.aidata_context\"?: string;\n \"fynd_website.aidata_platform\"?: string;\n \"fynd_website.aidata_type\"?: string;\n \"fynd_website.aidata_detection\"?: string;\n submitted_form?: string;\n field_type?: string;\n field_name?: string;\n [key: string]: any;\n}\n\ndeclare global {\n interface Window {\n trackEvent: (eventName: string, properties?: any) => void;\n getPosthogTrackingProperties: () => TrackingProperties;\n getGaTrackingProperties: () => GATrackingProperties;\n validationPassed?: boolean;\n getUserJourney: () => UserJourney | null;\n dataLayer?: GTMEvent[];\n }\n}\n\n// ---------- GA helpers ----------\nconst getGaTrackingProperties = (): GATrackingProperties => {\n const gaProperties: GATrackingProperties = {};\n try {\n let journey: any = null;\n if (typeof (window as any).getUserJourney === \"function\") {\n journey = (window as any).getUserJourney();\n }\n if (!journey) {\n const storedData = localStorage.getItem(\"userJourney\");\n if (storedData) journey = JSON.parse(storedData);\n }\n\n if (journey?.formDetails) {\n const formDetails: FormDetails = journey.formDetails;\n if (formDetails.formId) gaProperties.form_id = formDetails.formId;\n if (formDetails.formName) gaProperties.form_name = formDetails.formName;\n if (formDetails.firstName) gaProperties.form_first_name = formDetails.firstName;\n if (formDetails.lastName) gaProperties.form_last_name = formDetails.lastName;\n if (formDetails.email) gaProperties.form_email = formDetails.email;\n if (formDetails.phone) gaProperties.form_phone = formDetails.phone;\n }\n\n if (journey?.aiData) {\n const aiData = journey.aiData;\n if (aiData.context) gaProperties.aidata_context = aiData.context;\n if (aiData.platform) gaProperties.aidata_platform = aiData.platform;\n if (aiData.type) gaProperties.aidata_type = aiData.type;\n if (aiData.detectionMethod) gaProperties.aidata_detection = aiData.detectionMethod;\n }\n } catch (err) {\n console.warn(\"Error getting user journey data for GA tracking:\", err);\n }\n return gaProperties;\n};\n\n// ---------- PostHog properties ----------\nconst getPosthogTrackingProperties = (): TrackingProperties => {\n const pathname: string = window.location.pathname;\n\n const base: TrackingProperties = {\n \"fynd_website.source_page\": pathname,\n \"fynd_website.product\": \"fynd.com website\",\n \"fynd_website.device_type\": \"Unknown\",\n \"fynd_website.utm_source\": new URLSearchParams(window.location.search).get(\"utm_source\") || \"\",\n \"fynd_website.utm_medium\": new URLSearchParams(window.location.search).get(\"utm_medium\") || \"\",\n \"fynd_website.utm_campaign\": new URLSearchParams(window.location.search).get(\"utm_campaign\") || \"\",\n \"fynd_website.referrer\": document.referrer,\n };\n\n try {\n let journey: any = null;\n if (typeof (window as any).getUserJourney === \"function\") {\n journey = (window as any).getUserJourney();\n }\n if (!journey) {\n const storedData = localStorage.getItem(\"userJourney\");\n if (storedData) journey = JSON.parse(storedData);\n }\n\n if (journey) {\n base[\"fynd_website.journey_touchpoints\"] = journey.userJourney || journey;\n\n if (journey.formDetails) {\n const f: FormDetails = journey.formDetails;\n if (f.formId) base[\"fynd_website.form_id\"] = f.formId;\n if (f.formName) base[\"fynd_website.form_name\"] = f.formName;\n if (f.firstName) base[\"fynd_website.form_first_name\"] = f.firstName;\n if (f.lastName) base[\"fynd_website.form_last_name\"] = f.lastName;\n if (f.email) base[\"fynd_website.form_email\"] = f.email;\n if (f.phone) base[\"fynd_website.form_phone\"] = f.phone;\n }\n\n if (journey.userJourney?.length > 0) {\n base[\"fynd_website.journey_total_pages\"] = journey.userJourney.length;\n base[\"fynd_website.journey_touchpoints_count\"] = journey.userJourney.length;\n base[\"fynd_website.journey_first_page\"] = journey.userJourney[0].page;\n base[\"fynd_website.journey_current_page\"] =\n journey.userJourney[journey.userJourney.length - 1].page;\n\n const firstVisit = new Date(journey.userJourney[0].time);\n const lastVisit = new Date(journey.userJourney[journey.userJourney.length - 1].time);\n base[\"fynd_website.journey_session_duration\"] = Math.floor(\n (lastVisit.getTime() - firstVisit.getTime()) / 1000\n );\n base[\"fynd_website.journey_entry_time\"] = journey.userJourney[0].time;\n base[\"fynd_website.journey_exit_time\"] =\n journey.userJourney[journey.userJourney.length - 1].time;\n }\n\n if (journey.deviceCategory) base[\"fynd_website.device_type\"] = journey.deviceCategory;\n if (journey.browser) base[\"fynd_website.journey_browser\"] = journey.browser;\n if (journey.device) base[\"fynd_website.journey_device\"] = journey.device;\n if (journey.origin) base[\"fynd_website.journey_origin\"] = journey.origin;\n if (journey.utmPath) base[\"fynd_website.journey_utm_path\"] = journey.utmPath;\n if (journey.scrollDepth) base[\"fynd_website.journey_scroll_depth\"] = journey.scrollDepth;\n\n if (journey.aiData) {\n const aiData = journey.aiData;\n if (aiData.context) base[\"fynd_website.aidata_context\"] = aiData.context;\n if (aiData.platform) base[\"fynd_website.aidata_platform\"] = aiData.platform;\n if (aiData.type) base[\"fynd_website.aidata_type\"] = aiData.type;\n if (aiData.detectionMethod) base[\"fynd_website.aidata_detection\"] = aiData.detectionMethod;\n }\n }\n } catch (err) {\n console.warn(\"Error getting user journey data for tracking:\", err);\n }\n\n // Fallback device type\n if (base[\"fynd_website.device_type\"] === \"Unknown\") {\n const ua = navigator.userAgent;\n if (/iPad/.test(ua) || (/Android/.test(ua) && !/Mobile/.test(ua)) || /Tablet/.test(ua)) {\n base[\"fynd_website.device_type\"] = \"Tablet\";\n } else if (/Mobile|iPhone|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop/.test(ua)) {\n base[\"fynd_website.device_type\"] = \"Mobile\";\n } else {\n base[\"fynd_website.device_type\"] = \"Desktop\";\n }\n }\n\n // ---------- UUID from cookie ----------\n try {\n const cookieMatch = document.cookie.match(/(?:^|;\\s*)user-id=([^;]*)/);\n base[\"fynd_website.uuid\"] = cookieMatch ? decodeURIComponent(cookieMatch[1]) : null;\n } catch (err) {\n console.warn(\"Error reading user-id cookie:\", err);\n base[\"fynd_website.uuid\"] = null;\n }\n\n return base;\n};\n\n// ---------- GA send ----------\nconst sendToGA = (eventName: string, gaProps: GATrackingProperties, additionalProps?: any): void => {\n if ((window as any).dataLayer) {\n const eventData: GTMEvent = {\n event: eventName,\n event_category: \"form_interaction\",\n event_label: eventName,\n ...gaProps,\n };\n if (additionalProps?.submitted_form) {\n eventData.submitted_form = additionalProps.submitted_form;\n }\n (window as any).dataLayer.push(eventData);\n } else {\n console.warn(\"dataLayer not available for GA tracking\");\n }\n};\n\n// ---------- Public trackEvent ----------\nconst trackEvent = (eventName: string, properties?: Partial<TrackingProperties>): void => {\n try {\n const baseProps = getPosthogTrackingProperties();\n const finalProps = properties ? { ...baseProps, ...properties } : baseProps;\n\n if ((window as any).posthog) {\n const captureProps: any = { ...finalProps };\n\n // If this is a form submission event, add person properties\n if (eventName === \"fynd_website.form.submitted\") {\n try {\n const journey = (window as any).getUserJourney?.() ||\n JSON.parse(localStorage.getItem(\"userJourney\") || \"{}\");\n\n const personProps: { [key: string]: any } = {};\n\n if (journey?.formDetails?.firstName) {\n personProps[\"name\"] = journey.formDetails.firstName;\n }\n if (journey?.formDetails?.email) {\n personProps[\"email\"] = journey.formDetails.email;\n }\n if (journey?.formDetails?.phone) {\n personProps[\"mobile\"] = journey.formDetails.phone;\n }\n\n if (Object.keys(personProps).length > 0) {\n captureProps[\"$set\"] = personProps;\n }\n } catch (err) {\n console.warn(\"Error extracting person properties:\", err);\n }\n }\n\n (window as any).posthog.capture(eventName, captureProps);\n }\n\n const gaProps = getGaTrackingProperties();\n const hasAIData =\n gaProps.aidata_context || gaProps.aidata_platform || gaProps.aidata_type || gaProps.aidata_detection;\n\n const isFormRelatedEvent =\n eventName.includes(\"form\") ||\n Object.keys(gaProps).length > 0 ||\n properties?.submitted_form ||\n !!hasAIData;\n\n if (isFormRelatedEvent) {\n sendToGA(eventName, gaProps, properties);\n }\n } catch (error) {\n console.error(\"Error tracking event:\", error);\n }\n};\n\n// ---------- Shared helpers ----------\nconst getParentFormName = (element: HTMLElement): string | null => {\n const parentForm = element.closest(\"form\") as HTMLFormElement | null;\n if (!parentForm) return null;\n return (\n parentForm.getAttribute(\"data-name\") ||\n parentForm.getAttribute(\"name\") ||\n parentForm.id ||\n null\n );\n};\n\n// ---------- Page lifecycle ----------\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n const props = getPosthogTrackingProperties();\n if ((window as any).posthog) {\n (window as any).posthog.capture(\"$pageview\", props);\n }\n});\n\nwindow.addEventListener(\"load\", () => {\n trackEvent(\"fynd_website.page.loaded\");\n});\n\n// ---------- Base site interactions ----------\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n const signUpButtons = document.querySelectorAll('[data-ph=\"sign-up\"]');\n const signInButtons = document.querySelectorAll('[data-ph=\"sign-in\"]');\n const scrollToFormButtons = document.querySelectorAll('[href=\"#footer-form\"]');\n const bookADemoButtons = document.querySelectorAll('[data-ph=\"book-a-demo\"]');\n const callButtons = document.querySelectorAll('[data-ph=\"call\"]');\n const submitButtons = document.querySelectorAll('[type=\"submit\"]');\n\n submitButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (this: HTMLElement): void {\n const formName = getParentFormName(this);\n setTimeout(() => {\n if (window.validationPassed === true) {\n const additionalProps = formName ? { submitted_form: formName } : {};\n trackEvent(\"fynd_website.form.submitted\", additionalProps);\n }\n }, 10);\n });\n });\n\n signUpButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.sign_up.clicked\"));\n });\n\n signInButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.sign_in.clicked\"));\n });\n\n scrollToFormButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.scroll_to_form.clicked\"));\n });\n\n bookADemoButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.book_a_demo.clicked\"));\n });\n\n callButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.call.clicked\"));\n });\n\n // Form started\n const formFields = document.querySelectorAll<HTMLElement>(\"[ph-form-field]\");\n const triggeredForms = new Set<string>();\n\n const handleFormStarted = function (this: HTMLElement): void {\n const formName = getParentFormName(this);\n const formIdentifier = formName || \"unknown-form\";\n if (!triggeredForms.has(formIdentifier)) {\n triggeredForms.add(formIdentifier);\n trackEvent(\"fynd_website.form.started\");\n }\n };\n\n formFields.forEach((field) => {\n const tagName = field.tagName.toLowerCase();\n const inputType = (field as HTMLInputElement).type?.toLowerCase();\n\n if (!(tagName === \"button\" || (tagName === \"input\" && inputType === \"submit\"))) {\n field.addEventListener(\"focus\", handleFormStarted);\n }\n if (tagName === \"button\" || (tagName === \"input\" && inputType === \"submit\")) {\n field.addEventListener(\"click\", handleFormStarted);\n } else if (tagName === \"select\") {\n field.addEventListener(\"change\", handleFormStarted);\n } else {\n field.addEventListener(\"input\", handleFormStarted);\n }\n });\n});\n\n// ---------- Expose globals ----------\nwindow.getPosthogTrackingProperties = getPosthogTrackingProperties;\nwindow.trackEvent = trackEvent;\nwindow.getGaTrackingProperties = getGaTrackingProperties;\n\n// ---------- Optional: bootstrap ad tracking here ----------\n// const AD_CONFIGS: AdConfig[] = [\n// { adPageSlug: \"/solutions/transport-management-system\", adEventExtension: \"tms\", adUTMCampaign: \"tms\", },\n// ];\n// initAdsTracking(AD_CONFIGS);\ninitGeneralAdsTracking();\n\ninitMetaTracking({\n enableAdvancedMatching: true, // pulls user data from your journey store when available\n enableSpaPageViews: true, // fires PageView on virtual navigations\n hasConsent: () => (window as any).__ad_consent === \"granted\" || true, // replace with your consent logic\n});\n\n// ---------- Exports ----------\nexport {\n getPosthogTrackingProperties,\n getGaTrackingProperties,\n trackEvent,\n getParentFormName,\n type TrackingProperties,\n type GATrackingProperties,\n type GTMEvent,\n};"],
|
|
5
|
-
"mappings": ";;;AACA,MACE,OAAO,SAAS,aAAa,eAC7B,OAAO,SAAS,aAAa,aAC7B;AACA,QAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,MAAiB;AAAA,MAAU,MACpE,SAAS,OAAO;AAAA,IAClB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;AAC3E,UAAM,iBAAiB,oBAAI,IAAY;AAEvC,UAAM,oBAAoB,WAAmC;AAC3D,YAAM,WAAWA,mBAAkB,IAAI;AACvC,YAAM,iBAAiB,YAAY;AACnC,UAAI,CAAC,eAAe,IAAI,cAAc,GAAG;AACvC,uBAAe,IAAI,cAAc;AACjC,mBAAW,2BAA2B;AAAA,MACxC;AAAA,IACF;AAEA,eAAW,QAAQ,CAAC,UAAU;AAC5B,YAAM,UAAU,MAAM,QAAQ,YAAY;AAC1C,YAAM,YAAa,MAA2B,MAAM,YAAY;AAEhE,UAAI,EAAE,YAAY,YAAa,YAAY,WAAW,cAAc,WAAY;AAC9E,cAAM,iBAAiB,SAAS,iBAAiB;AAAA,MACnD;AACA,UAAI,YAAY,YAAa,YAAY,WAAW,cAAc,UAAW;AAC3E,cAAM,iBAAiB,SAAS,iBAAiB;AAAA,MACnD,WAAW,YAAY,UAAU;AAC/B,cAAM,iBAAiB,UAAU,iBAAiB;AAAA,MACpD,OAAO;AACL,cAAM,iBAAiB,SAAS,iBAAiB;AAAA,MACnD;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAGD,SAAO,+BAA+B;AACtC,SAAO,aAAa;AACpB,SAAO,0BAA0B;AAOjC,yBAAuB;AAEvB,mBAAiB;AAAA,IACf,wBAAwB;AAAA;AAAA,IACxB,oBAAoB;AAAA;AAAA,IACpB,YAAY,MAAO,OAAe,iBAAiB,aAAa;AAAA;AAAA,EAClE,CAAC;",
|
|
4
|
+
"sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n // console.log(\"Live reload disabled: not running on localhost\");\n}\n", "// adTracking.general.ts \u2014 General ad events for paid traffic (utm_medium=cpc|ads)\n\ndeclare global {\n interface Window {\n trackEvent: (eventName: string, properties?: any) => void;\n validationPassed?: boolean;\n __adsTrackingInitializedGeneral?: boolean;\n }\n }\n \n const getSearchParam = (name: string): string | null => {\n const v = new URLSearchParams(window.location.search).get(name);\n return v ? v.trim() : null;\n };\n \n const isAdTraffic = (): boolean => {\n const medium = getSearchParam(\"utm_medium\")?.toLowerCase();\n return medium === \"cpc\" || medium === \"ads\";\n };\n \n const AD_EVENT_PREFIX = \"fynd_website_ad.\";\n const makeEvent = (suffix: string) => `${AD_EVENT_PREFIX}${suffix}`;\n \n // helper: find nearest form and get a friendly name\n const getParentFormName = (element: HTMLElement): string | null => {\n const parentForm = element.closest(\"form\") as HTMLFormElement | null;\n if (!parentForm) return null;\n return (\n parentForm.getAttribute(\"data-name\") ||\n parentForm.getAttribute(\"name\") ||\n parentForm.id ||\n null\n );\n };\n \n /**\n * Initialize general ads tracking.\n * Fires only when utm_medium is \"cpc\" or \"ads\".\n * Adds `fynd_website.current_page` = current page path.\n */\n export const initGeneralAdsTracking = () => {\n if (window.__adsTrackingInitializedGeneral) return;\n if (!isAdTraffic()) return;\n \n window.__adsTrackingInitializedGeneral = true;\n \n const baseProps: Record<string, any> = {\n \"fynd_website.current_page\": window.location.pathname,\n };\n \n const emit = (suffix: string, props?: Record<string, any>) => {\n const name = makeEvent(suffix);\n window.trackEvent?.(name, { ...baseProps, ...(props || {}) });\n };\n \n document.addEventListener(\"DOMContentLoaded\", () => {\n // Buttons\n document.querySelectorAll('[data-ph=\"sign-up\"]').forEach((btn) =>\n btn.addEventListener(\"click\", () => emit(\"sign_up.clicked\"))\n );\n document.querySelectorAll('[data-ph=\"sign-in\"]').forEach((btn) =>\n btn.addEventListener(\"click\", () => emit(\"sign_in.clicked\"))\n );\n document.querySelectorAll('[data-ph=\"book-a-demo\"]').forEach((btn) =>\n btn.addEventListener(\"click\", () => emit(\"book_a_demo.clicked\"))\n );\n \n // Form started\n const formFields = document.querySelectorAll<HTMLElement>(\"[ph-form-field]\");\n const triggeredForms = new Set<string>();\n \n const handleFormStarted = function (this: HTMLElement) {\n const formName = getParentFormName(this) || \"unknown-form\";\n if (!triggeredForms.has(formName)) {\n triggeredForms.add(formName);\n emit(\"form.started\", { started_form: formName });\n }\n };\n \n formFields.forEach((field) => {\n const tag = field.tagName.toLowerCase();\n const type = (field as HTMLInputElement).type?.toLowerCase();\n \n if (!(tag === \"button\" || (tag === \"input\" && type === \"submit\"))) {\n field.addEventListener(\"focus\", handleFormStarted);\n }\n if (tag === \"button\" || (tag === \"input\" && type === \"submit\")) {\n field.addEventListener(\"click\", handleFormStarted);\n } else if (tag === \"select\") {\n field.addEventListener(\"change\", handleFormStarted);\n } else {\n field.addEventListener(\"input\", handleFormStarted);\n }\n });\n \n // Form submitted\n document.querySelectorAll('[type=\"submit\"]').forEach((button) => {\n button.addEventListener(\"click\", function (this: HTMLElement) {\n const formName = getParentFormName(this);\n setTimeout(() => {\n if (window.validationPassed === true) {\n const props = formName ? { submitted_form: formName } : {};\n emit(\"form.submitted\", props);\n }\n }, 10);\n });\n });\n });\n };", "// meta-tracking.ts \u2014 Meta Pixel integration (standards-compliant) for Fynd website\n// - Initializes Meta Pixel (fbq) with Advanced Matching (when available)\n// - Mirrors your existing window.trackEvent() calls to Meta events\n// - Maps Fynd events -> Meta standard/custom events for better optimization\n// - Adds SPA PageView handling + eventID generation for future CAPI dedup\n// - Safe to import once anywhere in your app bootstrap\n\nimport { UserJourney } from \"../utils/types/user-journey\";\n\n// ---------- Config ----------\nconst META_PIXEL_ID = \"2741377816069290\";\n\ntype AdvancedUser = {\n email?: string;\n phone?: string;\n first_name?: string;\n last_name?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n external_id?: string;\n};\n\ntype InitOptions = {\n /**\n * If true, attempts to pull user info from window.getUserJourney/sessionStorage\n * and pass as Advanced Matching data (improves match rate for retargeting).\n */\n enableAdvancedMatching?: boolean;\n\n /**\n * If true, listens for SPA route changes and fires PageView on history changes.\n * Set true if you use a client-side router.\n */\n enableSpaPageViews?: boolean;\n\n /**\n * Optional predicate: return false to block Meta calls until consent is granted.\n * Example: () => window.__ad_consent === 'granted'\n */\n hasConsent?: () => boolean;\n};\n\n// ---------- fbq bootstrap ----------\ndeclare global {\n interface Window {\n fbq?: (...args: any[]) => void;\n _fbq?: any;\n trackEvent: (eventName: string, properties?: any) => void;\n getUserJourney: () => UserJourney | null;\n }\n}\n\nfunction loadMetaPixel(): void {\n if (typeof window === \"undefined\") return;\n if (window.fbq) return;\n\n (function (f: any, b: any, e: any, v: any, n?: any, t?: any, s?: any) {\n if (f.fbq) return;\n n = f.fbq = function () {\n (n as any).callMethod ? (n as any).callMethod.apply(n, arguments) : (n as any).queue.push(arguments);\n };\n if (!f._fbq) f._fbq = n;\n (n as any).push = (n as any);\n (n as any).loaded = true;\n (n as any).version = \"2.0\";\n (n as any).queue = [];\n t = b.createElement(e);\n t.async = true;\n t.src = \"https://connect.facebook.net/en_US/fbevents.js\";\n s = b.getElementsByTagName(e)[0];\n s.parentNode!.insertBefore(t, s);\n })(window, document, \"script\", undefined);\n}\n\n// ---------- Advanced Matching helpers ----------\nfunction getAdvancedUserFromJourney(): AdvancedUser | null {\n try {\n let journey: any = null;\n if (typeof window.getUserJourney === \"function\") {\n journey = window.getUserJourney();\n }\n if (!journey) {\n const stored = sessionStorage.getItem(\"userJourney\");\n if (stored) journey = JSON.parse(stored);\n }\n\n const u: AdvancedUser = {};\n const fd = journey?.formDetails;\n if (fd?.email) u.email = fd.email;\n if (fd?.phone) u.phone = fd.phone;\n if (fd?.firstName) u.first_name = fd.firstName;\n if (fd?.lastName) u.last_name = fd.lastName;\n if (fd?.city) u.city = fd.city;\n if (fd?.state) u.state = fd.state;\n if (fd?.zip) u.zip = fd.zip;\n if (journey?.country) u.country = journey.country;\n if (journey?.userId) u.external_id = String(journey.userId);\n\n // Remove empties\n Object.keys(u).forEach((k) => {\n const key = k as keyof AdvancedUser;\n if (!u[key]) delete u[key];\n });\n\n return Object.keys(u).length ? u : null;\n } catch {\n return null;\n }\n}\n\nfunction getAdvancedUserFromProps(props?: any): AdvancedUser | null {\n if (!props) return null;\n const u: AdvancedUser = {};\n if (props[\"fynd_website.form_email\"]) u.email = props[\"fynd_website.form_email\"];\n if (props[\"fynd_website.form_phone\"]) u.phone = props[\"fynd_website.form_phone\"];\n if (props[\"fynd_website.form_first_name\"]) u.first_name = props[\"fynd_website.form_first_name\"];\n if (props[\"fynd_website.form_last_name\"]) u.last_name = props[\"fynd_website.form_last_name\"];\n if (props.city) u.city = props.city;\n if (props.state) u.state = props.state;\n if (props.zip) u.zip = props.zip;\n if (props.country) u.country = props.country;\n if (props.external_id) u.external_id = props.external_id;\n\n Object.keys(u).forEach((k) => {\n const key = k as keyof AdvancedUser;\n if (!u[key]) delete u[key];\n });\n\n return Object.keys(u).length ? u : null;\n}\n\n// ---------- Utility ----------\nfunction genEventId(prefix: string = \"evt\"): string {\n return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2)}`;\n}\n\nfunction safeFbq(...args: any[]): void {\n if (!window.fbq) return;\n window.fbq(...args);\n}\n\n// ---------- Core mapping (Fynd -> Meta) ----------\n/**\n * Maps your event names to Meta\u2019s recommended events.\n * Returns {name, params, options} ready for fbq('track'|'trackCustom', ...)\n */\nfunction mapFyndToMeta(eventName: string, properties?: any): {\n type: \"track\" | \"trackCustom\";\n name: string;\n params?: Record<string, any>;\n options?: { eventID?: string };\n userData?: AdvancedUser | null;\n} | null {\n const props = properties || {};\n // Try to extract user for Advanced Matching\n const userData = getAdvancedUserFromProps(props) || getAdvancedUserFromJourney();\n\n switch (eventName) {\n case \"fynd_website.form.submitted\": {\n // Choose 'Lead' as default (use CompleteRegistration for account creation flows)\n const eventID = props.event_id || genEventId(\"lead\");\n const formName = props.submitted_form || props[\"fynd_website.form_name\"] || \"unknown_form\";\n return {\n type: \"track\",\n name: \"Lead\",\n params: {\n form_id: props[\"fynd_website.form_id\"] || undefined,\n form_name: formName,\n value: 0,\n currency: \"INR\",\n },\n options: { eventID },\n userData,\n };\n }\n\n case \"fynd_website.sign_up.clicked\":\n return { type: \"trackCustom\", name: \"SignUpClick\", params: {}, userData };\n\n case \"fynd_website.sign_in.clicked\":\n return { type: \"trackCustom\", name: \"SignInClick\", params: {}, userData };\n\n case \"fynd_website.book_a_demo.clicked\":\n return {\n type: \"trackCustom\",\n name: \"BookDemoClick\",\n params: {\n source_page: props?.[\"fynd_website.source_page\"],\n },\n userData,\n };\n\n case \"fynd_website.form.started\":\n return {\n type: \"trackCustom\",\n name: \"FormStarted\",\n params: {\n form_id: props?.[\"fynd_website.form_id\"] || undefined,\n form_name: props?.[\"fynd_website.form_name\"] || undefined,\n },\n userData,\n };\n\n // Page lifecycle\n case \"fynd_website.page.loaded\":\n return { type: \"track\", name: \"PageView\", params: {}, userData };\n\n default:\n // Ignore other events by default; you can add more mappings here\n return null;\n }\n}\n\n// ---------- Public API ----------\n/**\n * Initialize Meta tracking and tee into window.trackEvent so existing code just works.\n */\nexport function initMetaTracking(options: InitOptions = {}): void {\n const { enableAdvancedMatching = true, enableSpaPageViews = true, hasConsent } = options;\n\n // 1) Load fbq\n loadMetaPixel();\n\n // 2) Init with/without Advanced Matching\n const initialUser = enableAdvancedMatching ? getAdvancedUserFromJourney() : null;\n if (hasConsent && !hasConsent()) {\n // Defer init until consent flips to true (lightweight poller)\n const iv = window.setInterval(() => {\n if (hasConsent()) {\n window.clearInterval(iv);\n safeFbq(\"init\", META_PIXEL_ID, initialUser || {});\n postInit(enableSpaPageViews);\n }\n }, 250);\n } else {\n safeFbq(\"init\", META_PIXEL_ID, initialUser || {});\n postInit(enableSpaPageViews);\n }\n\n // 3) Tee into window.trackEvent to mirror to Meta\n const originalTrackEvent = window.trackEvent;\n window.trackEvent = function (eventName: string, properties?: any): void {\n try {\n // First, call original (so PostHog/GA remain unchanged)\n if (typeof originalTrackEvent === \"function\") {\n originalTrackEvent.call(window, eventName, properties);\n }\n // Then forward to Meta (respect consent if provided)\n if (hasConsent && !hasConsent()) return;\n\n const mapped = mapFyndToMeta(eventName, properties);\n if (!mapped) return;\n\n // Pass Advanced Matching userData by re-calling init? No\u2014Meta supports user data on event via fbq 2nd arg in init or as 'init' options.\n // For events, best practice is to include user data via \"Advanced Matching\" settings or CAPI.\n // Here we rely on init advanced matching; optionally, you can include userData with custom calls via setUserProperties (not available on Pixel).\n if (mapped.type === \"track\") {\n if (mapped.options?.eventID) {\n safeFbq(\"track\", mapped.name, mapped.params || {}, { eventID: mapped.options.eventID });\n } else {\n safeFbq(\"track\", mapped.name, mapped.params || {});\n }\n } else {\n // trackCustom\n // We cannot pass user data as a separate arg here; advanced matching should be handled at init or via CAPI.\n safeFbq(\"trackCustom\", mapped.name, mapped.params || {});\n }\n } catch (e) {\n // swallow to avoid interrupting primary trackers\n // eslint-disable-next-line no-console\n console.warn(\"Meta tracking error:\", e);\n }\n };\n}\n\n/**\n * Manually send a CompleteRegistration when your \u201Cform submitted\u201D is actually an account creation.\n * Reuse the same eventID for later CAPI dedup if you mirror server-side.\n */\nexport function trackCompleteRegistration(registrationMethod: string = \"email\", eventID?: string, props?: any) {\n const options = eventID ? { eventID } : undefined;\n // Respect optional consent gate if your app uses one:\n // if (window.__ad_consent !== 'granted') return;\n safeFbq(\"track\", \"CompleteRegistration\", { registration_method: registrationMethod }, options);\n}\n\n/**\n * Optional helper if you want to send a Lead directly (outside of window.trackEvent).\n */\nexport function trackLead(formId?: string, formName?: string, valueINR: number = 0, eventID?: string) {\n const params: Record<string, any> = { value: valueINR, currency: \"INR\" };\n if (formId) params.form_id = formId;\n if (formName) params.form_name = formName;\n const options = { eventID: eventID || genEventId(\"lead\") };\n safeFbq(\"track\", \"Lead\", params, options);\n}\n\n// ---------- Internal: post init tasks ----------\nfunction postInit(enableSpaPageViews: boolean) {\n // Fire initial PageView (Meta does this automatically when you call fbq('track','PageView')\u2014we mimic GA's $pageview behavior)\n safeFbq(\"track\", \"PageView\");\n\n if (enableSpaPageViews) {\n // Hook into history API to catch virtual route changes\n const origPushState = history.pushState;\n const origReplaceState = history.replaceState;\n\n function onLocationChange() {\n // Delay slightly to allow DOM/router to settle\n setTimeout(() => safeFbq(\"track\", \"PageView\"), 0);\n }\n\n history.pushState = function (...args: any[]) {\n const ret = origPushState.apply(this, args as any);\n onLocationChange();\n return ret;\n };\n\n history.replaceState = function (...args: any[]) {\n const ret = origReplaceState.apply(this, args as any);\n onLocationChange();\n return ret;\n };\n\n window.addEventListener(\"popstate\", onLocationChange);\n }\n}\n\n// ---------- (Optional) noscript pixel for non-JS fallbacks ----------\n// In your HTML <noscript>, add:\n// <img height=\"1\" width=\"1\" style=\"display:none\"\n// src=\"https://www.facebook.com/tr?id=2741377816069290&ev=PageView&noscript=1\"/>", "// main.ts \u2014 Core tracking: PostHog + GA (GTM dataLayer) + optional ad tracking bootstrap\nimport { FormDetails, UserJourney } from \"../utils/types/user-journey\";\nimport { AdConfig, initAdsTracking } from \"./adTracking\";\nimport { initGeneralAdsTracking } from \"./adtracking-general\";\nimport { initMetaTracking } from \"./meta-tracking\";\n\n// ---------- Types ----------\ninterface GTMEvent {\n event: string;\n event_category: string;\n event_label: string;\n form_id?: string;\n form_name?: string;\n form_first_name?: string;\n form_last_name?: string;\n form_email?: string;\n form_phone?: string;\n submitted_form?: string;\n [key: string]: any;\n}\n\ninterface GATrackingProperties {\n form_id?: string;\n form_name?: string;\n form_first_name?: string;\n form_last_name?: string;\n form_email?: string;\n form_phone?: string;\n submitted_form?: string;\n aidata_context?: string;\n aidata_platform?: string;\n aidata_type?: string;\n aidata_detection?: string;\n}\n\ninterface TrackingProperties {\n \"fynd_website.source_page\": string;\n \"fynd_website.product\": string;\n \"fynd_website.device_type\": string;\n \"fynd_website.utm_source\": string;\n \"fynd_website.utm_medium\": string;\n \"fynd_website.utm_campaign\": string;\n \"fynd_website.referrer\": string;\n \"fynd_website.form_id\"?: string;\n \"fynd_website.form_name\"?: string;\n \"fynd_website.form_first_name\"?: string;\n \"fynd_website.form_last_name\"?: string;\n \"fynd_website.form_email\"?: string;\n \"fynd_website.form_phone\"?: string;\n \"fynd_website.journey_total_pages\"?: number;\n \"fynd_website.journey_session_duration\"?: number;\n \"fynd_website.journey_first_page\"?: string;\n \"fynd_website.journey_current_page\"?: string;\n \"fynd_website.journey_device\"?: string;\n \"fynd_website.journey_browser\"?: string;\n \"fynd_website.journey_device_name\"?: string;\n \"fynd_website.journey_origin\"?: string;\n \"fynd_website.journey_touchpoints\"?: any;\n \"fynd_website.journey_touchpoints_count\"?: number;\n \"fynd_website.journey_utm_path\"?: string;\n \"fynd_website.journey_entry_time\"?: string;\n \"fynd_website.journey_exit_time\"?: string;\n \"fynd_website.journey_scroll_depth\"?: number;\n \"fynd_website.aidata_context\"?: string;\n \"fynd_website.aidata_platform\"?: string;\n \"fynd_website.aidata_type\"?: string;\n \"fynd_website.aidata_detection\"?: string;\n submitted_form?: string;\n field_type?: string;\n field_name?: string;\n [key: string]: any;\n}\n\ndeclare global {\n interface Window {\n trackEvent: (eventName: string, properties?: any) => void;\n getPosthogTrackingProperties: () => TrackingProperties;\n getGaTrackingProperties: () => GATrackingProperties;\n validationPassed?: boolean;\n getUserJourney: () => UserJourney | null;\n dataLayer?: GTMEvent[];\n }\n}\n\n// ---------- GA helpers ----------\nconst getGaTrackingProperties = (): GATrackingProperties => {\n const gaProperties: GATrackingProperties = {};\n try {\n let journey: any = null;\n if (typeof (window as any).getUserJourney === \"function\") {\n journey = (window as any).getUserJourney();\n }\n if (!journey) {\n const storedData = localStorage.getItem(\"userJourney\");\n if (storedData) journey = JSON.parse(storedData);\n }\n\n if (journey?.formDetails) {\n const formDetails: FormDetails = journey.formDetails;\n if (formDetails.formId) gaProperties.form_id = formDetails.formId;\n if (formDetails.formName) gaProperties.form_name = formDetails.formName;\n if (formDetails.firstName) gaProperties.form_first_name = formDetails.firstName;\n if (formDetails.lastName) gaProperties.form_last_name = formDetails.lastName;\n if (formDetails.email) gaProperties.form_email = formDetails.email;\n if (formDetails.phone) gaProperties.form_phone = formDetails.phone;\n }\n\n if (journey?.aiData) {\n const aiData = journey.aiData;\n if (aiData.context) gaProperties.aidata_context = aiData.context;\n if (aiData.platform) gaProperties.aidata_platform = aiData.platform;\n if (aiData.type) gaProperties.aidata_type = aiData.type;\n if (aiData.detectionMethod) gaProperties.aidata_detection = aiData.detectionMethod;\n }\n } catch (err) {\n console.warn(\"Error getting user journey data for GA tracking:\", err);\n }\n return gaProperties;\n};\n\n// ---------- PostHog properties ----------\nconst getPosthogTrackingProperties = (): TrackingProperties => {\n const pathname: string = window.location.pathname;\n\n const base: TrackingProperties = {\n \"fynd_website.source_page\": pathname,\n \"fynd_website.product\": \"fynd.com website\",\n \"fynd_website.device_type\": \"Unknown\",\n \"fynd_website.utm_source\": new URLSearchParams(window.location.search).get(\"utm_source\") || \"\",\n \"fynd_website.utm_medium\": new URLSearchParams(window.location.search).get(\"utm_medium\") || \"\",\n \"fynd_website.utm_campaign\": new URLSearchParams(window.location.search).get(\"utm_campaign\") || \"\",\n \"fynd_website.referrer\": document.referrer,\n };\n\n try {\n let journey: any = null;\n if (typeof (window as any).getUserJourney === \"function\") {\n journey = (window as any).getUserJourney();\n }\n if (!journey) {\n const storedData = localStorage.getItem(\"userJourney\");\n if (storedData) journey = JSON.parse(storedData);\n }\n\n if (journey) {\n base[\"fynd_website.journey_touchpoints\"] = journey.userJourney || journey;\n\n if (journey.formDetails) {\n const f: FormDetails = journey.formDetails;\n if (f.formId) base[\"fynd_website.form_id\"] = f.formId;\n if (f.formName) base[\"fynd_website.form_name\"] = f.formName;\n if (f.firstName) base[\"fynd_website.form_first_name\"] = f.firstName;\n if (f.lastName) base[\"fynd_website.form_last_name\"] = f.lastName;\n if (f.email) base[\"fynd_website.form_email\"] = f.email;\n if (f.phone) base[\"fynd_website.form_phone\"] = f.phone;\n }\n\n if (journey.userJourney?.length > 0) {\n base[\"fynd_website.journey_total_pages\"] = journey.userJourney.length;\n base[\"fynd_website.journey_touchpoints_count\"] = journey.userJourney.length;\n base[\"fynd_website.journey_first_page\"] = journey.userJourney[0].page;\n base[\"fynd_website.journey_current_page\"] =\n journey.userJourney[journey.userJourney.length - 1].page;\n\n const firstVisit = new Date(journey.userJourney[0].time);\n const lastVisit = new Date(journey.userJourney[journey.userJourney.length - 1].time);\n base[\"fynd_website.journey_session_duration\"] = Math.floor(\n (lastVisit.getTime() - firstVisit.getTime()) / 1000\n );\n base[\"fynd_website.journey_entry_time\"] = journey.userJourney[0].time;\n base[\"fynd_website.journey_exit_time\"] =\n journey.userJourney[journey.userJourney.length - 1].time;\n }\n\n if (journey.deviceCategory) base[\"fynd_website.device_type\"] = journey.deviceCategory;\n if (journey.browser) base[\"fynd_website.journey_browser\"] = journey.browser;\n if (journey.device) base[\"fynd_website.journey_device\"] = journey.device;\n if (journey.origin) base[\"fynd_website.journey_origin\"] = journey.origin;\n if (journey.utmPath) base[\"fynd_website.journey_utm_path\"] = journey.utmPath;\n if (journey.scrollDepth) base[\"fynd_website.journey_scroll_depth\"] = journey.scrollDepth;\n\n if (journey.aiData) {\n const aiData = journey.aiData;\n if (aiData.context) base[\"fynd_website.aidata_context\"] = aiData.context;\n if (aiData.platform) base[\"fynd_website.aidata_platform\"] = aiData.platform;\n if (aiData.type) base[\"fynd_website.aidata_type\"] = aiData.type;\n if (aiData.detectionMethod) base[\"fynd_website.aidata_detection\"] = aiData.detectionMethod;\n }\n }\n } catch (err) {\n console.warn(\"Error getting user journey data for tracking:\", err);\n }\n\n // Fallback device type\n if (base[\"fynd_website.device_type\"] === \"Unknown\") {\n const ua = navigator.userAgent;\n if (/iPad/.test(ua) || (/Android/.test(ua) && !/Mobile/.test(ua)) || /Tablet/.test(ua)) {\n base[\"fynd_website.device_type\"] = \"Tablet\";\n } else if (/Mobile|iPhone|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop/.test(ua)) {\n base[\"fynd_website.device_type\"] = \"Mobile\";\n } else {\n base[\"fynd_website.device_type\"] = \"Desktop\";\n }\n }\n\n // ---------- UUID from cookie ----------\n try {\n const cookieMatch = document.cookie.match(/(?:^|;\\s*)user-id=([^;]*)/);\n base[\"fynd_website.uuid\"] = cookieMatch ? decodeURIComponent(cookieMatch[1]) : null;\n } catch (err) {\n console.warn(\"Error reading user-id cookie:\", err);\n base[\"fynd_website.uuid\"] = null;\n }\n\n return base;\n};\n\n// ---------- GA send ----------\nconst sendToGA = (eventName: string, gaProps: GATrackingProperties, additionalProps?: any): void => {\n if ((window as any).dataLayer) {\n const eventData: GTMEvent = {\n event: eventName,\n event_category: \"form_interaction\",\n event_label: eventName,\n ...gaProps,\n };\n if (additionalProps?.submitted_form) {\n eventData.submitted_form = additionalProps.submitted_form;\n }\n (window as any).dataLayer.push(eventData);\n } else {\n console.warn(\"dataLayer not available for GA tracking\");\n }\n};\n\n// ---------- Public trackEvent ----------\nconst trackEvent = (eventName: string, properties?: Partial<TrackingProperties>): void => {\n try {\n const baseProps = getPosthogTrackingProperties();\n const finalProps = properties ? { ...baseProps, ...properties } : baseProps;\n\n if ((window as any).posthog) {\n // Capture the event\n (window as any).posthog.capture(eventName, finalProps);\n\n // If this is a form submission event, set person properties\n if (eventName === \"fynd_website.form.submitted\") {\n try {\n const journey = (window as any).getUserJourney?.() ||\n JSON.parse(localStorage.getItem(\"userJourney\") || \"{}\");\n\n const personProps: { [key: string]: any } = {};\n\n if (journey?.formDetails?.firstName) {\n personProps[\"name\"] = journey.formDetails.firstName;\n }\n if (journey?.formDetails?.email) {\n personProps[\"email\"] = journey.formDetails.email;\n }\n if (journey?.formDetails?.phone) {\n personProps[\"mobile\"] = journey.formDetails.phone;\n }\n\n if (Object.keys(personProps).length > 0) {\n console.log(\"\uD83D\uDCCA PostHog Person Properties - Form Submission:\", personProps);\n (window as any).posthog.setPersonProperties(personProps);\n }\n } catch (err) {\n console.warn(\"Error setting person properties:\", err);\n }\n }\n }\n\n const gaProps = getGaTrackingProperties();\n const hasAIData =\n gaProps.aidata_context || gaProps.aidata_platform || gaProps.aidata_type || gaProps.aidata_detection;\n\n const isFormRelatedEvent =\n eventName.includes(\"form\") ||\n Object.keys(gaProps).length > 0 ||\n properties?.submitted_form ||\n !!hasAIData;\n\n if (isFormRelatedEvent) {\n sendToGA(eventName, gaProps, properties);\n }\n } catch (error) {\n console.error(\"Error tracking event:\", error);\n }\n};\n\n// ---------- Shared helpers ----------\nconst getParentFormName = (element: HTMLElement): string | null => {\n const parentForm = element.closest(\"form\") as HTMLFormElement | null;\n if (!parentForm) return null;\n return (\n parentForm.getAttribute(\"data-name\") ||\n parentForm.getAttribute(\"name\") ||\n parentForm.id ||\n null\n );\n};\n\n// ---------- Page lifecycle ----------\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n const props = getPosthogTrackingProperties();\n if ((window as any).posthog) {\n (window as any).posthog.capture(\"$pageview\", props);\n }\n});\n\nwindow.addEventListener(\"load\", () => {\n trackEvent(\"fynd_website.page.loaded\");\n});\n\n// ---------- Base site interactions ----------\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n const signUpButtons = document.querySelectorAll('[data-ph=\"sign-up\"]');\n const signInButtons = document.querySelectorAll('[data-ph=\"sign-in\"]');\n const scrollToFormButtons = document.querySelectorAll('[href=\"#footer-form\"]');\n const bookADemoButtons = document.querySelectorAll('[data-ph=\"book-a-demo\"]');\n const callButtons = document.querySelectorAll('[data-ph=\"call\"]');\n const submitButtons = document.querySelectorAll('[type=\"submit\"]');\n\n submitButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (this: HTMLElement): void {\n const formName = getParentFormName(this);\n setTimeout(() => {\n if (window.validationPassed === true) {\n const additionalProps = formName ? { submitted_form: formName } : {};\n trackEvent(\"fynd_website.form.submitted\", additionalProps);\n }\n }, 10);\n });\n });\n\n signUpButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.sign_up.clicked\"));\n });\n\n signInButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.sign_in.clicked\"));\n });\n\n scrollToFormButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.scroll_to_form.clicked\"));\n });\n\n bookADemoButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.book_a_demo.clicked\"));\n });\n\n callButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", () => trackEvent(\"fynd_website.call.clicked\"));\n });\n\n // Form started\n const formFields = document.querySelectorAll<HTMLElement>(\"[ph-form-field]\");\n const triggeredForms = new Set<string>();\n\n const handleFormStarted = function (this: HTMLElement): void {\n const formName = getParentFormName(this);\n const formIdentifier = formName || \"unknown-form\";\n if (!triggeredForms.has(formIdentifier)) {\n triggeredForms.add(formIdentifier);\n trackEvent(\"fynd_website.form.started\");\n }\n };\n\n formFields.forEach((field) => {\n const tagName = field.tagName.toLowerCase();\n const inputType = (field as HTMLInputElement).type?.toLowerCase();\n\n if (!(tagName === \"button\" || (tagName === \"input\" && inputType === \"submit\"))) {\n field.addEventListener(\"focus\", handleFormStarted);\n }\n if (tagName === \"button\" || (tagName === \"input\" && inputType === \"submit\")) {\n field.addEventListener(\"click\", handleFormStarted);\n } else if (tagName === \"select\") {\n field.addEventListener(\"change\", handleFormStarted);\n } else {\n field.addEventListener(\"input\", handleFormStarted);\n }\n });\n});\n\n// ---------- Expose globals ----------\nwindow.getPosthogTrackingProperties = getPosthogTrackingProperties;\nwindow.trackEvent = trackEvent;\nwindow.getGaTrackingProperties = getGaTrackingProperties;\n\n// ---------- Optional: bootstrap ad tracking here ----------\n// const AD_CONFIGS: AdConfig[] = [\n// { adPageSlug: \"/solutions/transport-management-system\", adEventExtension: \"tms\", adUTMCampaign: \"tms\", },\n// ];\n// initAdsTracking(AD_CONFIGS);\ninitGeneralAdsTracking();\n\ninitMetaTracking({\n enableAdvancedMatching: true, // pulls user data from your journey store when available\n enableSpaPageViews: true, // fires PageView on virtual navigations\n hasConsent: () => (window as any).__ad_consent === \"granted\" || true, // replace with your consent logic\n});\n\n// ---------- Exports ----------\nexport {\n getPosthogTrackingProperties,\n getGaTrackingProperties,\n trackEvent,\n getParentFormName,\n type Tracking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