PHPackages                             reactmore/google-analytic-api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. reactmore/google-analytic-api-client

ActiveLibrary[API Development](/categories/api)

reactmore/google-analytic-api-client
====================================

A PHP package to retrieve Google Analytics data

1.0.5(2y ago)136MITPHP

Since Oct 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/reactmore/google-analytic-api-client)[ Packagist](https://packagist.org/packages/reactmore/google-analytic-api-client)[ Docs](https://github.com/reactmore/google-analytic-api-client)[ RSS](/packages/reactmore-google-analytic-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (5)Versions (6)Used By (0)

Google Analytic API Client
==========================

[](#google-analytic-api-client)

[![Latest Stable Version](https://camo.githubusercontent.com/1ff87a44e8babd3231778747175428948609735f1d6b1fe869d8c69b313bfde3/687474703a2f2f706f7365722e707567782e6f72672f72656163746d6f72652f676f6f676c652d616e616c797469632d6170692d636c69656e742f76)](https://packagist.org/packages/reactmore/google-analytic-api-client) [![Total Downloads](https://camo.githubusercontent.com/ba9debc50ea745631a18c6d18dd6360030a742a328f074e1546b8be317b9986e/687474703a2f2f706f7365722e707567782e6f72672f72656163746d6f72652f676f6f676c652d616e616c797469632d6170692d636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/reactmore/google-analytic-api-client) [![Latest Unstable Version](https://camo.githubusercontent.com/fa25035e1d73db85b747d8d3a3276533cd9d932b77adf2807d5b463185384e59/687474703a2f2f706f7365722e707567782e6f72672f72656163746d6f72652f676f6f676c652d616e616c797469632d6170692d636c69656e742f762f756e737461626c65)](https://packagist.org/packages/reactmore/google-analytic-api-client) [![License](https://camo.githubusercontent.com/70eae1468dba09274858bb656e3f722add365177ba23433e805b006cca7e1198/687474703a2f2f706f7365722e707567782e6f72672f72656163746d6f72652f676f6f676c652d616e616c797469632d6170692d636c69656e742f6c6963656e7365)](https://packagist.org/packages/reactmore/google-analytic-api-client) [![PHP Version Require](https://camo.githubusercontent.com/9c287e4d4cda36ed14442581853290c809391d865210aef2c714d9dc8b075705/687474703a2f2f706f7365722e707567782e6f72672f72656163746d6f72652f676f6f676c652d616e616c797469632d6170692d636c69656e742f726571756972652f706870)](https://packagist.org/packages/reactmore/google-analytic-api-client)

PHP library to help you integrate your system to API Google Analytics.

Installation
------------

[](#installation)

```
composer require reactmore/google-analytic-api-client
```

Configuration .env optional :

```
VIEW_ID=215165900
SERVICE_CREDENTIALS_JSON= 'google_analytic_services.json'

```

Usage :
-------

[](#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 '';
var_dump($Analytics->Fetching()->fetchUserTypes(Period::days(7)));
echo '';

// 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](https://ga-dev-tools.web.app/query-explorer/)

Screenshot
----------

[](#screenshot)

[![Backend](https://raw.githubusercontent.com/reactmore/google-analytic-api-client/master/screenshoot.png)](https://raw.githubusercontent.com/reactmore/google-analytic-api-client/master/screenshoot.png)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~72 days

Total

5

Last Release

1031d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3570cc985c6b8a72d6c662e81a23ef79c03cea6b4ad9e82da64365a5a641afe5?d=identicon)[reactmore](/maintainers/reactmore)

---

Top Contributors

[![reactmore](https://avatars.githubusercontent.com/u/64960434?v=4)](https://github.com/reactmore "reactmore (17 commits)")

---

Tags

phpgoogle analyticreactmoregoogle-analytic-api-clientGoogle Analytic API

### Embed Badge

![Health badge](/badges/reactmore-google-analytic-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/reactmore-google-analytic-api-client/health.svg)](https://phpackages.com/packages/reactmore-google-analytic-api-client)
```

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69433.0M114](/packages/algolia-algoliasearch-client-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1537.5k](/packages/bacula-web-bacula-web)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
