PHP code example of jeffersongoncalves / filament-metrics-matomo

1. Go to this page and download the library: Download jeffersongoncalves/filament-metrics-matomo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeffersongoncalves / filament-metrics-matomo example snippets


use JeffersonGoncalves\FilamentMetricsMatomo\FilamentMetricsMatomoPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentMetricsMatomoPlugin::make()
                ->settingsPage()
                ->allWidgets(),
        ]);
}

FilamentMetricsMatomoPlugin::make()
    ->settingsPage()
    ->liveCounter()
    ->visitsSummary()
    ->visitsChart()
    ->topPages()
    ->referrers()
    ->deviceTypes()
    ->browsers()
    ->countries()

FilamentMetricsMatomoPlugin::make()
    ->settingsPage()
    ->allWidgets()
    ->countries(false)
    ->browsers(false)

// config/filament-metrics-matomo.php

return [
    'default_period' => 'day',          // day, week, month, year
    'cache_ttl' => 300,                 // seconds (0 to disable)
    'cache_store' => null,              // null = default store
    'live_counter_poll_interval' => 30, // seconds
    'live_counter_last_minutes' => 30,  // minutes
    'table_row_limit' => 10,           // rows in table widgets
    'navigation' => [
        'group' => 'Analytics',
        'sort' => null,
    ],
];
bash
php artisan vendor:publish --provider="Spatie\LaravelSettings\LaravelSettingsServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="JeffersonGoncalves\MetricsMatomo\MatomoServiceProvider" --tag="matomo-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="filament-metrics-matomo-config"