regenbogenkarte/ts/goatcounter.ts
nachtjasmin b15bfc0a73 feat: add goatcounter integration
To enable the goatcounter integration, the variable
VITE_QUEER_LEXIKON_PRIVATE must be set to "true". This check is
intentionally added for development environments so that all dev
environments from possible forks do not modify the statistics by
accident.
2022-09-08 17:10:49 +02:00

22 lines
493 B
TypeScript

declare global {
interface Window {
goatcounter: {
path: (p: any) => string;
};
}
}
export const addGoatCounter = () => {
window.goatcounter = {
path: function (p: any) {
return location.host + p;
},
};
let goatcounter = document.createElement("script");
goatcounter.src = "//ziege.queer-lexikon.net/count.js";
goatcounter.async = true;
goatcounter.setAttribute("data-goatcounter", "https://ziege.queer-lexikon.net/count");
document.head.appendChild(goatcounter);
};