nicdev/ga-reporter
Composer 安装命令:
composer require nicdev/ga-reporter
包简介
A PHP client for the Google Analytics API
README 文档
README
A modern PHP client for the Google Analytics API
Installation
composer require nicdev/ga-reporter
Setup
- Create a Google Cloud Project
- Enable the Google Analytics API
- Create credentials (OAuth 2.0 or Service Account)
- Download your credentials JSON file
Usage
// Initialize with credentials $client = new \Nicdev\GoogleAnalytics\Client([ 'credentials_path' => '/path/to/credentials.json' ]); // Create Reporter instance $reporter = new \Nicdev\GoogleAnalytics\Reporter($client); // Get page views for last 30 days $startDate = new DateTime('30 days ago'); $endDate = new DateTime(); $pageViews = $reporter->getPageViews('VIEW_ID', $startDate, $endDate); // Get real-time users $activeUsers = $reporter->getRealTimeUsers('VIEW_ID');
Features
- Universal Analytics (UA) and GA4 support
- Real-time reporting
- Audience metrics
- Event tracking
- Custom dimensions and metrics
- Automatic token refresh
- PSR-4 compliant
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-08