Laravel Tutorials

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

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

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 L. Barnes photo

Eric is the creator of Laravel News and has been covering Laravel since 2012.

Sponsored

serpapi logo
SerpApi

The Web Search API for Your LLM and AI Applications

Visit SerpApi

The latest

View all →
Agent Run Observability in Laravel AI SDK 0.11 image

Agent Run Observability in Laravel AI SDK 0.11

Read article
Debounced Queued Event Listeners in Laravel image

Debounced Queued Event Listeners in Laravel

Read article
Statamic Mailables Viewer Previews Laravel Emails in the Control Panel image

Statamic Mailables Viewer Previews Laravel Emails in the Control Panel

Read article
Laravel Tackle: Run an AI Coding Agent in Your Laravel App image

Laravel Tackle: Run an AI Coding Agent in Your Laravel App

Read article
Queue::forward(): Reroute Laravel Queues in One Place image

Queue::forward(): Reroute Laravel Queues in One Place

Read article
Laravel Read-Through Filesystem: Lazy Storage Migration image

Laravel Read-Through Filesystem: Lazy Storage Migration

Read article