shapecode/matomo-bundle

此包已被放弃,不再维护。没有建议的替代包。

此插件提供 Matomo 功能。

安装: 78

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

1.1.4 2018-11-08 15:05 UTC

This package is auto-updated.

Last update: 2020-09-11 10:13:45 UTC


README

A Symfony2 Bundle that helps you to use the Matomo Open Analytics Platform with your project.

它包含一个 Twig 函数,可以将跟踪代码插入到您的网站中。此外,您可以通过简单的配置开关将其关闭,以便您不需要跟踪开发环境。

安装

只需将以下内容添加到您的 composer.json(见 https://getcomposer.org.cn/

"require": {
    "shapecode/matomo-bundle": "~1.0"
}

并在 app/AppKernel.php 中启用该插件

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Shapecode\Bundle\MatomoBundle\ShapecodeMatomoBundle(),
    );
}

使用

在您的视图中,在 </body> 标签之前某处插入

{{ matomo() }}

这将添加适当的 Matomo 跟踪代码,如API参考中所述

如果需要,您有权实时更改配置

{{ matomo({
    site_id: 1,
    host_name: 'my.matomo.hostname'
    host_path: '/sub_directory/',
    no_script_tracking: false
}) }}

配置

您可以在 config.yml 中配置插件。完整示例

shapecode_matomo:
    site_id: 1                      # required, no default. site id from matomo tool
    disabled: %kernel.debug%        # not required, default %kernel.debug%. Usually, you only want to include the tracking code in a production environment
    host_name: my.matomo.hostname    # required. no default. Hostname to the matomo instance.
    host_path: "/sub_directory/"    # not required, default null. Path to the tracking script on the host.
    no_script_tracking: true        # not required, default true. Enables Image-Tracking if JavaScript is disabeld.

致谢、版权和许可证

版权 2017 shapecode。代码在 MIT 许可证下发布

原始脚本来自 http://www.webfactory.de