Download the PHP package pirsch-analytics/laravel-pirsch without Composer
On this page you can find all versions of the php package pirsch-analytics/laravel-pirsch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pirsch-analytics/laravel-pirsch
More information about pirsch-analytics/laravel-pirsch
Files in pirsch-analytics/laravel-pirsch
Package laravel-pirsch
Short Description Official Laravel integration for Pirsch Analytics.
License MIT
Homepage https://github.com/pirsch-analytics/laravel-pirsch
Informations about the package laravel-pirsch
Pirsch for Laravel
This package is the official Laravel integration for Pirsch Analytics.
Installation
-
Install this package:
-
Add the Pirsch access token to your
.env
file. Leave it empty in non-production environments to disable tracking:- Visit the Pirsch "Integration" settings page.
- Make sure the correct domain is selected in the top left corner of the page.
- Scroll down to the "Clients" section and press the "Add Client" button.
- Select "Access Key (write-only)" as type and enter a description.
- Press the "Create Client" button and copy the generated "Client secret".
- Add the copied token to your
.env
file:
Usage
Track pageviews
Automatically
This package comes with a TrackPageview
middleware that allows you to track pageviews automatically.
Apply the middleware to your web routes by appending it in the withMiddleware
method in your bootstrap/app.php
file:
Manually
If you want to manually track pageviews instead, you can use the Pirsch::track()
method.
Calling this method without any arguments will track a pageview for the current HTTP request:
Track events
Pirsch allows you to track custom events in order to measure additional information.
You can use the Pirsch::track()
method with a name and optional metadata to track an event:
All versions of laravel-pirsch with dependencies
illuminate/contracts Version ^9.0|^10.0|^11.0
illuminate/http Version ^9.0|^10.0|^11.0
spatie/laravel-package-tools Version ^1.9.2