You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

15 lines
421 B

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;
}
});
}
}