Quantcast
Channel: Laravel News
Viewing all articles
Browse latest Browse all 1793

Using Laravel Livewire's "wire:navigate" with Fathom Analytics

$
0
0

Using Laravel Livewire's "wire:navigate" with Fathom Analytics


We use Fathom Analytics here on Laravel News, and we use the 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.

The post Using Laravel Livewire's "wire:navigate" with Fathom Analytics appeared first on Laravel News.

Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.


Viewing all articles
Browse latest Browse all 1793

Trending Articles