adeweb/laravel-nova-matomo-cards

dev-master 2022-02-05 14:41 UTC

This package is auto-updated.

Last update: 2024-09-05 20:17:54 UTC


README

Preview

安装

您可以通过composer安装此包

composer require adeweb/laravel-nova-matomo-cards

您可以使用以下命令发布配置文件

php artisan vendor:publish --provider="Adeweb\NovaMatomoCards\NovaMatomoCardsServiceProvider" --tag="config"

这是发布配置文件的内容

return [
    'token' => env('MATOMO_API_TOKEN'),
    'url' => env('MATOMO_API_URL'),
    'site_id' => env('MATOMO_API_SITE_ID')
];

注意:使用环境变量比发布和编辑配置文件更好。

使用方法

在 NovaServiceProvider.php 中

use Adeweb\NovaMatomoCards\Cards\LastMonthDeviceTypePartition;
use Adeweb\NovaMatomoCards\Cards\LastMonthCitiesByVisitorCountList;
use Adeweb\NovaMatomoCards\Cards\LastMonthPageByVisitorList;
use Adeweb\NovaMatomoCards\Cards\LiveVisitorsCount;
use Adeweb\NovaMatomoCards\Cards\PageViewsCount;
use Adeweb\NovaMatomoCards\Cards\PageViewsPerDayTrend;
use Adeweb\NovaMatomoCards\Cards\LastMonthReferrersPartition;
use Adeweb\NovaMatomoCards\Cards\UniqueVisitorsCount;
use Adeweb\NovaMatomoCards\Cards\UniqueVisitorsPerDayTrend;

    /**
     * Get the cards that should be displayed on the default Nova dashboard.
     *
     * @return array
     */
    protected function cards()
    {
        return [
            (new UniqueVisitorsPerDayTrend())->width('1/2')->defaultRange('30'),
            (new UniqueVisitorsCount())->width('1/4')->defaultRange('month'),
            (new LiveVisitorsCount())->width('1/4')->defaultRange('720'),
            (new PageViewsPerDayTrend())->width('1/2')->defaultRange('30'),
            (new PageViewsCount())->width('1/4')->defaultRange('month'),
            (new LastMonthReferrersPartition())->width('1/2'),
            (new LastMonthDeviceTypePartition())->width('1/2'),
            (new LastMonthCitiesByVisitorCountList())->width('1/2'),
            (new LastMonthPageByVisitorList())->width('1/2'),
        ];
    }
    

在您的 .env 文件中

MATOMO_API_TOKEN="[Your Matomo API token]"
MATOMO_API_URL="[Your Matomo instance URL]"
MATOMO_API_SITE_ID="[Your Matomo Site ID]"

测试

NTBD

致谢

许可

MIT 许可证(MIT)。有关更多信息,请参阅许可文件