PHPackages                             xcartman/yii2-google-analitics - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. xcartman/yii2-google-analitics

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

xcartman/yii2-google-analitics
==============================

The google analitics extension for the Yii framework

v1.0.2(7y ago)114BSD-3-ClausePHP

Since Sep 5Pushed 7y agoCompare

[ Source](https://github.com/xcartman/Yii2-GoogleAnalitics)[ Packagist](https://packagist.org/packages/xcartman/yii2-google-analitics)[ RSS](/packages/xcartman-yii2-google-analitics/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Yii2 GoogleAnalitics api grabber
================================

[](#yii2-googleanalitics-api-grabber)

This extension provides [google-analitics](https://github.com/xcartman/Yii2-GoogleAnalitics) integration for the Yii framework.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require xcartman/yii2-google-analitics
```

or add

```
"xcartman/yii2-google-analitics": "*"

```

to the `require` section of your `composer.json` file.

Configuring
-----------

[](#configuring)

```
return [
    //...
    'components' => [
        //...
        'ga' => [
            'class' => 'xcartman\ga\GoogleAnalitics',
			//https://ga-dev-tools.appspot.com/account-explorer/
            'viewId' => '',
			//https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-php#1_enable_the_api
			'privateKey' => ''
        ],
    ],
];
```

Usage
-----

[](#usage)

Be sure to look at the [dimension and metrics](https://developers.google.com/analytics/devguides/reporting/core/dimsmets)

### MAKE Simple request and display it

[](#make-simple-request-and-display-it)

```
Yii::$app->ga->begin
	->dateRange('7daysAgo', 'today')
	->metric('ga:sessions')
	->dimension('ga:browser')
	->request()
	->printReports();
```

### how to use in the loop it

[](#how-to-use-in-the-loop-it)

Begin method call

```
for($i=0;$iga->begin metric('ga:sessions')
		->dimension('ga:browser')
		->request()
		->printReports();
}
```

#### MAKE Simple request and converto to array and display it

[](#make-simple-request-and-converto-to-array-and-display-it)

```
  $report = Yii::$app->ga->begin->dateRange('1daysAgo', 'today')
            ->metric('ga:uniqueEvents')
            ->dimension('ga:eventCategory')
            ->dimension('ga:eventAction')
            ->dimension('ga:eventLabel')
            ->request()->one($index = 0);

  print_r($report);
```

#### MAKE Sigment or Filter by data request

[](#make-sigment-or-filter-by-data-request)

```
	$values = Yii::$app->ga->begin->dateRange('70daysAgo', 'today')
        ->metric('ga:uniqueEvents')
        ->dimension('ga:segment')
        ->segment('ga:eventLabel', 'What are you loking for ?')
        ->request()->one($index = 0);
```

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Unknown

Total

1

Last Release

2754d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/301ee342d5f4b0e18f571f98e28221b58a8307c91e99fd9184ae48d053940da1?d=identicon)[evgeniy chorniy](/maintainers/evgeniy%20chorniy)

---

Top Contributors

[![xcartman](https://avatars.githubusercontent.com/u/33236783?v=4)](https://github.com/xcartman "xcartman (28 commits)")

---

Tags

google apigoogle analiticsgoogle api sdk

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/xcartman-yii2-google-analitics/health.svg)

```
[![Health](https://phpackages.com/badges/xcartman-yii2-google-analitics/health.svg)](https://phpackages.com/packages/xcartman-yii2-google-analitics)
```

###  Alternatives

[brussens/yii2-maintenance-mode

Maintenance mode component for Yii framework 2.x.x version.

78253.9k5](/packages/brussens-yii2-maintenance-mode)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1356.4k7](/packages/richardfan1126-yii2-js-register)[infoweb-internet-solutions/yii2-cms-analytics

Analytics module for Yii2

112.4k1](/packages/infoweb-internet-solutions-yii2-cms-analytics)

PHPackages © 2026

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