oh my god has a more substational change happened to this app yet? i

don't think so!!!! #WORSTBESTMAYBEANALYTICSEVER
This commit is contained in:
Soph :3 2025-11-02 13:20:39 +02:00
parent 2928ef3c45
commit 9141f5424d
2 changed files with 14 additions and 3 deletions

View file

@ -1,7 +1,18 @@
(() => {
const API = "some_misc_string"; // this is replaced when JS is requested, do not worry
const SITE = "some_site_string"; // same with this
console.log("worst analytics ever v1 " + API + " on site " + SITE)
let background = `background: linear-gradient(90deg,rgba(255, 0, 0, 1) 0%, rgba(0, 0, 0, 0.01) 95%);font-weight:bolder`;
console.log(
"%c" + (Math.random() > 0.5 ? "Best" : "Worst") +
"%c analytics ever v2 %c" + API + "%c on site %c" + SITE,
background,
"",
background,
"",
background
);
const SESSION_ID = crypto.randomUUID();
const USER_ID =
localStorage.getItem("analytics_uid") ||

View file

@ -66,7 +66,7 @@ client.collectDefaultMetrics({ register });
const eventCounter = new client.Counter({
name: "web_event_total",
help: "Aggregated event counts",
labelNames: ["site", "type", "path", "country", "device", "browser", "os"],
labelNames: ["site", "type", "path", "country", "device", "browser", "os", "session_id"],
});
const durationHist = new client.Histogram({
@ -155,7 +155,7 @@ app.post("/some-cool-endpoint", (req, res) => {
} catch (err) {
}
eventCounter.labels(site, e.type, path, country, device, browser, os).inc();
eventCounter.labels(site, e.type, path, country, device, browser, os, e.sessionId || "unknown").inc();
if (e.type === "click" && e.label) {
try {