Laravel Pirsch
This package is the official Laravel integration for Pirsch Analytics.
Installation
- Install this package.
composer require pirsch-analytics/laravel-pirsch
- Set the
PIRSCH_TOKEN
environment variable to your Pirsch access token. Leave it empty in non-production environments to disable tracking. - Optionally publish the configuration file.
php artisan vendor:publish --tag="pirsch-config"
Usage
Track pageviews
This package comes with a TrackPageview
middleware that sends a hit to Pirsch for the page visited in the current request. To track visits for certain routes, assign them the TrackPageview
middleware in your routes file:
Route::middleware(Pirsch\Http\Middleware\TrackPageview::class)