import { Controller } from "@hotwired/stimulus"
|
|
|
|
let lastTrackedUrl = null;
|
|
|
|
export default class extends Controller {
|
|
connect() {
|
|
document.addEventListener("turbo:load", () => {
|
|
const currentUrl = window.location.pathname + window.location.search;
|
|
if (window.plausible && currentUrl !== lastTrackedUrl) {
|
|
window.plausible("pageview");
|
|
lastTrackedUrl = currentUrl;
|
|
}
|
|
});
|
|
}
|
|
}
|