All Projects → cybercog → yii2-google-analytics

cybercog / yii2-google-analytics

Licence: other
Google Analytics Universal tracking widget.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to yii2-google-analytics

Yii2 Sortable Widgets
🍨 Rubaxa/Sortable for Yii2
Stars: ✭ 54 (+285.71%)
Mutual labels:  widget, yii2
yii2-stat
Yii2 Multi Web Statistic Module (yametrika, google-analytic, own db-counter)
Stars: ✭ 18 (+28.57%)
Mutual labels:  yii2, google-analytics
Yii2 Date Picker Widget
Bootstrap DatePicker Widget for Yii2
Stars: ✭ 128 (+814.29%)
Mutual labels:  widget, yii2
Yii2 Fullcalendar
Widget for Yii Framework 2.0 to use FullCalendar
Stars: ✭ 5 (-64.29%)
Mutual labels:  widget, yii2
yii2-datetime-widgets
Datetime widgets for Yii2
Stars: ✭ 22 (+57.14%)
Mutual labels:  widget, yii2
Yii2 Fotorama Widget
Fotorama image gallery widget for yii2
Stars: ✭ 18 (+28.57%)
Mutual labels:  widget, yii2
yii2-grid-view-library
Highly enhanced GridView widget and grid components for Yii2
Stars: ✭ 57 (+307.14%)
Mutual labels:  widget, yii2
yii2-time-down-counter
Widget for yii2, to start count down timer with a lot of options, This widget build dependence of timeDownCounter JS library
Stars: ✭ 15 (+7.14%)
Mutual labels:  widget, yii2
yii2-content-tools
ContentTools editor implementation for Yii 2
Stars: ✭ 79 (+464.29%)
Mutual labels:  widget, yii2
yii2-switch-widget
Bootstrap Switch Widget for Yii2
Stars: ✭ 17 (+21.43%)
Mutual labels:  widget, yii2
yii2-notification-wrapper
Yii2-notification-wrapper module renders a message from session flash (with ajax, pjax support and etc.) through Growl, Noty, Toastr and more libraries
Stars: ✭ 78 (+457.14%)
Mutual labels:  widget, yii2
yii2-highcharts-widget
HighCharts Js Widget for Yii2
Stars: ✭ 40 (+185.71%)
Mutual labels:  widget, yii2
yii2-number
A number format mask control and input for Yii2 Framework
Stars: ✭ 22 (+57.14%)
Mutual labels:  widget, yii2
Yii2 Quill
Yii 2 implementation of Quill, modern WYSIWYG editor
Stars: ✭ 52 (+271.43%)
Mutual labels:  widget, yii2
yii2-multi-select-widget
Bootstrap MultiSelect and MultiSelect Listbox widgets for Yii2
Stars: ✭ 45 (+221.43%)
Mutual labels:  widget, yii2
Yii2 Imperavi Widget
Imperavi Redactor widget for Yii 2
Stars: ✭ 250 (+1685.71%)
Mutual labels:  widget, yii2
laravel-youtrack-sdk
Laravel wrapper for the YouTrack PHP Software Development Kit provides set of tools to interact with JetBrains YouTrack.
Stars: ✭ 17 (+21.43%)
Mutual labels:  cog, cybercog
yii2-widget-cropbox
This widget allows crop image before upload to server and send informations about crop in JSON format.
Stars: ✭ 90 (+542.86%)
Mutual labels:  widget, yii2
yii2-cookiemonster
Yii extension to manage cookie warning
Stars: ✭ 16 (+14.29%)
Mutual labels:  widget, yii2
yii2-dynamic-fields
Widget for display dynamic fields, adding and removing their using Pjax.
Stars: ✭ 52 (+271.43%)
Mutual labels:  yii2

Yii2 Google Analytics Tracking

Gitter chat at https://gitter.im/cybercog/yii2-google-analytics Latest Stable Version License

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

Installation

The preferred way to install this extension is through composer.

Run in console

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

Usage

In your /views/layouts/main.php add

use cybercog\yii\googleanalytics\widgets\GATracking;

Then before </head> add following code

<?= GATracking::widget([
    'trackingId' => 'UA-XXXXXXXX-X',
]) ?>

Advanced usage

Omit script tag

By default this script generated output:

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-X', "auto");
ga('send', 'pageview');
ga('set', 'anonymizeIp', true);
</script>

But sometimes we need the output without script tag to combined with registerJs or registerJsFile as renderPartial to add dependency or positioning configuration, you can use omitScriptTag true to disable script tag, example:

<?= $this->registerJs(
    GATracking::widget([
        'trackingId' => 'UA-XXXXXXXX-X',
        'omitScriptTag' => true,
    ]), \yii\web\View::POS_END
); ?>

Example of advanced usage

You can configure tracking script for your needs:

<?= GATracking::widget([
    'trackingId' => 'UA-XXXXXXXX-X',
    'trackingConfig' => [
        'name' => 'myTracker',
        'allowAnchor' => false,
    ],
    'omitScriptTag' => false,
    'debug' => true,
    'debugTrace' => true,
    'anonymizeIp' => true,
    'plugins' => [
        'linkid' => [
            'cookieName' => '_ccli',
            'duration' => 45,
            'levels' => 5,
        ],
    ],
]) ?>

Available fields (parameters)

Field Name Value Type Default Value
anonymizeIp boolean true
debug boolean false
debugTrace boolean false

Official field reference

Available plugins

linkid (Enhanced Link Attribution)

Option Name Default Value Description
cookieName _gali Cookie name
duration 30 Cookie duration (seconds)
levels 3 Max DOM levels from link to look for element ID

Creating your own plugins

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].