PHPackages                             cybercog/yii2-google-analytics - 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. cybercog/yii2-google-analytics

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

cybercog/yii2-google-analytics
==============================

Google Analytics Widget for the Yii2 framework

v0.3.2(9y ago)1677.1k↑23.5%72BSD-3-ClausePHP

Since Jan 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/cybercog/yii2-google-analytics)[ Packagist](https://packagist.org/packages/cybercog/yii2-google-analytics)[ RSS](/packages/cybercog-yii2-google-analytics/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (8)Used By (2)

Yii2 Google Analytics Tracking
==============================

[](#yii2-google-analytics-tracking)

[![Gitter chat at https://gitter.im/cybercog/yii2-google-analytics](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/cybercog/yii2-google-analytics?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Latest Stable Version](https://camo.githubusercontent.com/c79d8116d93abd7a3090d8626e1e8efa4a132e4efd4b50851f3a833f0ad5b2af/68747470733a2f2f706f7365722e707567782e6f72672f6379626572636f672f796969322d676f6f676c652d616e616c79746963732f76657273696f6e)](https://packagist.org/packages/cybercog/yii2-google-analytics)[![License](https://camo.githubusercontent.com/67c36acf9eaea4fd425b689fb8447ac7b649446d1b70d449e90ede46897c9213/68747470733a2f2f706f7365722e707567782e6f72672f6379626572636f672f796969322d676f6f676c652d616e616c79746963732f6c6963656e7365)](https://github.com/cybercog/yii2-google-analytics/blob/master/LICENSE)

This extension provides easy way to add Universal Analytics tracking in your Yii2 application.

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

[](#installation)

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

Run in console

```
php composer.phar require cybercog/yii2-google-analytics
```

Usage
-----

[](#usage)

In your `/views/layouts/main.php` add

```
use cybercog\yii\googleanalytics\widgets\GATracking;
```

Then before `` add following code

```
