luyadev/luya-module-matomo

Matomo(前piwik)分析

1.0.2 2020-02-20 10:45 UTC

This package is auto-updated.

Last update: 2024-09-06 20:50:07 UTC


README

LUYA Logo

Matomo(Piwik)模块

LUYA Latest Stable Version Total Downloads Slack Support

提供TrackingCode实现小部件和管理仪表板对象,以查看来自Matomo(前Piwik)的最新访问记录。

LUYA Logo

安装

安装模块需要Composer。

composer require luyadev/luya-module-matomo

要将模块添加到项目中,请进入配置文件中的模块部分

'modules' => [
    // ...
    'matomoadmin' => [
        'class' => 'luya\matomo\Module',
         'serverUrl' => 'https://matomo.example.com', // without trailing slash, use full schema path.
         'siteId' => 1,
         'apiToken' => 'THE_API_TOKEN',
    ]
]
  • serverUrl: 指向Matomo安装的URL
  • siteId: 在Matomo仪表板设置 > 网站 > 管理 中获取站点ID
  • apiToken: 在设置 > 平台 > API > 用户身份验证中获取Matomo API令牌

使用方法

配置管理员模块后,您现在可以集成TrackingCode小部件。跟踪代码将注册JavaScript跟踪,并且作为后备,也在noscript标签之间注册跟踪图像。

我们建议在布局中在endBody()函数之前集成TrackingCodeWidget。

<?= \luya\matomo\TrackingCodeWidget::widget(); ?>
<?php $this->endBody() ?>