Compare commits

...

2 commits

Author SHA1 Message Date
89b004c262
fix: 📈 record analytics when visitors agree instead of next page load
Only recording at next page load loses the referrer where a visit originated from
2025-07-28 18:31:52 +02:00
b322ef9759
style: 📈 move constants to the top 2025-07-28 18:27:19 +02:00

View file

@ -6,22 +6,27 @@
const noBtn = ackeeBanner.querySelector('.negative');
const confirmKey = 'ackeeDetailed';
yesBtn.addEventListener('click', () => localStorage.setItem(confirmKey, true));
const ackeeServer = 'https://ackee.sebin-nyshkim.net';
const ackeeDomainId = 'e60cc3de-916c-424c-ac6e-2fd43d41e240';
const ackeeOpts = { detailed: true };
const record = (server, domainId, options) => {
const instance = ackeeTracker.create(server, options);
instance.record(domainId);
};
yesBtn.addEventListener('click', () => {
localStorage.setItem(confirmKey, true);
record(ackeeServer, ackeeDomainId, ackeeOpts);
});
noBtn.addEventListener('click', () => localStorage.setItem(confirmKey, false));
if (localStorage.getItem(confirmKey) === null) {
ackeeBanner.show();
}
const ackeeServer = 'https://ackee.sebin-nyshkim.net';
const ackeeDomainId = 'e60cc3de-916c-424c-ac6e-2fd43d41e240';
const ackeeOpts = {
detailed: localStorage.getItem(confirmKey) === 'true'
};
if (localStorage.getItem(confirmKey) === 'true') {
const instance = ackeeTracker.create(ackeeServer, ackeeOpts);
instance.record(ackeeDomainId);
record(ackeeServer, ackeeDomainId, ackeeOpts);
}
</script>