waldhacker / typo3-plausibleio
适用于TYPO3 CMS的隐私友好型分析集成。使用Plausible Analytics分析您的受众,并在TYPO3后端直接查看分析数据的仪表板。
Requires
- php: ^8.1 | ^8.2 | ^8.3
- ext-json: *
- psr/http-client: *
- psr/http-factory: *
- psr/http-message: *
- psr/log: *
- typo3/cms-backend: ^12.4@dev | ^13.0@dev
- typo3/cms-core: ^12.4@dev | ^13.0@dev
- typo3/cms-dashboard: ^12.4@dev | ^13.0@dev
- typo3/cms-fluid: ^12.4@dev | ^13.0@dev
- typo3/cms-frontend: ^12.4@dev | ^13.0@dev
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- overtrue/phplint: ^9.1
- phpspec/prophecy-phpunit: ^2.0
- phpstan/extension-installer: ^1.0
- phpunit/phpunit: ^10.5
- roave/security-advisories: dev-latest
- saschaegerer/phpstan-typo3: ^1.8
- typo3/cms-extensionmanager: @dev
- typo3/cms-fluid-styled-content: ^12.4@dev || ^13.0@dev
- typo3/cms-install: @dev
- typo3/coding-standards: ^0.7 | ^0.8.x-dev
- typo3/testing-framework: ^8
- vimeo/psalm: ^5.0
This package is auto-updated.
Last update: 2024-05-28 10:42:10 UTC
README
⚠️
此仓库不再维护。
将不会考虑或批准任何问题或拉取请求。
维护和进一步开发感谢由 @dreistromland 负责。
新的代码库可以在 此仓库 中找到。有关迁移的详细信息,请参阅那里。感谢 @dreistromland 接管进一步开发,并感谢所有用户对他们的信任。
⚠️
适用于TYPO3 CMS的Plausible Analytics隐私友好型分析集成。
使用Plausible Analytics分析您的受众,并在TYPO3后端直接查看分析数据的仪表板。
Plausible Analytics是一个隐私友好、无cookies、轻量级且开源的分析替代方案 - 您可以在 https://# 使用他们的服务,或者在您自己的平台上 自行托管服务。
安装
使用Composer
composer require waldhacker/typo3-plausibleio
不使用Composer
- 从TER下载 扩展
- 使用扩展管理器安装
配置
站点语言
扩展主要在站点语言中进行配置:站点管理
/ 站点
/ <站点配置>
/ 语言
/ <站点语言>
/ Plausible Analytics
以下设置可用
Plausible API基础URL
Plausible API端点可访问的基础URL。
如果您使用plausible.io服务,则为 https://#/
。
如果您使用的是自托管的Plausible实例,请在此处添加您的Plausible域名(例如 https://analytics.example.com/
)。
Plausible API密钥
一个Plausible API令牌。如果您还没有,您可以在您的Plausible实例中创建一个,在 设置
/ API密钥
中。
站点
一个Plausible站点ID。
通常是您的域名或子域名,不带 www
(例如 waldhacker.dev
或 blog.waldhacker.dev
)。
站点ID也是您在创建新站点时在Plausible实例中输入的内容。
自动包含Plausible跟踪代码片段
如果开启,则 Plausible跟踪脚本 将自动包含在前端。
如果您不想自动集成,您也可以通过在模板中使用资产收集器手动插入脚本,如下所示
<f:asset.script identifier="analytics" src="https://#/js/plausible.js" data="{'domain':'waldhacker.dev'}" priority="1" async="async" defer="defer" />
Plausible跟踪代码片段基础URL
Plausible 跟踪脚本可访问的基础 URL。
它必须是 js/plausible.js
前的部分。所以如果你的 Plausible 跟踪脚本位于 https://analytics.example.com/js/plausible.js
,那么在这里放置 https://analytics.example.com/
。
如果您使用plausible.io服务,则为 https://#/
。
URL 很可能是 "Plausible API 基础 URL" 相同。然而,由于广告拦截器,跟踪脚本可能需要从另一个域名加载。因此,Plausible 跟踪脚本的基础 URL 必须在此处单独配置。
Plausible 跟踪代码类型
Plausible 为各种用例提供不同的跟踪脚本。
可以在此选择其中一种脚本(默认为 plausible.js
)。
扩展配置
一些选项在 Admin Tools
/ Extension Configuration
/ plausibleio
中的扩展配置中设置。
时间框架
在仪表板小部件中可选的时间框架的逗号分隔列表 - 在 https://#/docs/stats-api#time-periods 查看可能的选项(目前 custom
不可用)。
默认时间框架
在渲染小部件时最初使用的时间框架。
高级配置
Service.yaml
如果您希望在单个仪表板上看到具有预配置值的多个小部件,可以通过在文件 Configuration/Services.yaml
中的小部件配置来实现。
因此,可以在仪表板上创建例如 Countries
小部件两次。一个显示 site1.example.com
的国家地图,另一个显示 site2.example.com
的国家地图。
从文件 EXT:plausibleio/Configuration/Services.yaml
中复制 waldhacker.plausibleio.widget.country
小部件
waldhacker.plausibleio.widget.country:
class: 'Waldhacker\Plausibleio\Dashboard\Widget\CountryMapDataWidget'
arguments:
$configurationService: '@Waldhacker\Plausibleio\Services\ConfigurationService'
$options:
siteId: null
timeFrame: null
tags:
- name: dashboard.widget
identifier: 'plausible.countrymapdata'
groupNames: 'plausibleio'
title: 'LLL:EXT:plausibleio/Resources/Private/Language/locallang.xlf:widget.countryMapData.label'
description: 'LLL:EXT:plausibleio/Resources/Private/Language/locallang.xlf:widget.countryMapData.description'
iconIdentifier: 'content-widget-chart-bar'
height: 'medium'
width: 'medium'
到您的站点包 Configuration/Services.yaml
文件中,并按如下方式调整配置
# Countries widget fixed to site1.example.com
yourname.plausibleio.widget.country.site1:
class: 'Waldhacker\Plausibleio\Dashboard\Widget\CountryMapDataWidget'
arguments:
$configurationService: '@Waldhacker\Plausibleio\Services\ConfigurationService'
$options:
siteId: site1.example.com
timeFrame: 30d
tags:
- name: dashboard.widget
identifier: 'yourname.countrymapdata.site1'
groupNames: 'plausibleio'
title: 'LLL:EXT:yourpackage/Resources/Private/Language/locallang.xlf:widgets.countryMapData.label'
description: 'LLL:EXT:yourpackage/Resources/Private/Language/locallang.xlf:widgets.countryMapData.description'
iconIdentifier: 'content-widget-chart-bar'
height: 'medium'
width: 'medium'
# Countries widget fixed to site2.example.com
yourname.plausibleio.widget.country.site2:
class: 'Waldhacker\Plausibleio\Dashboard\Widget\CountryMapDataWidget'
arguments:
$configurationService: '@Waldhacker\Plausibleio\Services\ConfigurationService'
$options:
siteId: site2.example.com
timeFrame: 30d
tags:
- name: dashboard.widget
identifier: 'yourname.countrymapdata.site2'
groupNames: 'plausibleio'
title: 'LLL:EXT:yourpackage/Resources/Private/Language/locallang.xlf:widgets.countryMapData.label'
description: 'LLL:EXT:yourpackage/Resources/Private/Language/locallang.xlf:widgets.countryMapData.description'
iconIdentifier: 'content-widget-chart-bar'
height: 'medium'
width: 'medium'
在 $options
中,您可以将小部件固定到 Plausible 网站 ID 和/或时间框架。
从版本 1.x 迁移到 2.x
在版本 1.x 中,“Plausible API 基础 URL”(baseUrl
),“Plausible API 密钥”(apiKey
)和“站点”(siteId
)在扩展配置($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['plausibleio']
)中设置。然而,这仅允许在 TYPO3 安装中配置一个 Plausible 网站ID。
这三个配置选项已从版本 2.x 移动到站点语言配置。您必须手动将您在扩展配置(版本 1.x)中输入的值转移到站点语言配置中,没有自动迁移脚本。
从版本 2.x 迁移到 3.x
由于 Breaking-96812-NoFrontendTypoScriptBasedTemplateOverridesInTheBackend,您需要从文件 Configuration/Services.yaml
中的小部件配置中删除行 $view: '@dashboard.views.widget'
。