yii2-ga-measurement-protocol Google Analytics Measurement Protocol for Yii2

Interact with Google Analytics directly. No need of any JS code. Pure server-side.

Full support for all methods of the Google Analytics Measurement Protocol is provided.

Installation

0. The preferred way to install this extension is through composer.

To install, either run ~~~ $ php composer.phar require baibaratsky/yii2-ga-measurement-protocol:1.1. ~~~ or add ~~~ "baibaratsky/yii2-ga-measurement-protocol": "1.1." ~~~ to the require section of your composer.json file.

0. Add the component configuration in your main.php config file:

'components' => [
     'ga' => [
         'class' => 'baibaratsky\yii\google\analytics\MeasurementProtocol',
         'trackingId' => 'UA-XXXX-Y', // Put your real tracking ID here\

         // These parameters are optional:
         'useSsl' => true, // If you’d like to use a secure connection to Google servers
         'overrideIp' => false, // By default, IP is overridden by the user’s one, but you can disable this
         'anonymizeIp' => true, // If you want to anonymize the sender’s IP address
         'asyncMode' => true, // Enables the asynchronous mode (see below) 
     ],
 ],
 ~~~


##Usage

[php] \Yii::$app->ga->request()

->setClientId('12345678')
->setDocumentPath('/mypage')
->sendPageview();
See the [GitHub page](https://github.com/baibaratsky/yii2-ga-measurement-protocol#usage) for more usage cases.
0 0
3 followers
20 downloads
Yii Version: 2.0
License: BSD-2-Clause
Category: Others
Developed by: baibaratsky
Created on: Apr 27, 2015
Last updated: 2 years ago

Related Extensions