Spaces:
Sleeping
Sleeping
Download static/dashboard.html from Daaviid354541/mindstack-tracker: direct link, hf CLI and curl.
- Browser
- Download file 3.77 kB
-
https://huggingface.co/spaces/Daaviid354541/mindstack-tracker/resolve/main/static/dashboard.html
- Command line
-
hf download hf://spaces/Daaviid354541/mindstack-tracker/static/dashboard.html
-
curl -L -o dashboard.html https://huggingface.co/spaces/Daaviid354541/mindstack-tracker/resolve/main/static/dashboard.html
3.77 kB
| <html lang="fr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Mindstack Dashboard</title> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
| <style> | |
| body { font-family: sans-serif; background: #0f0f1a; color: #e0e0e0; margin: 0; padding: 20px; } | |
| h1 { color: #a78bfa; } | |
| .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 24px 0; } | |
| .card { background: #1e1e2e; border-radius: 12px; padding: 20px; text-align: center; } | |
| .card .val { font-size: 2rem; font-weight: bold; color: #a78bfa; } | |
| .card .lbl { font-size: 0.85rem; color: #888; margin-top: 4px; } | |
| .charts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; } | |
| canvas { background: #1e1e2e; border-radius: 12px; padding: 16px; } | |
| @media(max-width:600px){ .charts { grid-template-columns: 1fr; } } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>π Mindstack Tracker</h1> | |
| <div class="grid"> | |
| <div class="card"><div class="val" id="sessions">β</div><div class="lbl">Sessions</div></div> | |
| <div class="card"><div class="val" id="events">β</div><div class="lbl">Events</div></div> | |
| <div class="card"><div class="val" id="taux_achat">β</div><div class="lbl">Taux achat</div></div> | |
| <div class="card"><div class="val" id="revenu">β</div><div class="lbl">Revenu total</div></div> | |
| <div class="card"><div class="val" id="scroll">β</div><div class="lbl">Scroll moyen</div></div> | |
| <div class="card"><div class="val" id="temps">β</div><div class="lbl">Temps moyen</div></div> | |
| </div> | |
| <div class="charts"> | |
| <canvas id="abChart"></canvas> | |
| <canvas id="srcChart"></canvas> | |
| <canvas id="hourlyChart" style="grid-column: span 2"></canvas> | |
| </div> | |
| <script> | |
| const COLORS = ["#a78bfa","#34d399","#f472b6","#60a5fa","#fbbf24"]; | |
| async function load() { | |
| const r = await fetch("/stats"); | |
| const d = await r.json(); | |
| document.getElementById("sessions").textContent = d.total_sessions; | |
| document.getElementById("events").textContent = d.total_events; | |
| document.getElementById("taux_achat").textContent = d.taux_achat + "%"; | |
| document.getElementById("revenu").textContent = d.revenu_total + "β¬"; | |
| document.getElementById("scroll").textContent = d.scroll_moyen + "%"; | |
| document.getElementById("temps").textContent = d.temps_moyen_s + "s"; | |
| // A/B Chart | |
| new Chart(document.getElementById("abChart"), { | |
| type: "bar", | |
| data: { | |
| labels: Object.keys(d.ab_taux_conv), | |
| datasets: [{ | |
| label: "Taux conversion % par variant", | |
| data: Object.values(d.ab_taux_conv), | |
| backgroundColor: COLORS | |
| }] | |
| }, | |
| options: { plugins: { legend: { labels: { color: "#e0e0e0" } } }, scales: { x: { ticks: { color: "#e0e0e0" } }, y: { ticks: { color: "#e0e0e0" } } } } | |
| }); | |
| // Source Chart | |
| new Chart(document.getElementById("srcChart"), { | |
| type: "doughnut", | |
| data: { | |
| labels: Object.keys(d.src_distribution), | |
| datasets: [{ data: Object.values(d.src_distribution), backgroundColor: COLORS }] | |
| }, | |
| options: { plugins: { legend: { labels: { color: "#e0e0e0" } }, title: { display: true, text: "Sources", color: "#e0e0e0" } } } | |
| }); | |
| // Hourly Chart | |
| new Chart(document.getElementById("hourlyChart"), { | |
| type: "line", | |
| data: { | |
| labels: d.hourly.map(h => h.h), | |
| datasets: [{ | |
| label: "Events / heure", | |
| data: d.hourly.map(h => h.n), | |
| borderColor: "#a78bfa", | |
| backgroundColor: "rgba(167,139,250,0.1)", | |
| fill: true, | |
| tension: 0.3 | |
| }] | |
| }, | |
| options: { plugins: { legend: { labels: { color: "#e0e0e0" } } }, scales: { x: { ticks: { color: "#888", maxTicksLimit: 12 } }, y: { ticks: { color: "#e0e0e0" } } } } | |
| }); | |
| } | |
| load(); | |
| setInterval(load, 30000); // refresh toutes les 30s | |
| </script> | |
| </body> | |
| </html> | |