@eeacms/volto-matomo

中文文档
7.0.1发布于 2026/04/09MITCommonJS近 30 天下载 4065

volto-matomo: Volto add-on

原始使用文档
文档目录9 节
  1. How to
  2. API
  3. Getting started
  4. Try volto-matomo with Docker
  5. Add volto-matomo to your Volto project
  6. Release
  7. How to contribute
  8. Copyright and license
  9. Funding

volto-matomo

Releases

Pipeline Lines of Code Coverage Bugs Duplicated Lines (%)

Pipeline Lines of Code Coverage Bugs Duplicated Lines (%)

Volto add-on that integrates Matomo with Volto sites. At this moment there is a very basic integration that just pings Matomo on each router location change.

How to

To configure it, either set the following variables:

  • settings.matomoSiteId (if not available it uses: 1)
  • settings.matomoUrlBase (if not available it uses: https://matomo.eea.europa.eu/)

or RAZZLE_MATOMO_SITE_ID and RAZZLE_MATOMO_URL environment variables.

With version 4.0.0+, you have the possibility to use a second matomo in parallel:

  • settings.matomoSecondSiteId (if not available it uses: 1)
  • settings.matomoSecondUrlBase (if not available it uses: https://matomo.eea.europa.eu/)

or RAZZLE_MATOMO_SECOND_SITE_ID and RAZZLE_MATOMO_SECOND_URL environment variables.

With version 6.0.0 it is possible to have custom matomo settings based on the pathname.

  • settings.matomoTrackerIdFn is function with signature (pathname) => trackerId:string
  • settings.matomoTrackers is a mapping of trackerIds to matomo setting objects (all the keys for config.settings can be added to this object).

API

There are four exports in utils.js (which can be imported from volto-matomo/utils, including from other Volto addons):

  1. trackPageView({ href, ...options }) : void - takes an object with href and other options and sends to Matomo a page view track;
  2. trackEvent(options) : void - takes an options object parameter and sends to Matomo an event track.
  3. trackSiteSearch(options) : void - takes an options object parameter and sends to Matomo an site search track.
  4. pushInstruction(name, null, ...args): void - takes a name and an arbitrary number of parameters, and pushes them to Matomo.

Note that the Matomo instance is behind the scenes lazy-loaded and cached.

The default behavior of volto-matomo is a call to trackPageView in utils.js, with the href and documentTitle options, on every URL change as recorded by the AppExtras component in Volto. The href is taken from props.content['@id'] received by the MatomoAppExtra.jsx component. The utils.js file exposes just a part of the Matomo React API. If you wish to extend it or to understand it better, this link might be helpful.

Getting started

Try volto-matomo with Docker

  git clone https://github.com/eea/volto-matomo.git
  cd volto-matomo
  make
  make start

Go to http://localhost:3000

make start now defaults to Volto 18. To run the same setup against Volto 17, use:

  VOLTO_VERSION=17 make
  VOLTO_VERSION=17 make start

Add volto-matomo to your Volto project

  1. Make sure you have a Plone backend up-and-running at http://localhost:8080/Plone

    docker compose up backend
    
  2. Start Volto frontend

  • If you already have a volto project, just update package.json:

    "dependencies": {
        "@eeacms/volto-matomo": "*"
    }
    

and volto.config.js:

const addons = ['@eeacms/volto-matomo'];
  • If not, create one with Cookieplone, as recommended by the official Plone documentation for Volto 18+:

    uvx cookieplone project
    cd project-title
    
  1. Install or update dependencies, then start the project:

    make install
    

    For a Cookieplone project, start the backend and frontend in separate terminals:

    make backend-start
    make frontend-start
    

    For a legacy Volto 17 project, install the package with yarn and restart the frontend as usual.

  2. Go to http://localhost:3000

  3. Happy editing!

Release

See RELEASE.md.

How to contribute

See DEVELOP.md.

The Initial Owner of the Original Code is European Environment Agency (EEA). All Rights Reserved.

See LICENSE.md for details.

Funding

European Environment Agency (EU)

版本与发布记录

@eeacms/volto-matomo 共发布 29 个版本,首次发布于 2020/12/03;过去 12 个月发布了 2 个版本。

版本发布日期距今
7.0.1latest2026/04/097 个月前
7.0.02026/03/247 个月前
6.0.12025/08/041.3 年前
6.0.02025/07/161.3 年前
5.0.02024/04/232 年前
4.2.12023/09/293 年前

关于 @eeacms/volto-matomo 的常见问题

@eeacms/volto-matomo 是什么?

volto-matomo: Volto add-on

如何安装 @eeacms/volto-matomo?

在项目目录运行 npm install @eeacms/volto-matomo,或使用 pnpm add / yarn add / bun add。

@eeacms/volto-matomo 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/eeacms__volto-matomo 是否存在。

@eeacms/volto-matomo 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@eeacms/volto-matomo 可以商用吗?

@eeacms/volto-matomo 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@eeacms/volto-matomo 的下载量有多少?

根据 npm 官方下载统计,@eeacms/volto-matomo 在 2026/10/13 – 2026/11/11 这 30 天内被下载 4,065 次,日均约 136 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eeacms/volto-matomo 还在维护吗?

最新版本 7.0.1 发布于 2026/04/09(7 个月前);至今共发布 29 个版本,其中过去 12 个月发布了 2 个;首次发布于 2020/12/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。