nicdev/ga-reporter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Create a Google Cloud Project
  2. Enable the Google Analytics API
  3. Create credentials (OAuth 2.0 or Service Account)
  4. 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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-08