promatur/sc-analytics
Composer 安装命令:
composer require promatur/sc-analytics
包简介
A combination of clientside and serverside analytics for PHP-based websites.
README 文档
README
Code Status
Description
A combination of clientside and serverside analytics for PHP-based websites. This repository builds upon existing
analytics solutions and offers integrations for Matomo
and Google Analytics.
Tested using PHP 7.3, 7.4 and 8.1.
⠀
⠀
⠀
Usage
It is recommended to use SC-Analytics with composer, which is the easiest way to use it. Just add promatur/sc-analytics
to your projects requirements.
composer require promatur/sc-analytics
Use some code like this one:
require_once 'vendor/autoload.php'; // - Configure your preferred analytics endpoint \ScAnalytics\Core\AnalyticsConfig::$matomoID = "1"; \ScAnalytics\Core\AnalyticsConfig::$matomoEndpoint = "https://analytics.example.com/"; // - Initialize the analytics system \ScAnalytics\Analytics::init(); // - Get your Analytics Handler $analytics = Analytics::get(); // - Load the Client-Side JavaScript code and initialize the page view $pageData = new \ScAnalytics\Core\PageData("Help Page", ["Support", "Help Page Overview"]) // Put this anywhere you want to load the JavaScript code echo $analytics->loadJS($pageData);
Learn more in the Wiki.
Assets
SC-Analytics also provides JavaScript assets. If you want the combination of server-side and client-side analytics,
configure the location of the assets in your composer.json:
{
"extra": {
"assets-dir": "assets",
"assets-strategy": "copy"
}
}
If you want to use another folder for the assets, configure it in the config:
\ScAnalytics\Core\AnalyticsConfig::$assets = "my-directory";
Learn more about the Composer Assets Plugin.
Error handling
This package has an integration of Sentry, which is optional to use. Errors are automatically handled by Sentry and additional information is added.
Contributing
Using the library
This is a free/libre library under license LGPL v3 or later.
Your pull requests and/or feedback is very welcome!
Contributors
Created by Jan-Nicklas Adler.
I am looking forward to your contributions and pull requests!
promatur/sc-analytics 适用场景与选型建议
promatur/sc-analytics 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 665 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「javascript」 「web」 「analytics」 「google-analytics」 「privacy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 promatur/sc-analytics 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 promatur/sc-analytics 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 promatur/sc-analytics 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.
Caching and compression for Twig assets (JavaScript and CSS).
A pretty nice way to expose your translation messages to your JavaScript.
Model of a web-based resource
Retrieve a WebResourceInterface instance over HTTP
PHP client for the Google Closure Compiler API in one file.
统计信息
- 总下载量: 665
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2022-02-26
