Daaviid354541 commited on
Commit
b6ba491
Β·
verified Β·
1 Parent(s): 9818901

Rename static/Nouveau Document texte.txt to static/dashboard.html

Browse files
static/Nouveau Document texte.txt DELETED
File without changes
static/dashboard.html ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="fr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Mindstack Dashboard</title>
6
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
7
+ <style>
8
+ body { font-family: sans-serif; background: #0f0f1a; color: #e0e0e0; margin: 0; padding: 20px; }
9
+ h1 { color: #a78bfa; }
10
+ .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 24px 0; }
11
+ .card { background: #1e1e2e; border-radius: 12px; padding: 20px; text-align: center; }
12
+ .card .val { font-size: 2rem; font-weight: bold; color: #a78bfa; }
13
+ .card .lbl { font-size: 0.85rem; color: #888; margin-top: 4px; }
14
+ .charts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
15
+ canvas { background: #1e1e2e; border-radius: 12px; padding: 16px; }
16
+ @media(max-width:600px){ .charts { grid-template-columns: 1fr; } }
17
+ </style>
18
+ </head>
19
+ <body>
20
+ <h1>πŸ“Š Mindstack Tracker</h1>
21
+
22
+ <div class="grid">
23
+ <div class="card"><div class="val" id="sessions">β€”</div><div class="lbl">Sessions</div></div>
24
+ <div class="card"><div class="val" id="events">β€”</div><div class="lbl">Events</div></div>
25
+ <div class="card"><div class="val" id="taux_achat">β€”</div><div class="lbl">Taux achat</div></div>
26
+ <div class="card"><div class="val" id="revenu">β€”</div><div class="lbl">Revenu total</div></div>
27
+ <div class="card"><div class="val" id="scroll">β€”</div><div class="lbl">Scroll moyen</div></div>
28
+ <div class="card"><div class="val" id="temps">β€”</div><div class="lbl">Temps moyen</div></div>
29
+ </div>
30
+
31
+ <div class="charts">
32
+ <canvas id="abChart"></canvas>
33
+ <canvas id="srcChart"></canvas>
34
+ <canvas id="hourlyChart" style="grid-column: span 2"></canvas>
35
+ </div>
36
+
37
+ <script>
38
+ const COLORS = ["#a78bfa","#34d399","#f472b6","#60a5fa","#fbbf24"];
39
+
40
+ async function load() {
41
+ const r = await fetch("/stats");
42
+ const d = await r.json();
43
+
44
+ document.getElementById("sessions").textContent = d.total_sessions;
45
+ document.getElementById("events").textContent = d.total_events;
46
+ document.getElementById("taux_achat").textContent = d.taux_achat + "%";
47
+ document.getElementById("revenu").textContent = d.revenu_total + "€";
48
+ document.getElementById("scroll").textContent = d.scroll_moyen + "%";
49
+ document.getElementById("temps").textContent = d.temps_moyen_s + "s";
50
+
51
+ // A/B Chart
52
+ new Chart(document.getElementById("abChart"), {
53
+ type: "bar",
54
+ data: {
55
+ labels: Object.keys(d.ab_taux_conv),
56
+ datasets: [{
57
+ label: "Taux conversion % par variant",
58
+ data: Object.values(d.ab_taux_conv),
59
+ backgroundColor: COLORS
60
+ }]
61
+ },
62
+ options: { plugins: { legend: { labels: { color: "#e0e0e0" } } }, scales: { x: { ticks: { color: "#e0e0e0" } }, y: { ticks: { color: "#e0e0e0" } } } }
63
+ });
64
+
65
+ // Source Chart
66
+ new Chart(document.getElementById("srcChart"), {
67
+ type: "doughnut",
68
+ data: {
69
+ labels: Object.keys(d.src_distribution),
70
+ datasets: [{ data: Object.values(d.src_distribution), backgroundColor: COLORS }]
71
+ },
72
+ options: { plugins: { legend: { labels: { color: "#e0e0e0" } }, title: { display: true, text: "Sources", color: "#e0e0e0" } } }
73
+ });
74
+
75
+ // Hourly Chart
76
+ new Chart(document.getElementById("hourlyChart"), {
77
+ type: "line",
78
+ data: {
79
+ labels: d.hourly.map(h => h.h),
80
+ datasets: [{
81
+ label: "Events / heure",
82
+ data: d.hourly.map(h => h.n),
83
+ borderColor: "#a78bfa",
84
+ backgroundColor: "rgba(167,139,250,0.1)",
85
+ fill: true,
86
+ tension: 0.3
87
+ }]
88
+ },
89
+ options: { plugins: { legend: { labels: { color: "#e0e0e0" } } }, scales: { x: { ticks: { color: "#888", maxTicksLimit: 12 } }, y: { ticks: { color: "#e0e0e0" } } } }
90
+ });
91
+ }
92
+
93
+ load();
94
+ setInterval(load, 30000); // refresh toutes les 30s
95
+ </script>
96
+ </body>
97
+ </html>