oh my god has a more substational change happened to this app yet? i
don't think so!!!! #WORSTBESTMAYBEANALYTICSEVER
This commit is contained in:
parent
2928ef3c45
commit
9141f5424d
2 changed files with 14 additions and 3 deletions
|
|
@ -1,7 +1,18 @@
|
||||||
(() => {
|
(() => {
|
||||||
const API = "some_misc_string"; // this is replaced when JS is requested, do not worry
|
const API = "some_misc_string"; // this is replaced when JS is requested, do not worry
|
||||||
const SITE = "some_site_string"; // same with this
|
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 SESSION_ID = crypto.randomUUID();
|
||||||
const USER_ID =
|
const USER_ID =
|
||||||
localStorage.getItem("analytics_uid") ||
|
localStorage.getItem("analytics_uid") ||
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ client.collectDefaultMetrics({ register });
|
||||||
const eventCounter = new client.Counter({
|
const eventCounter = new client.Counter({
|
||||||
name: "web_event_total",
|
name: "web_event_total",
|
||||||
help: "Aggregated event counts",
|
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({
|
const durationHist = new client.Histogram({
|
||||||
|
|
@ -155,7 +155,7 @@ app.post("/some-cool-endpoint", (req, res) => {
|
||||||
} catch (err) {
|
} 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) {
|
if (e.type === "click" && e.label) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue