tomlutzenberger / yii2-googleanalytics
Yii2 Widget for Google Analytics
Installs: 2 962
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- yiisoft/yii2: >=2.0.38
Requires (Dev)
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-12-20 09:00:05 UTC
README
Yii2 GoogleAnalytics
Yii2 Widget for Google Analytics
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist tomlutzenberger/yii2-googleanalytics "*"
or add
"tomlutzenberger/yii2-googleanalytics": "*"
to the required section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by:
<?= \TomLutzenberger\GoogleAnalytics\GoogleAnalytics::widget() ?>
You can either add the ID of your container to the params.php
<?php return [ // ... 'gaId' => YII_ENV_PROD ? 'UA-1234567-01' : '', ];
or pass it directly to the widget:
<?= \TomLutzenberger\GoogleAnalytics\GoogleAnalytics::widget([ 'gaId' => 'UA-1234567-01' ]) ?>
License
This package is published under the MIT License and can be used for any commercial and personal projects.