the-3labs-team/nova-google-analytics-cards
最新稳定版本:v2.0.4
Composer 安装命令:
composer require the-3labs-team/nova-google-analytics-cards
包简介
Google Analytics integration with Nova Metrics
README 文档
README
Nova Google Analytics Cards
Stay on top of your website's performance with the Google Analytics Insights Package for Laravel Nova. This powerful integration empowers you to seamlessly integrate Google Analytics data directly into your Nova dashboard, offering you a comprehensive and real-time overview of your website's key metrics.
Requirements
- php ^8.1|^8.2|^8.3
- laravel/framework ^10.0|^11.0
Version Compatibility
| Laravel | Nova | PHP | Package |
|---|---|---|---|
| 10.x | 4.x | 8.1 | 1.x |
| 11.x | 4.x | 8.2/8.3 | 2.x |
Installation
You can install the package via composer:
composer require the-3labs-team/nova-google-analytics-cards
You can publish the config file with:
php artisan vendor:publish
and choose: The3LabsTeam\NovaGoogleAnalyticsCards\NovaGoogleAnalyticsCardsServiceProvider.
You can publish the Google Analytics config file with:
php artisan vendor:publish
and select: Spatie\Analytics\AnalyticsServiceProvider.
Note: this package uses Laravel Analytics, so you need to configure it
in your config/analytics.php file.
The config file is documented, so choose the option that best suits your needs.
Usage
use The3LabsTeam\NovaGoogleAnalyticsCards\Counter\ActiveUsersCounter;use The3LabsTeam\NovaGoogleAnalyticsCards\Counter\NewUsersCounter;use The3LabsTeam\NovaGoogleAnalyticsCards\Counter\PageViewsCounter;use The3LabsTeam\NovaGoogleAnalyticsCards\LineChart\PageViewLineChart; ... (new ActiveUsersCounter()) (new NewUsersCounter()) (new PageViewsCounter()) (new PageViewLineChart())
You can also override the name of cards like this:
use The3LabsTeam\NovaGoogleAnalyticsCards\Counter\ActiveUsersCounter; ... (new ActiveUsersCounter(name: 'The name of the card (string)'))
Using the PageViewLineChart and RefClickPartition card in single Article
- Add in your
Articlemodel the following attribute:
/** * Return the page path for Google Analytics */ public function getGaPagePathAttribute(): string { return str_replace(config('app.url'), '', $this->route); }
- Add the card in your
Nova\Articleresource:
public function cards(NovaRequest $request) { return [ (new PageViewLineChart(articleId: $request->resourceId))->width('1/2 ') ->onlyOnDetail() ->height('dynamic'), (new RefClickPartition(articleId: $request->resourceId))->width('1/3') ->onlyOnDetail() ->height('dynamic'), ]; }
Sponsor
统计信息
- 总下载量: 2.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-08
