reactmore/google-analytic-api-client
Composer 安装命令:
composer require reactmore/google-analytic-api-client
包简介
A PHP package to retrieve Google Analytics data
README 文档
README
PHP library to help you integrate your system to API Google Analytics.
Installation
composer require reactmore/google-analytic-api-client
Configuration .env optional :
VIEW_ID=215165900
SERVICE_CREDENTIALS_JSON= 'google_analytic_services.json'
Usage :
require 'vendor/autoload.php'; use Reactmore\GoogleAnalyticApi\Analytics; use Reactmore\GoogleAnalyticApi\Helpers\Period; // Auto Get from Dotenv $Analytics = new Analytics(); // or manual $Analytics = new Analytics([ 'view_id' => 21312312313, 'service_credentials_json' => 'path/to/google_analytic_services.json' ]); echo '<pre>'; var_dump($Analytics->Fetching()->fetchUserTypes(Period::days(7))); echo '</pre>'; // Method $Analytics = new Analytics(); // Fetch Users and New Users $Analytics->Fetching()->fetchUserTypes(Period::days(7)); // Get Data Top Browser used visitor $Analytics->Fetching()->fetchTopBrowsers(Period::days(7)); // Get Data Refferer Page $Analytics->Fetching()->fetchTopReferrers(Period::days(7)); // Populer Pages $Analytics->Fetching()->fetchMostVisitedPages(Period::days(7)); // Get Visitor and Pageviews $Analytics->Fetching()->fetchTotalVisitorsAndPageViews(Period::days(7));
Example Output Array :
array(2) {
[0]=>
array(2) {
["type"]=>
string(11) "New Visitor"
["sessions"]=>
int(2581)
}
[1]=>
array(2) {
["type"]=>
string(17) "Returning Visitor"
["sessions"]=>
int(1215)
}
}
// Custom Query $Analytics->Fetching()->performQuery($period, $metrix, $other = array()); // Example $Analytics->Fetching()->performQuery(Period::days(7), 'ga:sessions', ['dimensions' => 'ga:country', 'sort' => '-ga:sessions'])->getRows();
Example Output Raw Array :
array(30) {
[0]=>
array(2) {
[0]=>
string(9) "Indonesia"
[1]=>
string(4) "3534"
}
[1]=>
array(2) {
[0]=>
string(11) "Afghanistan"
[1]=>
string(2) "96"
}
[2]=>
array(2) {
[0]=>
string(13) "United States"
[1]=>
string(2) "88"
}
}
Explore Query on this App ga-dev-tools
Screenshot
reactmore/google-analytic-api-client 适用场景与选型建议
reactmore/google-analytic-api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 41 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 10 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「google analytic」 「reactmore」 「google-analytic-api-client」 「Google Analytic API」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 reactmore/google-analytic-api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 reactmore/google-analytic-api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 reactmore/google-analytic-api-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Heyday's standard analytics module
A laravel package that simplifies the collection and visualization of your system analytics.
Matomo statistics for Contao 4
Magento 2 Social Login extension is designed for quick login to your Magento 2 store without procesing complex register steps
Plugin to use Matomo in your symfony2 project.
Client for Google Directions API to add interpolated points to a route consisting of given coordinates.
统计信息
- 总下载量: 41
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-06
