PHPackages                             simplestats-io/laravel-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. simplestats-io/laravel-client

ActiveLibrary[API Development](/categories/api)

simplestats-io/laravel-client
=============================

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

v5.1.0(2w ago)5226.7k↑32.7%7MITPHPPHP ^8.2CI passing

Since Mar 26Pushed 2w ago1 watchersCompare

[ Source](https://github.com/simplestats-io/laravel-client)[ Packagist](https://packagist.org/packages/simplestats-io/laravel-client)[ Docs](https://github.com/simplestats-io/laravel-client)[ RSS](/packages/simplestats-io-laravel-client/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (90)Versions (48)Used By (0)

Laravel Client for SimpleStats.io
=================================

[](#laravel-client-for-simplestatsio)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7a72541f80823cac44374eb9465600b2d801011e6b816d74f0b8be7874f5812a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696d706c6573746174732d696f2f6c61726176656c2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/simplestats-io/laravel-client)[![Tests](https://github.com/simplestats-io/laravel-client/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/simplestats-io/laravel-client/actions/workflows/run-tests.yml)[![Check & fix styling](https://github.com/simplestats-io/laravel-client/actions/workflows/fix-php-code-style-issues.yml/badge.svg?branch=main)](https://github.com/simplestats-io/laravel-client/actions/workflows/fix-php-code-style-issues.yml)[![License](https://camo.githubusercontent.com/4d287146a8ce2421de7353f54eba7b398215c66e1cfb390e2dd25dd6969657bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73696d706c6573746174732d696f2f6c61726176656c2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/simplestats-io/laravel-client)[![Laravel Compatibility](https://camo.githubusercontent.com/4ce5306913e7cc55f9f6b71b5c14ac899dc186c7af9772118edeac4705552b28/68747470733a2f2f62616467652e6c61726176656c2e636c6f75642f62616467652f73696d706c6573746174732d696f2f6c61726176656c2d636c69656e74)](https://packagist.org/packages/simplestats-io/laravel-client)

This is the official Laravel client to send tracking data to

Introduction
------------

[](#introduction)

***SimpleStats*** is server-side **analytics for Laravel** that follows the whole funnel: from the first **visit**, through **registration**, to every **payment**, tied back to the [UTM](https://en.wikipedia.org/wiki/UTM_parameters) source or referrer that caused it. So you see not just traffic, but which **channels** actually drive **revenue**.

That is the part no other tool covers: web analytics (Plausible, Fathom) never see your payments, and subscription analytics (Baremetrics, ProfitWell) never see your acquisition channels. SimpleStats sits in between and goes deeper where it matters: **MRR / ARR**, **churn** and **retention** for subscription apps, and **ROAS / CAC / LTV:CAC** once you add your ad spend per campaign. It is fully **GDPR compliant**, **ad-blocker proof**, and ships with a minimalistic, straightforward installation process.

[![screenshot](https://camo.githubusercontent.com/6ceccc3ebb9862cafd664150e82380869bc27ae07fd11cb69c61e53e98d18603/68747470733a2f2f73696d706c6573746174732e696f2f696d616765732f73637265656e73686f742e706e67)](https://camo.githubusercontent.com/6ceccc3ebb9862cafd664150e82380869bc27ae07fd11cb69c61e53e98d18603/68747470733a2f2f73696d706c6573746174732e696f2f696d616765732f73637265656e73686f742e706e67)

Installation
------------

[](#installation)

You can install the client package via composer:

```
composer require simplestats-io/laravel-client
```

You should publish the config file with:

```
php artisan vendor:publish --tag="simplestats-client-config"
```

This is the default content of the config file, tweak it to your needs:

```
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*',
    ],

    /*
     |--------------------------------------------------------------------------
     | 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 Log Errors
     |--------------------------------------------------------------------------
     |
     | When enabled, the client will log API error responses (4xx, 5xx) to your
     | application log on every failed attempt. Transient errors like connection
     | timeouts are only logged on the final retry attempt.
     |
     */

    'log_errors' => env('SIMPLESTATS_LOG_ERRORS', false),

    /*
     |--------------------------------------------------------------------------
     | SimpleStats Middleware Groups
     |--------------------------------------------------------------------------
     |
     | Which middleware group(s) the CheckTracking middleware is appended to.
     | Pick what matches your setup:
     |
     | - ['web']         : classic server-rendered apps (Blade, Inertia, Livewire)
     | - ['api']         : headless / SPA frontends that only ever hit your API
     | - ['web', 'api']  : hybrid setups (e.g. Blade marketing + SPA dashboard)
     |
     */

    'middleware_groups' => ['web'],

    /*
     |--------------------------------------------------------------------------
     | SimpleStats Tracking Storage
     |--------------------------------------------------------------------------
     |
     | Where to persist a visitor's attribution (UTMs, referer, entry page) so
     | it survives across requests in the same day.
     |
     | - 'session' (default): stores the data in the user's session. Requires a
     |   session cookie and works only in classic, session-bound Laravel apps.
     |   Survives mobile IP changes because the cookie identifies the user.
     |
     | - 'cache': stores the data in Laravel's cache keyed by a daily hash of
     |   IP + User-Agent. Works in stateless / headless setups (JWT, SPA on a
     |   separate domain) where no session cookie is available. Loses precision
     |   when the visitor's IP changes (mobile network switches), which is the
     |   same trade-off privacy-first tools like Plausible and Fathom make to
     |   stay cookie- and consent-free.
     |
     */

    'tracking_storage' => 'session',

    /*
     |--------------------------------------------------------------------------
     | SimpleStats Beacon
     |--------------------------------------------------------------------------
     |
     | Only needed if your pages are served from a static cache that bypasses
     | PHP entirely (Statamic "full measure" static caching, nginx/Varnish page
     | caching, Cloudflare "Cache Everything", ...). In that case the tracking
     | middleware never runs and those visits are lost.
     |
     | Enabling this registers a tiny GET endpoint that returns a 1x1 pixel.
     | Cached pages request it once per page view, which gives the middleware
     | a real request to track. Add the snippet from the docs to your layout:
     |
     | https://simplestats.io/docs/static-caching
     |
     | The route is registered in the first group listed in middleware_groups,
     | so it always carries the tracking middleware.
     |
     | Pick a path that looks like a regular asset: paths containing "track",
     | "stats", "analytics", "beacon", "collect" or "pixel" are blocked by
     | common ad blocker lists, and a path with a file extension may be cached
     | by your CDN before it ever reaches your app.
     |
     */

    'beacon' => [
        'enabled' => env('SIMPLESTATS_BEACON_ENABLED', false),
        'path' => env('SIMPLESTATS_BEACON_PATH', 'assets/v'),
    ],

    /*
     |--------------------------------------------------------------------------
     | 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'],
        '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,
        ],
    ],

    /*
     |--------------------------------------------------------------------------
     | SimpleStats Custom Properties Resolvers
     |--------------------------------------------------------------------------
     |
     | Optionally set classes that resolve custom properties whenever a user
     | or a visitor is tracked (e.g. an A/B test variant). The resolved
     | properties are sent along with the track itself.
     |
     | The user resolver must implement the ResolvesUserCustomProperties
     | contract, the visitor resolver the ResolvesVisitorCustomProperties
     | contract.
     |
     */

    'custom_properties_resolvers' => [
        'user' => null,
        'visitor' => null,
    ],
];
```

Bot Detection
-------------

[](#bot-detection)

Bot and crawler traffic is **filtered out automatically** before any tracking happens. This covers known bot signatures via [matomo/device-detector](https://github.com/matomo-org/device-detector), HTTP libraries (curl, python-requests, ...), headless browsers, scripted clients faking a real browser, and browser prefetch requests. This is enabled by default and requires no configuration.

Static Caching
--------------

[](#static-caching)

If your pages are served from a cache that bypasses PHP entirely (Statamic `full` measure static caching, nginx/Varnish page caching, Cloudflare "Cache Everything"), the tracking middleware never runs. Enable the `beacon` config option and add the snippet from [Static Caching &amp; CDNs](https://simplestats.io/docs/static-caching) to your layout.

Documentation
-------------

[](#documentation)

Check out the full documentation here: [Official SimpleStats.io Documentation](https://simplestats.io/docs)

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Zacharias Creutznacher](https://github.com/sairahcaz)
- [All Contributors](../../contributors)

License
-------

[](#license)

GNU General Public License v3.0 or later. Please see [License File](LICENSE) for more information.

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance96

Actively maintained with recent releases

Popularity42

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 85.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~19 days

Recently: every ~7 days

Total

46

Last Release

18d ago

Major Versions

v1.0.3 → v2.0.02024-07-15

v2.0.14 → v3.0.02024-11-25

v3.5.5 → v4.0.02026-05-20

v4.1.0 → v5.x-dev2026-06-29

v4.1.1 → v5.0.02026-07-02

PHP version history (3 changes)v1.0.0PHP ^8.1

v1.0.2PHP ^8.0 || ^7.4

v4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/cf347b32c0d1fceabbcbce7626ad662faa34738396fd9f774231d55370823713?d=identicon)[Sairahcaz](/maintainers/Sairahcaz)

---

Top Contributors

[![Sairahcaz](https://avatars.githubusercontent.com/u/7384870?v=4)](https://github.com/Sairahcaz "Sairahcaz (255 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (23 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (12 commits)")[![jhhazelaar](https://avatars.githubusercontent.com/u/215711?v=4)](https://github.com/jhhazelaar "jhhazelaar (7 commits)")[![dandoingdev](https://avatars.githubusercontent.com/u/3135215?v=4)](https://github.com/dandoingdev "dandoingdev (1 commits)")[![tomas-doudera](https://avatars.githubusercontent.com/u/32466344?v=4)](https://github.com/tomas-doudera "tomas-doudera (1 commits)")

---

Tags

analyticsapilaravelphpstatisticslaravelanalyticsgdprserver side trackingsimplestats-iosimplestats-clientrevenue-attributionmarketing-attribution

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/simplestats-io-laravel-client/health.svg)

```
[![Health](https://phpackages.com/badges/simplestats-io-laravel-client/health.svg)](https://phpackages.com/packages/simplestats-io-laravel-client)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M188](/packages/spatie-laravel-health)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1239.7k25](/packages/fleetbase-core-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
