Looking to hire Laravel developers? Try LaraJobs

laravel-goatcounter maintained by jeffersongoncalves

Description
GoatCounter for Laravel: inject the tracking script in your Blade layouts, with the settings stored in the database via spatie/laravel-settings.
Last update
2026/10/10 21:51 (dev-main)
License
Downloads
31

Comments
comments powered by Disqus

Laravel GoatCounter

Laravel GoatCounter

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

Add GoatCounter — open source, privacy-friendly web analytics — to your Laravel app. The settings are stored in the database with spatie/laravel-settings, so you can change them at runtime (e.g. from an admin panel) instead of in .env.

For a Filament settings page, use jeffersongoncalves/filament-goatcounter.

Installation

composer require jeffersongoncalves/laravel-goatcounter

Publish and run the settings migration:

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

Configuration

$settings = goatcounter_settings();
$settings->code = 'mysite';
$settings->save();

Or through the settings class or the Facade:

use JeffersonGoncalves\GoatCounter\Facades\GoatCounter;
use JeffersonGoncalves\GoatCounter\Settings\GoatCounterSettings;

$settings = app(GoatCounterSettings::class);
$value = GoatCounter::getFacadeRoot()->code;

Available settings

Setting Type Default Description
code ?string null Your GoatCounter code. The script only renders when it is valid.

Usage

Add the script to your Blade layout, inside <head>:

@include('goatcounter::script')

Nothing is rendered until the settings are complete, so you can ship the include everywhere and turn GoatCounter on later.

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.