sepremex/filanitics 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sepremex/filanitics

Composer 安装命令:

composer require sepremex/filanitics

包简介

Google Analytics integration with Filamentphp (FilamentAdmin)

README 文档

README

Filanitics is a custom Filament plugin that integrates Google Analytics (GA4) data directly into your Filament admin panel, so your users (or clients) can view traffic stats without needing to access the actual Google Analytics dashboard.

⚡ Built for Filament v3 and Laravel 10/12
🔒 Uses Google Analytics Data API (GA4) with Service Account authentication

⚠️ Disclaimer

This package is a personal fork of bezhanSalleh/filament-google-analytics, adapted for use in a very specific Filament v3 setup.

I make no guarantees that this package will work outside of my environment. It is not actively maintained for public use, and may not be compatible with your setup.

If you're looking for a stable and community-supported solution, please use the original package by @bezhanSalleh.

Use at your own risk. I take no responsibility for any issues, bugs, or system breaks caused by using this code.

TBH: I built this for myself. You can use it if you want, but don’t blame me if it breaks things. 😅

🚀 Features

  • See visitors and page views directly in Filament
  • View traffic trends over the past 7/30 days
  • Optional charts and breakdowns (top pages, countries, etc.)
  • Uses official Google Analytics SDK (no third-party wrappers)

🧱 Installation

composer require sepremex/filanitics

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=

Note

The plugin is developed to work in any Livewire project that uses the standalone filament/widgets package. But it also comes with a dedicated dashboard, which is a normal filament page. You can enable it by registering the plugin for the panels you want to use it in. If you are not using filament panels then you can skip this step.

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            ...
            \Sepremex\Filanitics\FilaniticsPlugin::make()
        ]);
}

Usage

All the widgets are enabled by default for you to use them in your filament pages/resources. In order to enable the widgets for the default filament dashboard, you need to set the filament_dashboard option to true in the config file filanitics.php for each widget you want to enable.

Publish the config files and set your settings:

php artisan vendor:publish --tag=filanitics-config

Available Widgets

\Sepremex\Filanitics\Widgets\PageViewsWidget::class,
\Sepremex\Filanitics\Widgets\VisitorsWidget::class,
\Sepremex\Filanitics\Widgets\ActiveUsersOneDayWidget::class,
\Sepremex\Filanitics\Widgets\ActiveUsersSevenDayWidget::class,
\Sepremex\Filanitics\Widgets\ActiveUsersTwentyEightDayWidget::class,
\Sepremex\Filanitics\Widgets\SessionsWidget::class,
\Sepremex\Filanitics\Widgets\SessionsDurationWidget::class,
\Sepremex\Filanitics\Widgets\SessionsByCountryWidget::class,
\Sepremex\Filanitics\Widgets\SessionsByDeviceWidget::class,
\Sepremex\Filanitics\Widgets\MostVisitedPagesWidget::class,
\Sepremex\Filanitics\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 Sepremex\Filanitics\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\ActiveUsersTwentyEightDayWidget::class,
            Widgets\SessionsWidget::class,
            Widgets\SessionsDurationWidget::class,
            Widgets\SessionsByCountryWidget::class,
            Widgets\SessionsByDeviceWidget::class,
            Widgets\MostVisitedPagesWidget::class,
            Widgets\TopReferrersListWidget::class,
        ];
    }
}

Note

In order to enable the widgets for the default filament dashboard, you need to set the filament_dashboard option to true in the config file filanitics.php for each widget you want to enable.

2025-04-05

I had to remove the original package since many of you started to use it, and I was getting way too many messages, however, as I said, please use the one from @bezhanSalleh, and support that one, this is for personal use. this thing isn't working...

sepremex/filanitics 适用场景与选型建议

sepremex/filanitics 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「analytics」 「laravel」 「google-analytics」 「livewire」 「filament-analytics」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 sepremex/filanitics 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sepremex/filanitics 我们能提供哪些服务?
定制开发 / 二次开发

基于 sepremex/filanitics 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-11