Yii 2.0: 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.


  1. 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.

  2. 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) 



See the GitHub page for more usage cases.

Be the first person to leave a comment

Please to leave your comment.

Create extension
No downloadable files yet