PageSourceSearch

https://mietwagen-jetzt.de/assets/AdminAnalytics-DtMtdan8.js

js mietwagen-jetzt.de collected 2026-10-06 21:38:16 UTC 11,174 bytes, 16 lines download raw bytes

1import{U as u,r as c,j as e,ai as w,an as q,ar as S,s as h}from"./index-DknoC22_.js";import{A as G,M as I}from"./AdminLayout-Nt0t4J3g.js";import{C as n,c as l}from"./card-DWQFIM1f.js";import{B as d}from"./badge-3btU7kVv.js";import{T as F,a as W,b as x,c as m}from"./tabs-COpKV9LQ.js";import{R as Z}from"./refresh-cw-BqTn92zx.js";import{U as H}from"./users-CU5wapLv.js";import{E as Q}from"./eye-DBlcojTA.js";import"./input-l0oa3ZMk.js";import"./external-link-DmlZYOE-.js";import"./index-BAtuzBRr.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const J=u("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const X=u("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const Y=u("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]),xe=()=>{const[_,j]=c.useState(!0),[a,k]=c.useState([]),[f,C]=c.useState([]),[p,D]=c.useState([]),[T,R]=c.useState([]),[i,L]=c.useState("7d"),M=()=>{const s=new Date,t=i==="24h"?1:i==="7d"?7:i==="30d"?30:90;return new Date(s.getTime()-t*864e5).toISOString()},g=async()=>{j(!0);const s=M(),[t,r,B,V]=await Promise.all([h.from("visitor_sessions").select("*").gte("started_at",s).order("started_at",{ascending:!1}).limit(500),h.from("page_views").select("*").gte("created_at",s).order("created_at",{ascending:!1}).limit(1e3),h.from("search_queries").select("*").gte("created_at",s).order("created_at",{ascending:!1}).limit(200),h.from("widget_clicks").select("*").gte("created_at",s).order("created_at",{ascending:!1}).limit(500)]);k(t.data||[]),C(r.data||[]),D(B.data||[]),R(V.data||[]),j(!1)};c.useEffect(()=>{g()},[i]);const o=a.length,U=f.length,b=a.filter(s=>s.converted).length,E=o>0?(b/o*100).toFixed(1):"0",A=a.reduce((s,t)=>(s[t.device_type||"unknown"]=(s[t.device_type||"unknown"]||0)+1,s),{}),K=f.reduce((s,t)=>(s[t.page_path]=(s[t.page_path]||0)+1,s),{}),N=Object.entries(K).sort(([,s],[,t])=>t-s).slice(0,15),O=a.reduce((s,t)=>{try{const r=t.referrer?new URL(t.referrer).hostname:"Direkt";s[r]=(s[r]||0)+1}catch{s.Direkt=(s.Direkt||0)+1}return s},{}),y=Object.entries(O).sort(([,s],[,t])=>t-s).slice(0,10),P=a.filter(s=>s.utm_source).reduce((s,t)=>{const r=`${t.utm_source}/${t.utm_medium||"-"}`;return s[r]=(s[r]||0)+1,s},{}),v=Object.entries(P).sort(([,s],[,t])=>t-s).slice(0,10),$=a.reduce((s,t)=>(s[t.browser||"unknown"]=(s[t.browser||"unknown"]||0)+1,s),{}),z=({type:s})=>s==="mobile"?e.jsx(X,{className:"w-4 h-4"}):s==="tablet"?e.jsx(Y,{className:"w-4 h-4"}):e.jsx(J,{className:"w-4 h-4"});return e.jsx(G,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading font-bold text-2xl text-foreground",children:"Analytics Dashboard"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Besucher, Conversions & Tracking"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[["24h","7d","30d","90d"].map(s=>e.jsx(w,{size:"sm",variant:i===s?"default":"outline",onClick:()=>L(s),children:s},s)),e.jsx(w,{variant:"outline",size:"sm",onClick:g,className:"gap-1",children:e.jsx(Z,{className:`w-3 h-3 ${_?"animate-spin":""}`})})]})]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:[{label:"Sessions",value:o,icon:H,color:"text-blue-600"},{label:"Seitenaufrufe",value:U,icon:Q,color:"text-green-600"},{label:"Widget-Klicks",value:T.length,icon:I,color:"text-orange-600"},{label:"Suchanfragen",value:p.length,icon:q,color:"text-purple-600"},{label:"Conversions",value:b,icon:S,color:"text-emerald-600"},{label:"Conv. Rate",value:`${E}%`,icon:S,color:"text-amber-600"}].map(s=>e.jsx(n,{children:e.jsxs(l,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(s.icon,{className:`w-4 h-4 ${s.color}`}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]}),e.jsx("p",{className:`text-2xl font-heading font-bold ${s.color}`,children:s.value})]})},s.label))}),e.jsxs(F,{defaultValue:"pages",children:[e.jsxs(W,{children:[e.jsx(x,{value:"pages",children:"Top Seiten"}),e.jsx(x,{value:"sources",children:"Traffic-Quellen"}),e.jsx(x,{value:"devices",children:"Geräte"}),e.jsx(x,{value:"searches",children:"Suchanfragen"}),e.jsx(x,{value:"conversions",children:"Conversions"})]}),e.jsx(m,{value:"pages",className:"mt-4",children:e.jsx(n,{children:e.jsx(l,{className:"p-0",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{className:"text-left text-xs font-bold text-muted-foreground uppercase",children:[e.jsx("th",{className:"px-4 py-3",children:"#"}),e.jsx("th",{className:"px-4 py-3",children:"Seite"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Aufrufe"})]})}),e.jsxs("tbody",{children:[N.map(([s,t],r)=>e.jsxs("tr",{className:"border-t border-border hover:bg-muted/30",children:[e.jsx("td",{className:"px-4 py-2.5 text-xs text-muted-foreground",children:r+1}),e.jsx("td",{className:"px-4 py-2.5 text-sm font-mono",children:s}),e.jsx("td",{className:"px-4 py-2.5 text-right",children:e.jsx(d,{variant:"secondary",children:t})})]},s)),N.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Keine Daten"})})]})]})})})}),e.jsx(m,{value:"sources",className:"mt-4 space-y-4",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsx(n,{children:e.jsxs(l,{className:"p-4",children:[e.jsx("h3",{className:"font-heading font-bold text-sm mb-3",children:"Top Referrer"}),y.map(([s,t])=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-border last:border-0",children:[e.jsx("span",{className:"text-sm",children:s}),e.jsx(d,{variant:"secondary",children:t})]},s)),y.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keine Daten"})]})}),e.jsx(n,{children:e.jsxs(l,{className:"p-4",children:[e.jsx("h3",{className:"font-heading font-bold text-sm mb-3",children:"UTM Kampagnen"}),v.map(([s,t])=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-border last:border-0",children:[e.jsx("span",{className:"text-xs font-mono",children:s}),e.jsx(d,{variant:"secondary",children:t})]},s)),v.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keine UTM-Daten"})]})})]})}),e.jsx(m,{value:"devices",className:"mt-4",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsx(n,{children:e.jsxs(l,{className:"p-4",children:[e.jsx("h3",{className:"font-heading font-bold text-sm mb-3",children:"Gerätetypen"}
16),Object.entries(A).sort((s,t)=>t[1]-s[1]).map(([s,t])=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-border last:border-0",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm capitalize",children:[e.jsx(z,{type:s})," ",s]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[o>0?Math.round(t/o*100):0,"%"]}),e.jsx(d,{variant:"secondary",children:t})]})]},s))]})}),e.jsx(n,{children:e.jsxs(l,{className:"p-4",children:[e.jsx("h3",{className:"font-heading font-bold text-sm mb-3",children:"Browser"}),Object.entries($).sort((s,t)=>t[1]-s[1]).map(([s,t])=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-border last:border-0",children:[e.jsx("span",{className:"text-sm",children:s}),e.jsx(d,{variant:"secondary",children:t})]},s))]})})]})}),e.jsx(m,{value:"searches",className:"mt-4",children:e.jsx(n,{children:e.jsx(l,{className:"p-0",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{className:"text-left text-xs font-bold text-muted-foreground uppercase",children:[e.jsx("th",{className:"px-4 py-3",children:"Abholung"}),e.jsx("th",{className:"px-4 py-3",children:"Rückgabe"}),e.jsx("th",{className:"px-4 py-3",children:"Datum"}),e.jsx("th",{className:"px-4 py-3",children:"Seite"}),e.jsx("th",{className:"px-4 py-3",children:"Zeit"})]})}),e.jsxs("tbody",{children:[p.slice(0,20).map(s=>e.jsxs("tr",{className:"border-t border-border hover:bg-muted/30",children:[e.jsx("td",{className:"px-4 py-2.5 text-sm",children:s.pickup_location||"—"}),e.jsx("td",{className:"px-4 py-2.5 text-sm",children:s.dropoff_location||"—"}),e.jsx("td",{className:"px-4 py-2.5 text-sm",children:s.pickup_date||"—"}),e.jsx("td",{className:"px-4 py-2.5 text-xs font-mono text-muted-foreground",children:s.page_url}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-muted-foreground",children:new Date(s.created_at).toLocaleString("de-DE")})]},s.id)),p.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Keine Suchanfragen"})})]})]})})})}),e.jsx(m,{value:"conversions",className:"mt-4",children:e.jsx(n,{children:e.jsx(l,{className:"p-0",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-muted/50",children:e.jsxs("tr",{className:"text-left text-xs font-bold text-muted-foreground uppercase",children:[e.jsx("th",{className:"px-4 py-3",children:"Erste Seite"}),e.jsx("th",{className:"px-4 py-3",children:"Letzte Seite"}),e.jsx("th",{className:"px-4 py-3",children:"Referrer"}),e.jsx("th",{className:"px-4 py-3",children:"Typ"}),e.jsx("th",{className:"px-4 py-3",children:"Gerät"}),e.jsx("th",{className:"px-4 py-3",children:"Zeit"})]})}),e.jsxs("tbody",{children:[a.filter(s=>s.converted).slice(0,20).map(s=>{let t="Direkt";try{s.referrer&&(t=new URL(s.referrer).hostname)}catch{}return e.jsxs("tr",{className:"border-t border-border hover:bg-muted/30",children:[e.jsx("td",{className:"px-4 py-2.5 text-sm font-mono",children:s.first_page}),e.jsx("td",{className:"px-4 py-2.5 text-sm font-mono",children:s.last_page}),e.jsx("td",{className:"px-4 py-2.5 text-xs",children:t}),e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(d,{children:s.conversion_type||"widget"})}),e.jsx("td",{className:"px-4 py-2.5 text-xs capitalize",children:s.device_type}),e.jsx("td",{className:"px-4 py-2.5 text-xs text-muted-foreground",children:new Date(s.started_at).toLocaleString("de-DE")})]},s.id)}),a.filter(s=>s.converted).length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Keine Conversions"})})]})]})})})})]})]})})};export{xe 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.