PHPackages                             atlasmobile/yii2-ga - 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. atlasmobile/yii2-ga

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

atlasmobile/yii2-ga
===================

yii2 google analytics component

1.0.4(10y ago)1446BSD-4-ClausePHP

Since Mar 10Pushed 10y ago4 watchersCompare

[ Source](https://github.com/AtlasGit/yii2-ga)[ Packagist](https://packagist.org/packages/atlasmobile/yii2-ga)[ RSS](/packages/atlasmobile-yii2-ga/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

yii2-ga
=======

[](#yii2-ga)

Google analytics component for Yii2

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist atlasmobile/yii2-ga "*"

```

or add

```
"atlasmobile/yii2-ga": "*"
```

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

Application params
------------------

[](#application-params)

To use this extension, add the following code in your application params:

```
return [
    ...
    'googleAnalytics' => [
        'developerKey' 		 => '', // Public key
        'clientId' 			 => 'xxx.apps.googleusercontent.com', // Client ID
        'analyticsId'        => 'ga:xxxxxxxxx', //(It is the number at the end of the URL starting with p: https://www.google.com/analytics/web/#home/a33443w112345pXXXXXXXX/)
        'serviceAccountName' => 'xxx@xxx.gserviceaccount.com', // Email address
        'privateKeyPath'	 => '', //path to private key in p12 format
    ],
];
```

Add the serviceAccountName () as a new user to your Analyics property.

Usage
-----

[](#usage)

```
use atlasmobile\analytics\Analytics;

class Test
{
	public function example()
	{
		$analytics = new Analytics();
		$analytics->startDate = '';
		$analytics->endDate = '';

		$sessionsData = $analytics->getSessions();
		$visitorsData = $analytics->getUsers();
		$pageViewsData = $analytics->getPageViews();
		$avgSessionsDurationData = $analytics->getAvgSessionDuration();
		$countriesData = $analytics->getCountries();
	}
}
```

Parameters 'startDate' and 'endDate' are set by default for yesterday

Useful links
------------

[](#useful-links)

[Analytics Core Reporting API](https://developers.google.com/analytics/devguides/reporting/core/dimsmets)
[Google API Php Client](https://github.com/google/google-api-php-client)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity64

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

Every ~0 days

Total

2

Last Release

3716d ago

### Community

---

Top Contributors

[![eganbarov](https://avatars.githubusercontent.com/u/3624216?v=4)](https://github.com/eganbarov "eganbarov (10 commits)")

### Embed Badge

![Health badge](/badges/atlasmobile-yii2-ga/health.svg)

```
[![Health](https://phpackages.com/badges/atlasmobile-yii2-ga/health.svg)](https://phpackages.com/packages/atlasmobile-yii2-ga)
```

PHPackages © 2026

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