feat: add analytics init, identify, search tracking, consent header, settings toggle

This commit is contained in:
ashim-hq
2026-04-22 19:14:16 +08:00
parent f115275796
commit 6e319efadd
4 changed files with 122 additions and 2 deletions
+10
View File
@@ -60,6 +60,16 @@ export function formatHeaders(init?: HeadersInit): Headers {
if (token) {
headers.set("Authorization", `Bearer ${token}`);
}
if (!token) {
try {
const consent = localStorage.getItem("ashim-analytics-consent");
if (consent === "true" || consent === "false") {
headers.set("X-Analytics-Consent", consent);
}
} catch {
// localStorage unavailable
}
}
return headers;
}