承接 webfactory/piwik-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webfactory/piwik-bundle

Composer 安装命令:

composer require webfactory/piwik-bundle

包简介

Symfony Bundle that adds a twig-function for the Matomo tracking code.

README 文档

README

Run Tests Coverage Status

A Symfony Bundle that helps you to use the Matomo (formerly known as Piwik) Open Analytics Platform with your project.

It contains a Twig function that can insert the tracking code into your website. Plus, you can turn it off with a simple configuration switch so you don't track your dev environment.

Usage

Somewhere in your views, right before the closing </body> tag, insert

{{ piwik_code() }}

This will add the appropriate Matomo tracking code as described in the API reference.

When you want to display the opt-out dialog as described in the documentation, use the following Twig code:

{{ piwik_opt_out_code() }}

Configuration

You can configure the bundle in your config.yml. Full Example:

webfactory_piwik:
    # Required, no default. Must be set to the site id found in the Matomo control panel
    site_id: 1
    # Required. no default. Hostname and path to the Matomo host.
    piwik_host: my.piwik.hostname
    # Optional, has default. Usually, you only want to include the tracking code in a production environment
    disabled: '%kernel.debug%'
    # Optional, has default. Path to the tracking script on the host.
    tracker_path: "/js/"
    # Optional, has default. Disable cookies in favor of GDPR
    # https://matomo.org/faq/new-to-piwik/how-do-i-use-matomo-analytics-without-consent-or-cookie-banner/ & https://matomo.org/faq/general/faq_157/
    disable_cookies: true

Add calls to the JavaScript tracker API

The JavaScript tracking API provides a lot of methods for setting the page name, tracking search results, using custom variables and much more.

The generic piwik() function allows you to control the _paq variable and add additional API calls to it. For example, in your Twig template, you can write

    <!-- Somewhere in your HTML, not necessarily at the end -->
    {{ piwik("setDocumentTitle", document.title) }}
    {{ piwik("trackGoal", 1) }}

    <!-- Then, at the end: -->
    {{ piwik_code() }}
    </body>

Note that when you call trackSiteSearch, this will automatically disable the trackPageView call made by default. This is the recommended behaviour.

Credits, Copyright and License

This code was written by webfactory GmbH, Bonn, Germany. We're a software development agency with a focus on PHP (mostly Symfony). If you're a developer looking for new challenges, we'd like to hear from you!

Copyright 2012 – 2025 webfactory GmbH, Bonn. Code released under the MIT license.

webfactory/piwik-bundle 适用场景与选型建议

webfactory/piwik-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 132.25k 次下载、GitHub Stars 达 38, 最近一次更新时间为 2014 年 09 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 webfactory/piwik-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 webfactory/piwik-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 webfactory/piwik-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 132.25k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 39
  • 点击次数: 22
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 38
  • Watchers: 8
  • Forks: 16
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-09-11