PageSourceSearch

https://bowtiesports.com/assets/VisitorAnalytics-BihltSCh.js

js bowtiesports.com collected 2026-10-07 02:28:53 UTC 8,117 bytes, 1 lines download raw bytes

1import{j as e}from"./react-vendor-DUhHROXo.js";import{P as b}from"./PortalLayout-BUxGSFei.js";import{C as a,b as n,c as o,a as d,d as m}from"./card-9IoFUltb.js";import{J as w,a6 as C,aM as D,af as M}from"./index-BLtzf0SR.js";import{s as L}from"./client-DTel1CZI.js";import{U as T}from"./users-CIwSfVhi.js";import{C as P}from"./clock-DK72Hop1.js";import{R as _,X as A,Y as S,T as k}from"./generateCategoricalChart-DgLZc9AV.js";import{L as O,a as q}from"./LineChart-kThqkfAO.js";import{C as R}from"./CartesianGrid-Xczk_Kbb.js";import{G as U}from"./globe-CQ83QW2m.js";import{M as G}from"./monitor-Cfk1nyiF.js";import{f as K}from"./format-DGzj7MEM.js";import{s as W}from"./subDays-Cc0kVtWU.js";import"./AdminLayout-4AAuHeAU.js";import"./router-vendor-Dz9PdDzH.js";import"./NavLink-CsyG-eHO.js";import"./badge-BsE4KYIf.js";import"./scroll-area-BdyOmc9o.js";import"./index-BdQq_4o_.js";import"./collapsible-BAD8kbtc.js";import"./index-CMI-ZfmW.js";import"./arrow-left-CRb8P6iH.js";import"./activity-CwFToTs3.js";import"./list-todo-BR3jv1RJ.js";import"./calendar-BDETTnfZ.js";import"./users-round-CCw5yxW7.js";import"./radio-BQgeDg5T.js";import"./clapperboard-BvstouST.js";import"./clipboard-list-CQJ-vJ2y.js";import"./image-arBWrt3y.js";import"./folder-open-CIWhCFhy.js";import"./pencil-C2cyk8cg.js";import"./message-square-BDdDilNB.js";import"./ticket-l9bl0kcm.js";import"./megaphone-DpQsxotQ.js";import"./package-DKB1lvtO.js";import"./circle-user-BeB3uaA1.js";import"./folder-kanban-B8jlMC6s.js";import"./settings-Baim_Eei.js";import"./briefcase-CdSp4ViD.js";import"./chart-line-ohAz7u_s.js";import"./HostOwnerLayout-PM2-LrXf.js";import"./layers-CvbkNa7J.js";import"./dollar-sign-D3lTBfQm.js";import"./index-f8ec2rGh.js";import"./index-Dh4i1-J3.js";import"./en-US-Bfz1jvxT.js";import"./differenceInCalendarDays-D4nmWE3G.js";import"./getTimezoneOffsetInMilliseconds-DsfBWtEI.js";import"./addDays-BhORGywK.js";function Ke(){const{data:r,isLoading:B}=w({queryKey:["page-visits"],queryFn:async()=>{const s=W(new Date,30),{data:t,error:i}=await L.from("page_visits").select("*").gte("visited_at",s.toISOString()).order("visited_at",{ascending:!1});if(i)throw i;return t}}),c=(r==null?void 0:r.length)||0,x=new Set(r==null?void 0:r.map(s=>s.session_id)).size,f=(r==null?void 0:r.reduce((s,t)=>s+(t.duration_seconds||0),0))/(c||1),N=r==null?void 0:r.reduce((s,t)=>{const i=K(new Date(t.visited_at),"MMM d");return s[i]=(s[i]||0)+1,s},{}),h=Object.entries(N||{}).map(([s,t])=>({date:s,visits:t})).reverse().slice(-14),g=r==null?void 0:r.reduce((s,t)=>(s[t.page_path]=(s[t.page_path]||0)+1,s),{}),p=Object.entries(g||{}).map(([s,t])=>({path:s,count:t})).sort((s,t)=>t.count-s.count).slice(0,10),v=r==null?void 0:r.reduce((s,t)=>{const i=t.referrer||"Direct";return s[i]=(s[i]||0)+1,s},{}),u=Object.entries(v||{}).map(([s,t])=>({referrer:s,count:t})).sort((s,t)=>t.count-s.count).slice(0,5),y=r==null?void 0:r.reduce((s,t)=>{var j;const i=((j=t.user_agent)==null?void 0:j.toLowerCase())||"";let l="Desktop";return i.includes("mobile")||i.includes("android")||i.includes("iphone")?l="Mobile":(i.includes("tablet")||i.includes("ipad"))&&(l="Tablet"),s[l]=(s[l]||0)+1,s},{});return e.jsx(b,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-display font-bold",children:"Visitor Analytics"}),e.jsx("p",{className:"text-muted-foreground",children:"Website traffic and engagement metrics"})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsxs(a,{children:[e.jsxs(n,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(o,{className:"text-sm font-medium",children:"Page Views"}),e.jsx(C,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(d,{children:[e.jsx("div",{className:"text-2xl font-bold",children:c.toLocaleString()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),e.jsxs(a,{children:[e.jsxs(n,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(o,{className:"text-sm font-medium",children:"Unique Visitors"}),e.jsx(T,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(d,{children:[e.jsx("div",{className:"text-2xl font-bold",children:x.toLocaleStr
1ing()}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),e.jsxs(a,{children:[e.jsxs(n,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(o,{className:"text-sm font-medium",children:"Avg. Duration"}),e.jsx(P,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(d,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[Math.round(f),"s"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Per page view"})]})]}),e.jsxs(a,{children:[e.jsxs(n,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(o,{className:"text-sm font-medium",children:"Pages/Visit"}),e.jsx(D,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(d,{children:[e.jsx("div",{className:"text-2xl font-bold",children:x?(c/x).toFixed(1):0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Average"})]})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs(a,{children:[e.jsxs(n,{children:[e.jsx(o,{children:"Traffic Overview"}),e.jsx(m,{children:"Page views over the last 14 days"})]}),e.jsx(d,{children:h.length>0?e.jsx(_,{width:"100%",height:300,children:e.jsxs(O,{data:h,children:[e.jsx(R,{strokeDasharray:"3 3",className:"stroke-muted"}),e.jsx(A,{dataKey:"date",className:"text-xs"}),e.jsx(S,{className:"text-xs"}),e.jsx(k,{}),e.jsx(q,{type:"monotone",dataKey:"visits",stroke:"hsl(var(--primary))",strokeWidth:2,dot:!1})]})}):e.jsx("div",{className:"h-[300px] flex items-center justify-center text-muted-foreground",children:"No data available"})})]}),e.jsxs(a,{children:[e.jsxs(n,{children:[e.jsx(o,{children:"Top Pages"}),e.jsx(m,{children:"Most visited pages"})]}),e.jsx(d,{children:p.length>0?e.jsx("div",{className:"space-y-3",children:p.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground w-6",children:t+1}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-sm font-medium truncate",children:s.path})}),e.jsx("span",{className:"text-sm font-semibold",children:s.count})]},s.path))}):e.jsx("div",{className:"h-[200px] flex items-center justify-center text-muted-foreground",children:"No data available"})})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs(a,{children:[e.jsxs(n,{children:[e.jsx(o,{children:"Devices"}),e.jsx(m,{children:"Traffic by device type"})]}),e.jsx(d,{children:e.jsx("div",{className:"space-y-4",children:Object.entries(y||{}).map(([s,t])=>{const i=c?Math.round(t/c*100):0,l=s==="Mobile"?M:G;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:s})]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[i,"%"]})]}),e.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${i}%`}})})]},s)})})})]}),e.jsxs(a,{children:[e.jsxs(n,{children:[e.jsx(o,{children:"Traffic Sources"}),e.jsx(m,{children:"Where visitors come from"})]}),e.jsx(d,{children:u.length>0?e.jsx("div",{className:"space-y-3",children:u.map((s,t)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-sm font-medium truncate",children:s.referrer==="Direct"?"Direct / None":s.referrer})}),e.jsx("span",{className:"text-sm font-semibold",children:s.count})]},s.referrer))}):e.jsx("div",{className:"h-[200px] flex items-center justify-center text-muted-foreground",children:"No referrer data"})})]})]})]})})}export{Ke 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.