Using Laravel Livewire's "wire:navigate" with Fathom Analytics
Published on by Eric L. Barnes
We use Fathom Analytics here on Laravel News, and we use Livewires wire:navigate
feature to prevent full browser page reloading, but in the process, we discovered a side effect of not allowing analytics to track clicks.
If you ever run into this, Livewire offers some events that you can tap into to force the tracking.
document.addEventListener('livewire:navigated', function() { if (window.fathom) { window.fathom.trackPageview() }})
Many thanks to rinas for the idea from using Fathom with Turbolinks.
Eric is the creator of Laravel News and has been covering Laravel since 2012.