jeffersongoncalves/laravel-fathom

This Laravel package seamlessly integrates Fathom analytics into your Blade templates. Easily track website visits and user engagement directly within your Laravel application, providing valuable insights into your website's performance. This package simplifies the integration process, saving you time and effort. With minimal configuration, you can leverage Fathom's powerful analytics features to gain a clearer understanding of your audience and website usage.
1,097 2
Install
composer require jeffersongoncalves/laravel-fathom
Latest Version:4.0.0
PHP:^8.2|^8.3|^8.4
License:MIT
Last Updated:Sep 6, 2026
Links: GitHub  ·  Packagist
Maintainer: jeffersongoncalves

Laravel Fathom

Laravel Fathom

Buy Me A Coffee

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

This Laravel package seamlessly integrates Fathom analytics into your Blade templates. Easily track website visits and user engagement directly within your Laravel application, providing valuable insights into your website's performance. This package simplifies the integration process, saving you time and effort. With minimal configuration, you can leverage Fathom's powerful analytics features to gain a clearer understanding of your audience and website usage.

Settings are stored in the database using spatie/laravel-settings, allowing you to manage them dynamically (e.g., via an admin panel) without relying on .env files.

Installation

You can install the package via composer:

composer require jeffersongoncalves/laravel-fathom

Publish and run the settings migration:

php artisan vendor:publish --tag=fathom-settings-migrations
php artisan migrate

Configuration

All settings are managed exclusively from the database after running the migration. You can update them programmatically:

use JeffersonGoncalves\Fathom\Settings\FathomSettings;

$settings = app(FathomSettings::class);
$settings->website_id = 'NEW_SITE_ID';
$settings->spa = 'history';
$settings->save();

Or use the helper function:

$settings = fathom_settings();
$settings->website_id = 'NEW_SITE_ID';
$settings->save();

Or use the Facade. The facade resolves the underlying FathomSettings instance, so read or write properties through getFacadeRoot():

use JeffersonGoncalves\Fathom\Facades\Fathom;

// Read a value
$websiteId = Fathom::getFacadeRoot()->website_id;

// Update and persist
$settings = Fathom::getFacadeRoot();
$settings->website_id = 'NEW_SITE_ID';
$settings->save();

Available settings

Setting Type Default Description
website_id ?string null Your Fathom site ID. The script only renders when this is set.
canonical bool true When false, sends data-canonical="false" to ignore canonical URLs.
auto bool true Controls data-auto-track (automatic pageview tracking).
spa ?string null SPA tracking mode (e.g. history, hash, auto).
honor_dnt ?bool null When truthy, sends data-honor-dnt="true" to respect Do Not Track.

Usage

Add the Fathom script to your Blade layout (typically in <head>):

@include('fathom::script')

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

jeffersongoncalves/filament-cookie-consent

This Filament package provides a simple and elegant way to implement cookie cons...

14,776 8
jeffersongoncalves/filament-cep-field

The Filament CEP Field is a custom input component designed specifically for Bra...

4,489 8
jeffersongoncalves/filament-refresh-sidebar

Automatically refresh the Filament sidebar navigation when certain events occur,...

2,543 11
jeffersongoncalves/filament-logo

A simple yet effective Filament plugin that automatically adds the Filament logo...

13,517 5
jeffersongoncalves/filament-ace-editor-field

A Laravel Filament v4 field that integrates the Ace code editor into your forms,...

10,311 4