承接 bezhansalleh/filament-google-analytics 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

bezhansalleh/filament-google-analytics

Composer 安装命令:

composer require bezhansalleh/filament-google-analytics

包简介

Google Analytics integration for FilamentPHP

README 文档

README

filament-google-analytics-art

FILAMENT 4.x FILAMENT 5.x Packagist Code Style Passing Downloads

Google Analytics (GA4)

Google Analytics integration for Filament Panels with a set of widgets to display your analytics data in a beautiful way.

Compatibility

Package Version Filament Version
1.x 2.x
2.x 3.x
3.x 4.x & 5.x

Upgrading from v2 to v3

If you are upgrading from version 2 to version 3, you will need to update the namespace anywhere you are using the plugin from BezhanSalleh\FilamentGoogleAnalytics to BezhanSalleh\GoogleAnalytics.

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=

Important

If you have not set up a custom theme and are using Filament Panels follow the instructions in the Filament Docs first.

After setting up a custom theme add the following to your theme css file.

@source '../../../../vendor/bezhansalleh/filament-google-analytics/resources/views/**/*';
@source '../../../../vendor/bezhansalleh/filament-google-analytics/src/{Widgets,Support}/*';
public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            ...
            \BezhanSalleh\GoogleAnalytics\GoogleAnalyticsPlugin::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 google-analytics.php for each widget you want to enable.

Publish the config files and set your settings:

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

Available Widgets

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,

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\GoogleAnalytics\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\SessionsByCountryWidget::class,
            Widgets\SessionsDurationWidget::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 google-analytics.php for each widget you want to enable.

Preview

Widgets rendered in a dedicated dashboard (or any other page you create) Demo Demo

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.

bezhansalleh/filament-google-analytics 适用场景与选型建议

bezhansalleh/filament-google-analytics 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 185.34k 次下载、GitHub Stars 达 208, 最近一次更新时间为 2022 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 bezhansalleh/filament-google-analytics 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 185.34k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 208
  • 点击次数: 36
  • 依赖项目数: 5
  • 推荐数: 0

GitHub 信息

  • Stars: 208
  • Watchers: 5
  • Forks: 44
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-28