定制 jeffersongoncalves/laravel-mixpanel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jeffersongoncalves/laravel-mixpanel

Composer 安装命令:

composer require 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.

README 文档

README

Laravel Mixpanel

Laravel Mixpanel

Latest Version on Packagist GitHub Code Style Action Status Total Downloads

This Laravel package seamlessly integrates the Mixpanel JavaScript SDK 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.

Requirements

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

Add the Mixpanel script to your Blade layout (typically before </head>):

@include('mixpanel::script')

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

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

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

Property Type Default Description
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 collection

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

jeffersongoncalves/laravel-mixpanel 适用场景与选型建议

jeffersongoncalves/laravel-mixpanel 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 30 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「analytics」 「mixpanel」 「laravel」 「tracking」 「laravel-mixpanel」 「jeffersongoncalves」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 jeffersongoncalves/laravel-mixpanel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jeffersongoncalves/laravel-mixpanel 我们能提供哪些服务?
定制开发 / 二次开发

基于 jeffersongoncalves/laravel-mixpanel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 30
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 31
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-23