I'm using the hashMode property as true and the enableAutoPageviews method to start plausible tracker in my index.tsx file.
It's working as expect when I navigate between pages with hashes, except when I use the browser back button.
When I use the browser back button, plausible tracker is tracking the destination page twice.
Example: from /test#tab to /test
Probably because of:
const page = () => trackPageview();
// Attach pushState and popState listeners
const originalPushState = history.pushState;
if (originalPushState) {
// eslint-disable-next-line functional/immutable-data
history.pushState = function (data, title, url) {
originalPushState.apply(this, [data, title, url]);
page();
};
addEventListener('popstate', page); // track the browser back behavior
}
// Attach hashchange listener
if (defaults && defaults.hashMode) {
addEventListener('hashchange', page); // track when the hash changes from #tab to no hash fragment
}
I'm using the hashMode property as true and the enableAutoPageviews method to start plausible tracker in my index.tsx file. It's working as expect when I navigate between pages with hashes, except when I use the browser back button. When I use the browser back button, plausible tracker is tracking the destination page twice. Example: from /test#tab to /test Probably because of: