PageSourceSearch

https://jhasolutions.com/assets/AdminConversionTracking-h_Xo_d8g.js

js jhasolutions.com collected 2026-09-24 14:46:38 UTC 14,539 bytes, 1 lines download raw bytes

1import{u as b,r as N,j as e}from"./query-vendor-Dp9tfhuh.js";import{D as H,P as q,b as R,d as E}from"./DashboardLayout-v_SFEx5M.js";import{P as B}from"./PageHeader-DAD15sYQ.js";import{s as k,h as x,i as h,k as j,m as u,w as T,l as g,B as C,c as F,C as M}from"./index-CgOeqv80.js";import{T as A,a as S,b as p,c as i,d as P,e as t}from"./table-DCRDDm_8.js";import{B as f}from"./badge-CarGzGVG.js";import{f as L}from"./formatDistanceToNow-DExfhm_y.js";import{C as W}from"./chevron-up-DVBQQKr7.js";import{C as z}from"./chevron-down-Bm2Y15mk.js";import{A as K}from"./arrow-right-ksEPM703.js";import{C as U}from"./calendar-DNShNncl.js";import{T as Q,a as V,b as y,c as w}from"./tabs-CaoVN6UB.js";import{f as _}from"./format-Ch7dQtBq.js";import{C as $}from"./calendar-D4RFJDPY.js";import"./ui-vendor-DW4RoVmg.js";import"./react-vendor-DfslLuwi.js";import"./use-mobile-CojsY12Z.js";import"./input-go5takyh.js";import"./separator-DP1KYTpB.js";import"./sheet-bqYui_d3.js";import"./skeleton-U7PtyM3w.js";import"./tooltip-CSLOX5Ak.js";import"./Logo-Dty4QCqO.js";import"./calendar-days-Cbs598pa.js";import"./building-2-BMIYvzwG.js";import"./users-9XO_ctWv.js";import"./map-pin-B63H-upO.js";import"./wrench-CDdvezGQ.js";import"./wifi-off-BfVaxzCl.js";import"./message-square-B81woyC-.js";import"./file-text-CuOiBfSM.js";import"./credit-card-B-2xvAjl.js";import"./panel-top-BGv8mfXo.js";import"./mail-CObWevXE.js";import"./log-out-SS0g6Uak.js";import"./scroll-area-DpCy8yLM.js";import"./index-BdQq_4o_.js";import"./bell-D0vTOuek.js";import"./check-check-2zE5w8gN.js";import"./en-US-5rFTtd83.js";import"./LanguageSwitcher-DHMsopEY.js";import"./dropdown-menu-BeZf8kFV.js";import"./chevron-right-BdUdHP_I.js";import"./check-v4vwqlB-.js";import"./circle-pSWMGBM_.js";import"./languages-DOZFgZ9Q.js";import"./message-circle-BYe5rrWz.js";import"./activity-CfnIewRD.js";import"./arrow-down-CIVFAk8G.js";import"./arrow-left-BmX2tYO6.js";import"./arrow-right-left-DF8EQ874.js";import"./banknote-CdW1Jv9F.js";import"./bed-B88pYHvh.js";import"./list-ordered-hB6RbGtG.js";import"./book-open-check-DYZCLGLv.js";import"./book-open-D0Y1dKqG.js";import"./brain-BohJitgU.js";import"./building-DasY5zOg.js";import"./calculator-ByooPTmb.js";import"./car-D3b4R55M.js";import"./landmark-BwZdzl4J.js";import"./chart-no-axes-column-increasing-C6Bh1bTG.js";import"./chart-pie-7jztI-xg.js";import"./chevron-left-DCDYd6CA.js";import"./circle-check-big-CQmmVCDK.js";import"./circle-check-CLkepror.js";import"./message-square-text-W-2xUYbe.js";import"./circle-help-Cpt-rFJF.js";import"./circle-x-CMEjdGNX.js";import"./clipboard-check-Cvc1fMv5.js";import"./clipboard-list-FvLR_NG8.js";import"./clipboard-viWVwQwk.js";import"./clock-BmPJ466V.js";import"./copy-BEDU18te.js";import"./database-kv95WpLa.js";import"./dollar-sign-D0iC4HrG.js";import"./download-B3iahoQg.js";import"./zoom-out-zrJfLdu9.js";import"./external-link-BIGsQXrz.js";import"./twitter-BaxQU1X8.js";import"./file-chart-column-increasing-DEN9Rsed.js";import"./file-check-cM7E4NaC.js";import"./file-spreadsheet-ZK-q7Zgc.js";import"./filter-Bs-PYMIY.js";import"./folder-open-DFmVGiUq.js";import"./tree-pine-CouWAS-6.js";import"./globe-C_UDh3Yp.js";import"./video-DaS8rS9K.js";import"./hammer-691LkvTd.js";import"./heart-Dv9Odr8c.js";import"./hotel-C1w3GOsr.js";import"./house-5R4LHGOP.js";import"./image-plus-xT5L-tET.js";import"./image-CayqqQKD.js";import"./infinity-wq20aEtI.js";import"./key-round-Dh3U7Shh.js";import"./pen-tool-_n2hBO7N.js";import"./keyboard-CSqz3mRU.js";import"./layers-D0VRol72.js";import"./lightbulb-DlRuWc33.js";import"./list-checks-coQAK2sr.js";import"./list-BJoWfKXY.js";import"./lock-B0M9hAnN.js";import"./map-pinned-B-fJbXg-.js";import"./map-C8rxfYCS.js";import"./maximize-2-CZGGiq67.js";import"./maximize-DHDDLx00.js";import"./menu-DuKtMQlr.js";import"./minus-04ztrfH_.js";import"./mouse-pointer-click-Bc_ivnf4.js";import"./mouse-CUCnDlYq.js";import"./navigation-mR6QetLo.js";import"./pause-DWfQPC5O.js";import"./pencil-d1bR18nI.js";import"./ruler-BoWqmUga.js";import"./phone-I9m-09C5.js";import"./play-CVPqrcf1.js";import"./plus-CYnN_kFu.js";import"./printer-DjW2gpx9.js";import"./refresh-ccw-BR8hKK-Q.js";
1import"./rocket-DxjHbFsp.js";import"./rotate-ccw-CE2HFYnH.js";import"./rotate-cw-n6J_8Piu.js";import"./route-Df-61sSI.js";import"./save-DF6x0jpO.js";import"./scale-CZXGlUhc.js";import"./search-Dx_o7OfG.js";import"./send-Blf9Z7mq.js";import"./share-2-sKHj2vjO.js";import"./square-plus-Dp1sCmj5.js";import"./skip-forward-eFm9X_4U.js";import"./smartphone-CBjqwShe.js";import"./square-check-big-DF0dFzei.js";import"./square-pen-Bg7uj701.js";import"./square-MsVDU0g-.js";import"./star-DlIZz9Im.js";import"./trash-2-DAqLpVlV.js";import"./trending-down-COltpy2W.js";import"./trending-up-CRE5UWZg.js";import"./upload-55xlfOPi.js";import"./user-check-XkucE5f8.js";import"./user-DV5oCLCs.js";import"./volume-2-DTT7l7C1.js";import"./volume-x-BBMkTIRp.js";import"./wallet-_cnDvlQk.js";import"./workflow-Bfwpj-zP.js";import"./zap-BKGpOGd1.js";import"./useIsRTL-D_a81cVb.js";import"./useOrganization-msM7McOc.js";import"./chart-vendor-BoynbIzZ.js";import"./startOfMonth-CR-gPZr_.js";import"./addMonths-YCl4V_qS.js";import"./isSameMonth-9MImqN3e.js";import"./isBefore-CgCj7brn.js";import"./isSameDay-DKb4pGQS.js";import"./addDays-DdzlNAKv.js";import"./subDays-CTCG_ujS.js";function G(n,m){return b({queryKey:["conversion-attribution",n,m],queryFn:async()=>{const{data:r,error:c}=await k.rpc("get_conversion_attribution",{start_date:n,end_date:m});if(c)throw c;return r},staleTime:1e3*60*5})}function J({startDate:n,endDate:m}){const{data:r,isLoading:c}=G(n,m),[a,s]=N.useState(new Set),d=o=>{const l=new Set(a);l.has(o)?l.delete(o):l.add(o),s(l)};return c?e.jsxs(x,{children:[e.jsx(h,{children:e.jsx(j,{children:"Conversion Attribution"})}),e.jsx(u,{className:"flex justify-center p-8",children:e.jsx(T,{})})]}):e.jsxs(x,{children:[e.jsxs(h,{children:[e.jsx(j,{children:"Conversion Attribution"}),e.jsx(g,{children:"Track user journeys from first touch to conversion"})]}),e.jsx(u,{children:e.jsxs(A,{children:[e.jsx(S,{children:e.jsxs(p,{children:[e.jsx(i,{children:"User"}),e.jsx(i,{children:"Signup Date"}),e.jsx(i,{children:"First Touch"}),e.jsx(i,{children:"Last Touch"}),e.jsx(i,{children:"Events"}),e.jsx(i,{children:"Conversion"}),e.jsx(i,{children:"Time to Convert"}),e.jsx(i,{})]})}),e.jsx(P,{children:r==null?void 0:r.map(o=>{var l;return e.jsxs(e.Fragment,{children:[e.jsxs(p,{children:[e.jsx(t,{className:"font-medium",children:o.user_email}),e.jsx(t,{children:L(new Date(o.signup_date),{addSuffix:!0})}),e.jsx(t,{className:"text-sm",children:o.first_touchpoint||"N/A"}),e.jsx(t,{className:"text-sm",children:o.last_touchpoint||"N/A"}),e.jsx(t,{children:o.total_events}),e.jsx(t,{children:o.conversion_event?e.jsx(f,{variant:"default",children:o.conversion_event}):e.jsx(f,{variant:"outline",children:"No conversion"})}),e.jsx(t,{children:o.time_to_convert?o.time_to_convert:"N/A"}),e.jsx(t,{children:e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>d(o.user_id),children:a.has(o.user_id)?e.jsx(W,{className:"h-4 w-4"}):e.jsx(z,{className:"h-4 w-4"})})})]},o.user_id),a.has(o.user_id)&&e.jsx(p,{children:e.jsx(t,{colSpan:8,className:"bg-muted/50",children:e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"Event Sequence:"}),e.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto",children:(l=o.event_sequence)==null?void 0:l.map((v,D)=>e.jsxs("div",{className:"text-xs flex items-center gap-2 p-2 bg-background rounded",children:[e.jsx(f,{variant:"outline",className:"text-xs",children:D+1}),e.jsx("span",{className:"font-medium",children:v.event}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("span",{className:"text-muted-foreground",children:v.page}),e.jsx("span",{className:"ml-auto text-muted-foreground",children:L(new Date(v.time),{addSuffix:!0})})]},D))})]})})})]})})})]})})]})}function X(n,m){return b({queryKey:["cohort-analysis",n,m],queryFn:async()=>{const{data:r,error:c}=await k.rpc("get_cohort_analysis",{cohort_start_date:n,cohort_end_date:m});if(c)throw c;return r},staleTime:1e3*60*10})}function Y({startDate:n,endDate:m}){const{data:r,isLoading:c}=X(n,m);if(c)return e.jsxs(x,{children:[e.jsx(h,{children:e.jsx(j,{children:"Cohort Analysis"})}),e.jsx(u,{className:"flex justify-center p-8",children:e.jsx(T,{})})]});const a=s=>s>=70?"bg-green-500/20 text-green-700 dark:text-green-300":s>=50?"bg-yellow-500/20 text-yellow-700 dark:text-yellow-300":"bg-red-500/20 text-red-700 dark:text-red-300";return e.jsxs(x,{children:[e.jsxs(h,{children:[e.jsx(j,{children:"Cohort Analysis"}),e.jsx(g,{children:"User retention and conversion by signup cohort"})]}),e.jsx(u,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(A,{children:[e.jsx(S,{children:e.jsxs(p,{children:[e.jsx(i,{children:"Cohort"}),e.jsx(i,{children:"Size"}),e.jsx(i,{children:"Week 0"}),e.jsx(i,{children:"Week 1"}),e.jsx(i,{children:"Week 2"}),e.jsx(i,{children:"Week 3"}),e.jsx(i,{children:"Week 4+"}),e.jsx(i,{children:"Conversions"}),e.jsx(i,{children:"Conv. Rate"})]})}),e.jsx(P,{children:r==null?void 0:r.map(s=>e.jsxs(p,{children:[e.jsx(t,{className:"font-medium",children:s.cohort_month}),e.jsx(t,{children:s.cohort_size}),e.jsx(t,{children:e.jsxs("div",{className:`inline-block px-2 py-1 rounded text-sm ${a(s.week_0_retention)}`,children:[s.week_0_retention,"%"]})}),e.jsx(t,{children:e.jsxs("div",{className:`inline-block px-2 py-1 rounded text-sm ${a(s.week_1_retention)}`,children:[s.week_1_retention,"%"]})}),e.jsx(t,{children:e.jsxs("div",{className:`inline-block px-2 py-1 rounded text-sm ${a(s.week_2_retention)}`,children:[s.week_2_retention,"%"]})}),e.jsx(t,{children:e.jsxs("div",{className:`inline-block px-2 py-1 rounded text-sm ${a(s.week_3_retention)}`,children:[s.week_3_retention,"%"]})}),e.jsx(t,{children:e.jsxs("div",{className:`inline-block px-2 py-1 rounded text-sm ${a(s.week_4_retention)}`,children:[s.week_4_retention,"%"]})}),e.jsx(t,{children:s.total_conversions}),e.jsx(t,{children:e.jsxs("div",{className:`inline-block px-2 py-1 rounded text-sm font-semibold ${a(s.conversion_rate)}`,children:[s.conversion_rate,"%"]})})]},s.cohort_month))})]})})})]})}function Z(n,m,r=5){return b({queryKey:["conversion-paths",n,m,r],queryFn:async()=>{const{data:c,error:a}=await k.rpc("get_conversion_paths",{start_date:n,end_date:m,min_occurrences:r});if(a)throw a;return c},staleTime:1e3*60*5})}function O({startDate:n,endDate:m}){const{data:r,isLoading:c}=Z(n,m);if(c)return e.jsxs(x,{children:[e.jsx(h,{children:e.jsx(j,{children:"Common Conversion Paths"})}),e.jsx(u,{className:"flex justify-center p-8",children:e.jsx(T,{})})]});const a=s=>s>=20?"default":s>=10?"secondary":"outline";return e.jsxs(x,{children:[e.jsxs(h,{children:[e.jsx(j,{children:"Common Conversion Paths"}),e.jsx(g,{children:"Most frequent event sequences leading to conversions"})]}),e.jsx(u,{children:e.jsxs(A,{children:[e.jsx(S,{children:e.jsxs(p,{children:[e.jsx(i,{children:"Event Path"}),e.jsx(i,{children:"Users"}),e.jsx(i,{children:"Avg. Time"}),e.jsx(i,{children:"Conversion Rate"})]})}),e.jsx(P,{children:r==null?void 0:r.map((s,d)=>e.jsxs(p,{children:[e.jsx(t,{className:"font-mono text-xs max-w-md",children:e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:s.path_sequence.split(" → ").map((o,l,v)=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(f,{variant:"outline",className:"text-xs",children:o}),l<v.length-1&&e.jsx(K,{className:"h-3 w-3 text-muted-foreground"})]},l))})}),e.jsxs(t,{children:[s.user_count," users"]}),e.jsx(t,{children:s.avg_time_to_convert}),e.jsx(t,{children:e.jsxs(f,{variant:a(s.conversion_rate),children:[s.conversion_rate,"%"]})})]},d))})]})})]})}const Jr=()=>{const[n,m]=N.useState(new Date(Date.now()-2592e6)),[r,c]=N.useState(new Date),a=_(n,"yyyy-MM-dd"),s=_(r,"yyyy-MM-dd");
1return e.jsxs(H,{children:[e.jsx(B,{title:"Conversion Tracking",subtitle:"Advanced analytics to understand what drives conversions",icon:e.jsx(M,{className:"h-5 w-5"}),actions:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(q,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(C,{variant:"outline",className:F("justify-start text-left font-normal",!n&&"text-muted-foreground"),children:[e.jsx($,{className:"mr-2 h-4 w-4"}),n?_(n,"PPP"):"Start date"]})}),e.jsx(E,{className:"w-auto p-0",children:e.jsx(U,{mode:"single",selected:n,onSelect:d=>d&&m(d),initialFocus:!0})})]}),e.jsxs(q,{children:[e.jsx(R,{asChild:!0,children:e.jsxs(C,{variant:"outline",className:F("justify-start text-left font-normal",!r&&"text-muted-foreground"),children:[e.jsx($,{className:"mr-2 h-4 w-4"}),r?_(r,"PPP"):"End date"]})}),e.jsx(E,{className:"w-auto p-0",children:e.jsx(U,{mode:"single",selected:r,onSelect:d=>d&&c(d),initialFocus:!0})})]})]})}),e.jsxs(Q,{defaultValue:"attribution",className:"space-y-6",children:[e.jsxs(V,{children:[e.jsx(y,{value:"attribution",children:"Attribution"}),e.jsx(y,{value:"paths",children:"Conversion Paths"}),e.jsx(y,{value:"cohorts",children:"Cohort Analysis"})]}),e.jsx(w,{value:"attribution",className:"space-y-6",children:e.jsx(J,{startDate:a,endDate:s})}),e.jsx(w,{value:"paths",className:"space-y-6",children:e.jsx(O,{startDate:a,endDate:s})}),e.jsx(w,{value:"cohorts",className:"space-y-6",children:e.jsx(Y,{startDate:a,endDate:s})})]}),e.jsxs(x,{children:[e.jsxs(h,{children:[e.jsx(j,{children:"How to Use This Data"}),e.jsx(g,{children:"Understanding conversion tracking metrics"})]}),e.jsxs(u,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Attribution"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Shows the complete user journey from signup to conversion. See what pages users visited, how long it took them to convert, and which touchpoints were most important."})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Conversion Paths"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Reveals common event sequences that lead to conversions. Use this to understand which user behaviors indicate purchase intent and optimize your funnel."})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Cohort Analysis"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tracks user retention and conversion rates by signup month. Helps identify if recent changes improved user engagement and conversion over time."})]})]})]})]})};export{Jr as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.