### Install Filament Google Analytics Source: https://github.com/bezhansalleh/filament-google-analytics/blob/main/README.md Install the package using Composer. This command adds the necessary files to your Laravel project. ```bash composer require bezhansalleh/filament-google-analytics ``` -------------------------------- ### Install Filament Google Analytics with Local Path Source: https://github.com/bezhansalleh/filament-google-analytics/blob/main/README.md Configures the composer.json file to install the filament-google-analytics package from a local path, allowing for development and testing of a specific branch. ```json { "require": { "bezhansalleh/filament-google-analytics": "dev-fix/error-message as main-dev" }, "repositories": [ { "type": "path", "url": "filament-analytics" } ] } ``` -------------------------------- ### Publish Configuration Files Source: https://github.com/bezhansalleh/filament-google-analytics/blob/main/README.md Publish the package's configuration files to customize settings, including enabling widgets for the default Filament dashboard. ```bash php artisan vendor:publish --tag=filament-google-analytics-config ``` -------------------------------- ### Configure Google Analytics Credentials Source: https://github.com/bezhansalleh/filament-google-analytics/blob/main/README.md Place your service account credentials file in the specified storage directory and set the analytics property ID in your .env file. ```ini yourapp/storage/app/analytics/service-account-credentials.json ``` ```ini ANALYTICS_PROPERTY_ID= ``` -------------------------------- ### List Available Analytics Widgets Source: https://github.com/bezhansalleh/filament-google-analytics/blob/main/README.md This code snippet shows the available widgets provided by the package that can be used in Filament panels. ```php use BezhanSalleh\GoogleAnalytics\Widgets; Widgets\PageViewsWidget::class, Widgets\VisitorsWidget::class, Widgets\ActiveUsersOneDayWidget::class, Widgets\ActiveUsersSevenDayWidget::class, Widgets\ActiveUsersTwentyEightDayWidget::class, Widgets\SessionsWidget::class, Widgets\SessionsByCountryWidget::class, Widgets\SessionsDurationWidget::class, Widgets\SessionsByDeviceWidget::class, Widgets\MostVisitedPagesWidget::class, Widgets\TopReferrersListWidget::class; ``` -------------------------------- ### Create Custom Dashboard Page Source: https://github.com/bezhansalleh/filament-google-analytics/blob/main/README.md Generates a new Filament page that can be used as a custom dashboard. This page can then be configured to display specific Google Analytics widgets. ```bash php artisan filament:page MyCustomDashboardPage ``` -------------------------------- ### Register Google Analytics Plugin in Filament Panel Source: https://github.com/bezhansalleh/filament-google-analytics/blob/main/README.md Register the GoogleAnalyticsPlugin in your Filament panel configuration to enable the analytics features. ```php use BezhanSalleh\GoogleAnalytics\GoogleAnalyticsPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ ... \BezhanSalleh\GoogleAnalytics\GoogleAnalyticsPlugin::make() ]); } ``` -------------------------------- ### Add Custom Theme CSS Source: https://github.com/bezhansalleh/filament-google-analytics/blob/main/README.md Include the package's CSS sources in your custom Filament theme's CSS file to ensure widgets are displayed correctly. ```css @source '../../../../vendor/bezhansalleh/filament-google-analytics/resources/views/**/*'; @source '../../../../vendor/bezhansalleh/filament-google-analytics/src/{Widgets,Support}/*'; ``` -------------------------------- ### Register Google Analytics Widgets in Custom Dashboard Source: https://github.com/bezhansalleh/filament-google-analytics/blob/main/README.md Defines a custom Filament page and registers various Google Analytics widgets to be displayed in the header of the dashboard. This allows for a tailored analytics view. ```php