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
This commit is contained in:
parent
b322ef9759
commit
89b004c262
1 changed files with 10 additions and 3 deletions
|
@ -10,7 +10,15 @@
|
|||
const ackeeDomainId = 'e60cc3de-916c-424c-ac6e-2fd43d41e240';
|
||||
const ackeeOpts = { detailed: true };
|
||||
|
||||
yesBtn.addEventListener('click', () => localStorage.setItem(confirmKey, 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) {
|
||||
|
@ -18,8 +26,7 @@
|
|||
}
|
||||
|
||||
if (localStorage.getItem(confirmKey) === 'true') {
|
||||
const instance = ackeeTracker.create(ackeeServer, ackeeOpts);
|
||||
instance.record(ackeeDomainId);
|
||||
record(ackeeServer, ackeeDomainId, ackeeOpts);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue