ARTICLE AD BOX
I set up Ahoy to work with my Rails app and ahoy.track each time a user loads a page. It's working neatly but I'd also like to track some more client-side actions such as a button clicks, moving around or a heartbeat (to check how long a user stays in the same page), so I followed the setup guide:
Set Ahoy.api = true
I tried both importing methods
yarn add ahoy.js + import ahoy from "ahoy.js" pin "ahoy", to: "ahoy.js" + import "ahoy"I added this bit of code to application.js:
document.addEventListener("turbo:load", () => { ahoy.trackAll(); });With the first importing method, I get the error:
Uncaught TypeError: Failed to resolve module specifier "ahoy.js". Relative references must start with either "/", "./", or "../".and with the second importing method I get:
Uncaught TypeError: ahoy.trackAll is not a function at HTMLDocument.<anonymous>How can I solve this and get ahoy.js to track events?
