Giter VIP home page Giter VIP logo

filament-google-analytics's Introduction

filament-google-analytics-art

FILAMENT 8.x Packagist Tests Passing Code Style Passing Downloads

Filament Google Analytics (GA4)

Google Analytics integration for Filament (FilamentAdmin)

Installation

You can install the package in to a Laravel app that uses Filament via composer:

composer require bezhansalleh/filament-google-analytics

For now, follow the directions on Spatie's Laravel Google Analytics package for getting your credentials, then put them here:

yourapp/storage/app/analytics/service-account-credentials.json

Also add this to the .env for your Filament PHP app:

ANALYTICS_PROPERTY_ID=

Usage

All the widgets are enabled by default in a dedicated Google Analytics Dashboard. You can enable or disable a specific widget or the dedicated dashboard all together or show and hide some from the main Filament Dashboard from the config filament-google-analytics.

Publish the config files and set your settings:

php artisan vendor:publish --tag=filament-google-analytics-config

Available Widgets

\BezhanSalleh\FilamentGoogleAnalytics\Widgets\PageViewsWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\VisitorsWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\ActiveUsersOneDayWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\ActiveUsersSevenDayWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\ActiveUsersFourteenDayWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\SessionsWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\SessionsDurationWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\SessionsByCountryWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\SessionsByDeviceWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\MostVisitedPagesWidget::class,
\BezhanSalleh\FilamentGoogleAnalytics\Widgets\TopReferrersListWidget::class,

Custom Dashboard

Though this plugin comes with a default dashboard, but sometimes you might want to change navigationLabel or navigationGroup or disable some widgets or any other options and given that the dashboard is a simple filament page; The easiest solution would be to disable the default dashboard and create a new page:

php artisan filament:page MyCustomDashboardPage

then register the widgets you want from the Available Widgets list either in the getHeaderWidgets() or getFooterWidgets():

<?php

namespace App\Filament\Pages;

use Filament\Pages\Page;
use BezhanSalleh\FilamentGoogleAnalytics\Widgets;

class MyCustomDashboardPage extends Page
{
    protected static ?string $navigationIcon = 'heroicon-o-document-text';

    protected static string $view = 'filament.pages.my-custom-dashboard-page';

    protected function getHeaderWidgets(): array
    {
        return [
            Widgets\PageViewsWidget::class,
            Widgets\VisitorsWidget::class,
            Widgets\ActiveUsersOneDayWidget::class,
            Widgets\ActiveUsersSevenDayWidget::class,
            Widgets\ActiveUsersFourteenDayWidget::class,
            Widgets\ActiveUsersTwentyEightDayWidget::class,
            Widgets\SessionsWidget::class,
            Widgets\SessionsDurationWidget::class,
            Widgets\SessionsByCountryWidget::class,
            Widgets\SessionsByDeviceWidget::class,
            Widgets\MostVisitedPagesWidget::class,
            Widgets\TopReferrersListWidget::class,
        ];
    }
}

Features

View the Visitors and Pageview Metrics

Screen Shot 2022-02-26 at 12 35 41 PM

View the Active Users Metrics

Screen Shot 2022-02-26 at 12 48 57 PM

View the Sessions and Avg. Session Duration Metrics

Screen Shot 2022-02-26 at 12 37 42 PM

View the Devices and Country Metrics by Session (WIP)

Screen Shot 2022-02-26 at 12 44 00 PM

View the lists of Most Visited Pages and Referrers

Screen Shot 2022-02-26 at 12 44 34 PM

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

If you want to contribute to this packages, you may want to test it in a real Filament project:

  • Fork this repository to your GitHub account.
  • Create a Filament app locally.
  • Clone your fork in your Filament app's root directory.
  • In the /filament-google-analytics directory, create a branch for your fix, e.g. fix/error-message.

Install the packages in your app's composer.json:

"require": {
    "bezhansalleh/filament-google-analytics": "dev-fix/error-message as main-dev",
},
"repositories": [
    {
        "type": "path",
        "url": "filament-google-analytics"
    }
]

Now, run composer update.

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.

filament-google-analytics's People

Contributors

bezhansalleh avatar dependabot[bot] avatar github-actions[bot] avatar macscr avatar rafayrty avatar saifallak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.