2017 © Pedro Peláez
 

library yii2-google-api

Google Api Component for Yii2

image

gillbeits/yii2-google-api

Google Api Component for Yii2

  • Thursday, March 3, 2016
  • by gillbeits
  • Repository
  • 1 Watchers
  • 3 Stars
  • 1,415 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 1 Versions
  • 31 % Grown

The README.md

# Google Api Component for Yii2

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Installation

The preferred way to install this component is through composer., (*2)

php composer.phar require --prefer-dist gillbeits/yii2-google-api

###Configuration

in your app and/or console configuration file, add, (*3)

'components' => [
    // Google Api Configuration
    'google-api'   => [
        'class'             => 'gillbeits\Yii2GoogleApi\GoogleApi',
        'credentials' => '@common/config/google-api-server-key.json',
        'services' => [
            'analytics' => [
                'class' => '\Google_Service_Analytics',
                'scopes' => ['https://www.googleapis.com/auth/analytics.readonly']
            ],
            ...
        ]
    ],
    ...
],

Usage


// Get Sessions by user gender dimension $data = \Yii::$app->{'google-api'} ->analytics ->data_ga ->get( "ga:<AnalyticsViewID>", "2015-01-01", "today", "ga:sessions", [ "dimensions" => "ga:userGender" ] ) ;

Widgets

For usage widgets in Yii2 install yiisoft/yii2-bootstrap library:, (*4)

php composer.phar require yiisoft/yii2-bootstrap
  • Google Analytics widget usage, (*5)

    <?= gillbeits\Yii2GoogleApi\Widgets\AnalyticsGAData::widget([
        'viewId' => <AnalyticsViewID>,
        'startDate' => '2015-01-01',
        'endDate' => 'today',
        'metrics' => 'ga:sessions',
        'dimensions' => 'ga:userGender',
        'templateFile' => '//analytics/widgets/AnalyticsGenderGA'
    ])?>
    

The Versions

03/03 2016

dev-master

9999999-dev

Google Api Component for Yii2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ivan Koretskiy