c6digital/filament-plausible-page

Embed your Plausible dashboard inside of Filament.

v2.1.1 2024-08-16 11:53 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package allows you to embed your Plausible Analytics dashboard as a page inside of Filament.

Installation

You can install the package via Composer:

composer require c6digital/filament-plausible-page

Usage

Register the plugin with Filament.

use C6Digital\FilamentPlausiblePage\FilamentPlausiblePagePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(FilamentPlausiblePagePlugin::make());
}

Provide a "Share URL" generated by Plausible in your .env file.

PLAUSIBLE_SHARE_URL="https://plausible.io/share/mysite.com?auth=blahblahblah

Load your panel and view your analytics!

Disabling Plausible footer text

Use the hideFooterMark() method to remove the "Stats powered by Plausible Analytics" footer mark.

return $panel
    ->plugin(
        FilamentPlausiblePagePlugin::make()
            ->hideFooterMark()
    );

Hide "Plausible" page title

Use the hidePageTitle() method to hide the page title.

return $panel
    ->plugin(
        FilamentPlausiblePagePlugin::make()
            ->hidePageTitle()
    );

Conditionally registering navigation items

If you want to conditionally show the navigation items registered by the page, you can provide a callback function to the shouldRegisterNavigationUsing() method.

FilamentPlausiblePagePlugin::make()
    ->shouldRegisterNavigationUsing(function () {
        return Tenant::hasPlausibleShareUrl();
    });

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.