### Install Filament Mixpanel via Composer Source: https://github.com/jeffersongoncalves/filament-mixpanel/blob/3.x/README.md Install the Filament Mixpanel plugin via Composer. Requires PHP 8.2+, Laravel 11.0+, and Filament 5.0. ```bash composer require jeffersongoncalves/filament-mixpanel ``` -------------------------------- ### Publish and Run Settings Migrations Source: https://github.com/jeffersongoncalves/filament-mixpanel/blob/3.x/README.md Publish the spatie/laravel-settings migration to create the settings table, then publish and run the Mixpanel settings migration. ```bash php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations" ``` ```bash php artisan vendor:publish --tag=mixpanel-settings-migrations php artisan migrate ``` -------------------------------- ### Run Tests with Composer Source: https://github.com/jeffersongoncalves/filament-mixpanel/blob/3.x/README.md Run the package test suite. ```bash composer test ``` -------------------------------- ### Override default settings page class Source: https://github.com/jeffersongoncalves/filament-mixpanel/blob/3.x/resources/boost/skills/filament-mixpanel-development/SKILL.md Create a custom settings page by extending the base SettingsPage class. ```php namespace App\Filament\Pages; use JeffersonGoncalves\Filament\Mixpanel\Pages\ManageMixpanelSettings as BaseSettings; class ManageMixpanelSettings extends BaseSettings { // Override form() to customize fields } ``` -------------------------------- ### MixpanelServiceProvider extending PackageServiceProvider Source: https://github.com/jeffersongoncalves/filament-mixpanel/blob/3.x/resources/boost/skills/filament-mixpanel-development/SKILL.md Service provider that extends Spatie's PackageServiceProvider. The commented code shows how the render hook for script injection is registered using FilamentView::registerRenderHook with PanelsRenderHook::HEAD_START. ```php namespace JeffersonGoncalves\Filament\Mixpanel; use Spatie\LaravelPackageTools\PackageServiceProvider; class MixpanelServiceProvider extends PackageServiceProvider { // Registers the render hook for script injection // FilamentView::registerRenderHook(PanelsRenderHook::HEAD_START, fn (): View => view('mixpanel::script')); } ``` -------------------------------- ### Register MixpanelPlugin in PanelProvider Source: https://github.com/jeffersongoncalves/filament-mixpanel/blob/3.x/README.md Register the MixpanelPlugin in your PanelProvider to inject the tracking script and add a Settings Page for Mixpanel configuration. ```php use JeffersonGoncalves\Filament\Mixpanel\MixpanelPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ MixpanelPlugin::make(), ]); } ``` -------------------------------- ### ManageMixpanelSettings settings page class Source: https://github.com/jeffersongoncalves/filament-mixpanel/blob/3.x/resources/boost/skills/filament-mixpanel-development/SKILL.md Settings page class that extends Filament's SettingsPage. It binds the MixpanelSettings model and sets the navigation icon to 'heroicon-o-chart-bar-square'. ```php namespace JeffersonGoncalves\Filament\Mixpanel\Pages; use Filament\Pages\SettingsPage; use JeffersonGoncalves\Mixpanel\Settings\MixpanelSettings; class ManageMixpanelSettings extends SettingsPage { protected static string $settings = MixpanelSettings::class; protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-chart-bar-square'; } ``` -------------------------------- ### MixpanelPlugin class implementing Filament Plugin Source: https://github.com/jeffersongoncalves/filament-mixpanel/blob/3.x/resources/boost/skills/filament-mixpanel-development/SKILL.md Defines the main plugin class for the Filament Mixpanel integration. Implements the Filament Plugin contract and provides methods for plugin registration, retrieval, and settings page configuration. The getId() method returns 'filament-mixpanel'. ```php namespace JeffersonGoncalves\Filament\Mixpanel; use Filament\Contracts\Plugin; use Filament\Panel; class MixpanelPlugin implements Plugin { protected bool $hasSettingsPage = true; public static function make(): static; public static function get(): static; public function getId(): string; // returns 'filament-mixpanel' public function register(Panel $panel): void; public function boot(Panel $panel): void; public function settingsPage(bool $condition = true): static; } ``` -------------------------------- ### Disable Settings Page with settingsPage(false) Source: https://github.com/jeffersongoncalves/filament-mixpanel/blob/3.x/README.md Disable the settings page while keeping tracking script injection. Use this when you only want the script injection without the settings UI. ```php MixpanelPlugin::make() ->settingsPage(false), ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.