https://github.com/simplestats-io/laravel-client
Official Laravel client for SimpleStats.io
https://github.com/simplestats-io/laravel-client
analytics api laravel php statistics
Last synced: 2 months ago
JSON representation
Official Laravel client for SimpleStats.io
- Host: GitHub
- URL: https://github.com/simplestats-io/laravel-client
- Owner: simplestats-io
- License: gpl-3.0
- Created: 2023-06-23T17:41:53.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2026-04-10T20:38:51.000Z (2 months ago)
- Last Synced: 2026-04-10T22:21:50.203Z (2 months ago)
- Topics: analytics, api, laravel, php, statistics
- Language: PHP
- Homepage: https://simplestats.io/docs
- Size: 212 KB
- Stars: 47
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Client for SimpleStats.io
[](https://packagist.org/packages/simplestats-io/laravel-client)
[](https://github.com/simplestats-io/laravel-client/actions/workflows/run-tests.yml)
[](https://github.com/simplestats-io/laravel-client/actions/workflows/fix-php-code-style-issues.yml)
[](https://packagist.org/packages/simplestats-io/laravel-client)
This is the official Laravel client to send tracking data to [https://simplestats.io](https://simplestats.io)
## Introduction
_**SimpleStats**_ is **analytics for Laravel**. Track **visitors**, **registrations**, and **payments**. Discover which channels actually drive **revenue**, not just traffic. With server-side tracking and filtering via [UTM](https://en.wikipedia.org/wiki/UTM_parameters) codes, you get detailed analysis of **marketing** efforts and clearly see which channels drive **revenue**. Effortlessly evaluate **ROI**, identify cost-effective user acquisition channels, and pinpoint the most effective performance channels. _SimpleStats_ is fully **GDPR compliant**, **ad-blocker proof**, and ships with a minimalistic, straightforward installation process.

## Installation
You can install the client package via composer:
```bash
composer require simplestats-io/laravel-client
```
You should publish the config file with:
```bash
php artisan vendor:publish --tag="simplestats-client-config"
```
This is the default content of the config file, tweak it to your needs:
```php
use App\Models\User;
use Illuminate\Auth\Events\Login;
return [
/*
|--------------------------------------------------------------------------
| SimpleStats Settings
|--------------------------------------------------------------------------
|
| SimpleStats is enabled by default. Disabling it will stop tracking your stats.
|
| You can provide an array of URI's that must be ignored (eg. 'api/*')
*/
'enabled' => env('SIMPLESTATS_ENABLED', true),
'except' => [
'telescope*',
'horizon*',
'pulse*',
'admin*',
'api*',
],
/*
|--------------------------------------------------------------------------
| SimpleStats Blocked IPs
|--------------------------------------------------------------------------
|
| Define IP addresses or CIDR ranges that should be excluded from tracking.
| Supports single IPs (e.g. '192.168.1.1') and CIDR notation (e.g. '10.0.0.0/8').
|
*/
'blocked_ips' => [
// '192.168.1.1',
// '10.0.0.0/8',
// '172.16.0.0/12',
],
/*
|--------------------------------------------------------------------------
| SimpleStats API Credentials
|--------------------------------------------------------------------------
|
| Define your API credentials here. If you are not told to change the API URL,
| just keep the default. It's important to set an API token! You'll receive
| one, after creating your team and project on https://simplestats.io
|
*/
'api_url' => env('SIMPLESTATS_API_URL', 'https://simplestats.io/api/v1/'),
'api_token' => env('SIMPLESTATS_API_TOKEN'),
/*
|--------------------------------------------------------------------------
| SimpleStats Queue
|--------------------------------------------------------------------------
|
| To avoid the tracking API calls block the whole request and for fault tolerance,
| we highly recommend using Laravel's built-in queue-system. Here you can define
| to which queue the tracking API calls should be dispatched and handled by.
|
*/
'queue' => env('SIMPLESTATS_QUEUE', 'default'),
/*
|--------------------------------------------------------------------------
| SimpleStats Tracking Codes
|--------------------------------------------------------------------------
|
| Below you can set your tracking code URL param names. We already set some
| classical defaults for you, but you're free to change them as you like.
| Note that only the params which are listed here are getting tracked!
|
*/
'tracking_codes' => [
'source' => ['utm_source', 'ref', 'referer', 'referrer'],
'medium' => ['utm_medium', 'adGroup', 'adGroupId'],
'campaign' => ['utm_campaign'],
'term' => ['utm_term'],
'content' => ['utm_content'],
],
/*
|--------------------------------------------------------------------------
| SimpleStats Tracking Types
|--------------------------------------------------------------------------
|
| Here you can set three different tracking types. The first is the login
| event. If this event gets dispatched, we track a login. The second is
| the user model. If such a model is created, we track a registration.
|
| As the payment model is named very individually, we did not set any default here.
| Give it the name of the model which holds your payments or transactions data.
|
| See: https://simplestats.io/docs
|
*/
'tracking_types' => [
'login' => [
'event' => Login::class,
],
// Make sure this model implements the TrackablePerson or
// the TrackablePersonWithCondition Contract
'user' => [
'model' => User::class,
],
// Make sure this model implements the TrackablePayment or
// the TrackablePaymentWithCondition contract
'payment' => [
'model' => null,
],
],
];
```
## Documentation
Check out the full documentation here: [Official SimpleStats.io Documentation](https://simplestats.io/docs)
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Zacharias Creutznacher](https://github.com/sairahcaz)
- [All Contributors](../../contributors)
## License
GNU General Public License v3.0 or later. Please see [License File](LICENSE) for more information.