PHPackages                             jeffersongoncalves/laravel-mixpanel - 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. jeffersongoncalves/laravel-mixpanel

ActiveLibrary[API Development](/categories/api)

jeffersongoncalves/laravel-mixpanel
===================================

This Laravel package seamlessly integrates Mixpanel analytics into your Blade templates. Easily track user interactions and product usage directly within your Laravel application using the Mixpanel JavaScript SDK, with all configuration managed via database settings.

v1.0.4(1mo ago)2371MITPHPPHP ^8.2|^8.3CI passing

Since Feb 23Pushed 1w ago1 watchersCompare

[ Source](https://github.com/jeffersongoncalves/laravel-mixpanel)[ Packagist](https://packagist.org/packages/jeffersongoncalves/laravel-mixpanel)[ Docs](https://github.com/jeffersongoncalves/laravel-mixpanel)[ GitHub Sponsors](https://github.com/jeffersongoncalves)[ RSS](/packages/jeffersongoncalves-laravel-mixpanel/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (5)Dependencies (21)Versions (7)Used By (1)

[![Laravel Mixpanel](https://raw.githubusercontent.com/jeffersongoncalves/laravel-mixpanel/master/art/jeffersongoncalves-laravel-mixpanel.png)](https://raw.githubusercontent.com/jeffersongoncalves/laravel-mixpanel/master/art/jeffersongoncalves-laravel-mixpanel.png)

Laravel Mixpanel
================

[](#laravel-mixpanel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6c1224bb40828864d072c11fa02bee7edaad691f6c892c3c08faae195acbcf87/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d697870616e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-mixpanel)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/6334f52bf8293fd90906de5c0731c4eae0079e52678b2a119c749c82e728609c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d697870616e656c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/jeffersongoncalves/laravel-mixpanel/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/0b772c89cf83718c6cbdc27c7e9b52e6daef4708bbbc8a843734720641b039ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d697870616e656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-mixpanel)

This Laravel package seamlessly integrates the [Mixpanel JavaScript SDK](https://docs.mixpanel.com/docs/tracking-methods/sdks/javascript) into your Blade templates. Easily track user interactions, page views, and product usage directly within your Laravel application, with all configuration managed via database settings using [spatie/laravel-settings](https://github.com/spatie/laravel-settings).

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11+
- [spatie/laravel-settings](https://github.com/spatie/laravel-settings) configured (the `settings` table must exist)

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

[](#installation)

Install the package via composer:

```
composer require jeffersongoncalves/laravel-mixpanel
```

If you haven't already, publish the `spatie/laravel-settings` migration to create the `settings` table:

```
php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations"
```

Then publish and run the Mixpanel settings migration:

```
php artisan vendor:publish --tag=mixpanel-settings-migrations
php artisan migrate
```

Usage
-----

[](#usage)

Add the Mixpanel script to your Blade layout (typically before ``):

```
@include('mixpanel::script')
```

### Configuring Settings

[](#configuring-settings)

Settings are stored in the database and can be managed via code:

```
use JeffersonGoncalves\Mixpanel\Settings\MixpanelSettings;

$settings = app(MixpanelSettings::class);
$settings->project_token = 'YOUR_MIXPANEL_PROJECT_TOKEN';
$settings->save();
```

### Data Residency

[](#data-residency)

Mixpanel supports data residency in the EU and India. Set the `api_host` accordingly:

```
// EU Data Residency
$settings->api_host = 'https://api-eu.mixpanel.com';
$settings->save();

// India Data Residency
$settings->api_host = 'https://api-in.mixpanel.com';
$settings->save();
```

### Proxy Configuration

[](#proxy-configuration)

To route Mixpanel requests through your own proxy:

```
$settings->api_host = 'https://proxy.yourdomain.com';
$settings->custom_lib_url = 'https://proxy.yourdomain.com/lib.min.js';
$settings->save();
```

### Available Settings

[](#available-settings)

PropertyTypeDefaultDescription`project_token``?string``null`Your Mixpanel project token (required for tracking)`api_host``?string``null`Custom API endpoint for data residency (EU: `https://api-eu.mixpanel.com`, India: `https://api-in.mixpanel.com`) or proxy`custom_lib_url``?string``null`Custom library URL for proxy setups`debug``bool``false`Enable debug logging to browser console`autocapture``bool``true`Automatically capture clicks, inputs, scrolls, and other user interactions`track_pageview``string``'true'`Track page views automatically. Values: `'true'`, `'false'`, `'full-url'`, `'url-with-path-and-query-string'`, `'url-with-path'``persistence``string``'cookie'`Storage method for super properties (`'cookie'` or `'localStorage'`)`cookie_expiration``int``365`Cookie lifespan in days`secure_cookie``bool``false`Only transmit cookies over HTTPS`cross_subdomain_cookie``bool``true`Enable cookie persistence across subdomains`ip``bool``true`Use IP address for geolocation data`property_blacklist``?string``null`Comma-separated list of properties to exclude from tracking`opt_out_tracking_by_default``bool``false`Initialize with tracking disabled (for GDPR/privacy compliance)`stop_utm_persistence``bool``false`Disable automatic UTM parameter retention`record_sessions_percent``int``0`Percentage of sessions to record (0-100)`record_heatmap_data``bool``false`Enable heatmap data collectionTesting
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Jefferson Goncalves](https://github.com/jeffersongoncalves)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance95

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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 ~22 days

Total

5

Last Release

43d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/411493?v=4)[Jefferson Gonçalves](/maintainers/jeffersongoncalves)[@jeffersongoncalves](https://github.com/jeffersongoncalves)

---

Top Contributors

[![jeffersongoncalves](https://avatars.githubusercontent.com/u/411493?v=4)](https://github.com/jeffersongoncalves "jeffersongoncalves (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")

---

Tags

analyticscomposerjavascript-sdkjeffersongoncalveslaravellaravel-packagemixpanelmixpanel-analyticsphpproduct-analyticsspatie-laravel-settingstrackinglaraveltrackinganalyticsmixpaneljeffersongoncalveslaravel-mixpanel

###  Code Quality

TestsPest

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/jeffersongoncalves-laravel-mixpanel/health.svg)

```
[![Health](https://phpackages.com/badges/jeffersongoncalves-laravel-mixpanel/health.svg)](https://phpackages.com/packages/jeffersongoncalves-laravel-mixpanel)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M993](/packages/statamic-cms)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M102](/packages/dedoc-scramble)[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.

5022.0k](/packages/simplestats-io-laravel-client)[finity-labs/fin-mail

A powerful email template manager and composer for Filament with dynamic token replacement, template versioning, and inline email sending.

284.5k1](/packages/finity-labs-fin-mail)[lettermint/lettermint-laravel

Official Lettermint driver for Laravel

1190.2k1](/packages/lettermint-lettermint-laravel)[njoguamos/laravel-plausible

A laravel package for interacting with plausible analytics api.

209.6k](/packages/njoguamos-laravel-plausible)

PHPackages © 2026

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