bitapps/wp-telemetry
Composer 安装命令:
composer require bitapps/wp-telemetry
包简介
A simple telemetry library for WordPress.
关键字:
README 文档
README
This package provides a simple way to add telemetry tracking to your WordPress plugin. It sends weekly reports to your server with information about the plugin's usage.
Usage
1. Installation
Install the package using composer:
composer require bitapps/wp-telemetry
2. Create a Telemetry Client
Initialize the telemetry client in your plugin's bootstrap file.
function initialize_telemetry_client() { TelemetryConfig::setTitle($title); TelemetryConfig::setSlug($plugin_slug); TelemetryConfig::setPrefix($plugin_prefix); TelemetryConfig::setVersion($plugin_version); TelemetryConfig::setServerBaseUrl( 'https://api.example.com/' ); TelemetryConfig::setTermsUrl( 'https://example.com/terms/' ); // (optional) TelemetryConfig::setPolicyUrl( 'https://example.com/privacy/' ); // (optional) Telemetry::report()->init(); // initialize telemetry tracking Telemetry::feedback()->init(); // initialize deactivation feedback survey } initialize_telemetry_client();
You are good to go! 👍️
The telemetry client will start sending data weekly to your configured server url.
Configuration
# Activate/Deactivate Telemetry Tracking
You can add a setting in your plugin settings page to allow users to opt-in or opt-out of telemetry tracking. You can use the following methods to change the opt-in/opt-out status.
⚡️ Opt In :
Telemetry::report()->trackingOptIn();
⚡️ Opt Out :
Telemetry::report()->trackingOptOut();
⚡️ Check if tracking is enabled
Telemetry::report()->isTrackingAllowed();
# Tracking Report Modify
⚡️ Filter Hook to Add Additional Data :
This filter allows adding additional data to track information used by the plugin. You can modify the additional_data array to include any custom data needed.
add_filter($plugin_prefix . 'telemetry_additional_data', 'customize_additional_data', 10, 1); function customize_additional_data($additional_data) { // Do your stuffs here return $additional_data; }
⚡️ Filter Hook To Modify Telemetry Data :
This filter allows modifying the telemetry data before sending it to the server. You can modify the $telemetry_data array to include any custom data needed.
add_filter($plugin_prefix . 'telemetry_data', 'customize_telemetry_data', 10, 1); function customize_telemetry_data($telemetry_data) { // Do your stuffs here return $telemetry_data; }
⚡️ Add plugin information in tracking data
Telemetry::report() ->addPluginData() ->init();
# Deactivation Feedback Survey
⚡️ Filter Hook to Add Deactivate Reasons :
This filter allows adding additional deactivate reasons to the feedback survey. You can modify the deactivate_reasons array to include any custom reasons needed.
add_filter($plugin_prefix . 'deactivate_reasons', 'add_deactivate_reasons', 10, 1); function add_deactivate_reasons($deactivate_reasons) { // example of adding a custom deactivate reason $deactivate_reasons[] = [ 'title' => 'What could we have done to improve your experience?', 'placeholder' => 'Please provide your feedback here', ]; return $deactivate_reasons; }
bitapps/wp-telemetry 适用场景与选型建议
bitapps/wp-telemetry 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.49k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 03 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「wp」 「telemetry」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bitapps/wp-telemetry 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bitapps/wp-telemetry 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bitapps/wp-telemetry 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Observability component.
This project extends the Application Insights API surface to support PHP.
Production-ready Laravel Prometheus metrics package with built-in collectors for HTTP, database, cache, queue, events, errors, filesystem, and mail monitoring
Laravel-native observability UI for cboxdk/laravel-telemetry: query Tempo, Loki and Prometheus/Mimir directly and visualize your apps with extensible Livewire cards.
Must-use plugin integrating WordPress with the Upsun platform: environment awareness, router-cache friendliness, safe preview clones, deploy migrations, Site Health checks, and a wp upsun CLI command.
Simple multipurpose telemetry collecting, processing, and metering library.
统计信息
- 总下载量: 7.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2024-03-03