Umami Widgets plugin screenshot
Dark mode ready
Multilingual support
Supports v5.x

Umami Widgets

Community

Display Umami Analytics data in your dashboard

Tags: Widget Developer Tool Analytics
Supported versions:
3.x
Tally Schmeits avatar Author: Tally Schmeits

Package health

Beta

Automated checks of this plugin's Composer package

85 / 100
Security 76
Maintenance 100
Ecosystem 88
13 checks
  • Warning: Current Laravel version supported — Package support for current Laravel 13.0 could not be verified; the newest co-installable line is 12.0, which still receives active support but is not the current stable. Line 13.0 could not be fully verified: no solution was found among the newest package versions, and resolving the complete version pool exceeded solver resource budgets, so support there cannot be ruled out.
  • Passed: Current PHP version supported — Constraint ^8.1|^8.2|^8.3|^8.4 supports current PHP 8.5.
  • Skipped: Current Symfony version supported
  • Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
  • Passed: Commit and release recency — Active: last commit 52 days ago; last release 506 days ago.
  • Passed: composer.lock not committed by library composer.lock is absent from the released dist archive.
  • Passed: Dist archive is lean
  • Passed: GitHub Actions pinned to SHA
  • Passed: Open security advisories
  • Warning: Dependabot PR responsiveness — Stale Dependabot PRs: oldest general PR is 82 days old.
  • Passed: Dependabot or Renovate configured
  • Failed: Dependency update cooldown configured No cooldown configured in .github/dependabot.yml. View details on Plumb
  • Passed: Provides a security policy
Third-party plugin. This is built by the community, not the Filament team. Filament does not review, endorse, or vet the security of plugins outside the filament/ namespace. Review the source and install at your own risk. Found malware or an unresolved security issue the author won't address? Report it .
Powered by Plumb Last scanned 5 days ago

Documentation

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

These are some Filament widgets for Umami (Website Analytics)

example-screenshot.png

#Installation

You can install the package via composer:

composer require schmeits/filament-umami-widgets

You can publish the config file with:

php artisan vendor:publish --tag="filament-umami-widgets-config"

Optionally, you can publish the views

php artisan vendor:publish --tag="filament-umami-widgets-views"

or translations

php artisan vendor:publish --tag="filament-umami-widgets-translations"

This is the contents of the published config file:

return [
    /*
    |--------------------------------------------------------------------------
    | Umami type
    |--------------------------------------------------------------------------
    |
    | Which version of Umami are you using?
    | Option 1: self_hosted (https://umami.is/docs)
    | Option 2: cloud (https://umami.is/docs/cloud)
    |
    */
    'type' => env('UMAMI_TYPE', 'self-hosted'),

    /*
    |--------------------------------------------------------------------------
    | Umami API Endpoint URL
    |--------------------------------------------------------------------------
    |
    | For the self hosted version you should provide the API
    | endpoint e.g. https://your_url.com/api
    |
    | If you are using the Cloud type your values should be something
    | like: https://api.umami.is/v1
    |
    */
    'api_endpoint_url' => env('UMAMI_API_ENDPOINT', 'https://api.umami.is/v1'),

    /*
    |--------------------------------------------------------------------------
    | Umami Website ID
    |--------------------------------------------------------------------------
    |
    | This is the ID of the website stats you want to show on the website
    |
    | In Umami Cloud you can find the ID by going to Websites
    | Click edit and use the Website ID provided
    |
    | In the self-hosted version navigate to Settings and edit the website
    | use the Website ID provided
    |
    */
    'website_id' => env('UMAMI_WEBSITE_ID', null),

    /*
    |--------------------------------------------------------------------------
    | Umami Http options
    |--------------------------------------------------------------------------
    |
    | The timeout options defines the default timeout for the API requests
    | in seconds
    |
    */
    'timeout' => env('UMAMI_TIMEOUT', 5),

    /*
    |--------------------------------------------------------------------------
    | Self Hosted Options
    |--------------------------------------------------------------------------
    |
    | Add a user to your Umami installation
    | https://umami.is/docs/add-a-user
    |
    */
    'username' => env('UMAMI_USERNAME', null),
    'password' => env('UMAMI_PASSWORD', null),

    /*
    |--------------------------------------------------------------------------
    | Cloud Options
    |--------------------------------------------------------------------------
    |
    | Check the website how to obtain an API key
    | https://umami.is/docs/cloud/api-key
    |
    */
    'cloud_api_key' => env('UMAMI_API_KEY', null),

    /*
    |--------------------------------------------------------------------------
    | Caching options
    |--------------------------------------------------------------------------
    |
    | You can set the options for the caching here
    | cache_time is the time the values will be cached in seconds
    |
    */
    'cache_time' => 300,
    
];

#Usage

Under Filament/Pages/ create a new file called Dashboard.php with following contents:

namespace App\Filament\Pages;

use Schmeits\FilamentUmami\Concerns\HasFilter;

class Dashboard extends \Filament\Pages\Dashboard
{
    use HasFilter;
    
}

#Remove the default Dashboard from your PanelProvider

->pages([
    //Pages\Dashboard::class,
])

Alternatively if you already have a custom Dashboard, add the HasFilter trait to your Dashboard file.

#Add the plugin to your PanelProvider

->plugins([
    \Schmeits\FilamentUmami\FilamentUmamiPlugin::make()
])

#Add the Widget to your PanelProvider

->widgets([
    Widgets\AccountWidget::class,
    Widgets\FilamentInfoWidget::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetStatsGrouped::class, // <-- add this widget
])

There are different predefined widgets available to use in your dashboard

->widgets([
    // this is the grouped stats widget
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetStatsGrouped::class,

    // these are the separate stats widgets
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetStatsLiveVisitors::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetStatsPageViews::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetStatsVisitors::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetStatsVisits::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetStatsBounces::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetStatsTotalTime::class,

    // and some table widgets
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableUrls::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableTitle::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableReferrers::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableCountry::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableRegion::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableCity::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableDevice::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableOs::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableBrowser::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableLanguage::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableScreen::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableEvents::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableQuery::class,

    // grouped table widgets
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableGroupedPages::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableGroupedGeo::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetTableGroupedClientInfo::class,

    // chart widgets
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetGraphPageViews::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetGraphSessions::class,
    \Schmeits\FilamentUmami\Widgets\UmamiWidgetGraphEvents::class,
])

#Stats Widgets

#Live Visitors

stats-live-visitors.jpg

#Page Hits

stats-pageviews.jpg

#Number of unique visitors

stats-visitors.jpg

#Number of sessions

stats-visits.jpg

#Number of visitors who only visit a single page

stats-bounces.jpg

#Time spent on the website (formatted H:i)

stats-total-time.jpg

#Metrics Widgets

#Referrers

metrics-referrers.jpg

#Url's of the visited pages

metrics-url.jpg

#Titles of the visited pages

metrics-titles.jpg

#Browsers used

metrics-browsers.jpg

#Operating systems used

metrics-os.jpg

#Devices systems used

metrics-devices.jpg

#Languages used

metrics-language.jpg

#Screen resolutions used

metrics-resolutions.jpg

#Events occurred

metrics-events.jpg

#Query strings

metrics-querystring.jpg

#Grouped Metrics Widgets

#Geo information (Countries, Regions, Cities)

metrics-grouped-geo.jpg

#Visited Pages (URL, Title)

metrics-grouped-pages.jpg

#Client Info (Browsers, OS, Devices, Screens, Languages)

metrics-grouped-client-info.jpg

#Chart widgets

#Pageviews (last 7 days)

chart-pageviews.jpg

#Sessions (last 7 days)

chart-sessions.jpg

#Events

chart-events.jpg

#Configure the plugin

If you want to configure the polling interval or define which widgets are shown in the UmamiWidgetStatsGrouped you can pass the StatWidgets to the widgetsForGroupedStats function:

    \Schmeits\FilamentUmami\FilamentUmamiPlugin::make()
        ->pollingInterval("60s") //Auto polling interval
        ->widgetsForGroupedStats([
            UmamiStatsWidgets::WIDGET_LIVE,
            UmamiStatsWidgets::WIDGET_PAGEVIEWS,
            UmamiStatsWidgets::WIDGET_VISITORS,
            UmamiStatsWidgets::WIDGET_TOTAL_TIME,
            UmamiStatsWidgets::WIDGET_BOUNCES,
            UmamiStatsWidgets::WIDGET_VISITS,
        ]),

#Using the raw Analytics functions

You can also use the facade functions for your own widgets.

#Defining the Filter

use Schmeits\FilamentUmami\Concerns\Filter;

$filter = (new Filter())
    ->setFrom(Carbon::now()->subDays(30))
    ->setTo(Carbon::now());

#Get different data

use Schmeits\FilamentUmami\Facades\FilamentUmami;

// Gets the number of active users on a website.
$activeVisitors = FilamentUmami::activeVisitors($filter);

// *** STATS ***

// Pages hits
$views = FilamentUmami::pageViews($filter);

// Number of unique visitors
$visitors = FilamentUmami::visitors($filter);

// Number of sessions
$visits = FilamentUmami::visits($filter);

// Number of visitors who only visit a single page
$bounces = FilamentUmami::bounces($filter);

// Time spent on the website (formatted H:i)
$total_time = FilamentUmami::totalTime($filter);

// *** METRICS ***

// Get pages visited url's
$pages = FilamentUmami::metricsPages($filter);
// or
$pages = FilamentUmami::metrics($filter, \Schmeits\FilamentUmami\Enums\UmamiMetricTypes::METRIC_PAGES);

// *** PAGEVIEWS LAST 7 DAYS ***
$views_and_sessions = FilamentUmami::pageViewsAndSessions(); 

#Available Metrics

enum UmamiMetricTypes: string
{
    case METRIC_PAGES = 'url'; // Url's of the Pages visited
    case METRIC_TITLE = 'title'; // Titles of the Pages visited
    case METRIC_REFERRER = 'referrer'; // Referrers (where do the visitors come from)
    case METRIC_BROWSER = 'browser'; // Browser (Chrome, Edge, Safari, etc.)
    case METRIC_OS = 'os'; // Operating system (iOS, MacOS, etc.)
    case METRIC_DEVICE = 'device'; // Devices (Laptop, Mobile, etc.)
    case METRIC_COUNTRY = 'country'; // Countries (US, NL, etc.)
    case METRIC_REGION = 'region'; // Regions (NL-LI, US-AZ, NL-NH, etc.)
    case METRIC_CITY = 'city'; // Cities (Amsterdam, Netherlands / Phoenix, United States / etc)
    case METRIC_LANGUAGE = 'language'; // Languages (Dutch, English, etc.)
    case METRIC_SCREEN = 'screen'; // Screen resolutions (1440x900, 1920x1200, etc.)
    case METRIC_EVENT = 'event'; // Events (Clicked link, etc.)
    case METRIC_QUERY = 'query'; // Query parameters (search=test, etc.)
}

#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.