2017 © Pedro Peláez
 

silverstripe-vendormodule google-api

Connect to the Google Analytics API to get page visits

image

firesphere/google-api

Connect to the Google Analytics API to get page visits

  • Monday, November 20, 2017
  • by Firesphere
  • Repository
  • 1 Watchers
  • 3 Stars
  • 96 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Connect to Google API

codecov Scrutinizer CircleCI Maintainability, (*1)

Google API

The Google API V4 is pretty powerful and supports many different calls to different applications., (*2)

The initial use case implemented in this module is, to get the page views for the a set of pages in a given time period and store this count in the database, so that you can sort pages by popularity. There are many features of the google api, that could be included in future updates or extensions of this module., (*3)

Further functionality is possible with the given API, (*4)

Installation

composer require firesphere/google-api:dev-master, (*5)

And run a dev/build, (*6)

Set up

First, you will have to set up a Google API application, that is connected to Google Analytics. How to set that up is detailed In the Google Documentation., (*7)

Add the absolute path to the key to your _ss_environment file:, (*8)

define('SS_ANALYTICS_KEY', 'name-of-my-file');

Currently, the OAuth2 integration is not built yet, so for now, add the email address from the downloaded json (key: client_email) and add this user to your Analytics account. You will need to give it full administrative powers., (*9)

Second, copy your View ID from the Google Analytics account you want your data from, and put it in the cms under Settings > Google API, (*10)

Configuration

Create a yml file, or add to an existing config yml the configuration for your update:, (*11)

GoogleAnalyticsReportService:
  begins_with: '/mypage' # Find everything Google knows about children of this page. Can not be used in combination with other configurations
  ends_with: 'mypage' # Find everything Google knows about pages whose URL end with 'mypage', Can not be used in combination with other configurations
  whitelist: # Array of pagetypes you want to search for. Can be combined with blacklist
    - MyPageType
    - MyOtherPageType
  blacklist: # Exclude these pagetypes from being returned
    - MyBlacklistedPage
    - MyOtherBlacklistedPage

With multiple filters, it seems Google limits to only the first 20 filters., (*12)

If you have multiple filters, you need to set up the batch functionality. By default, the CronTask will do this for you., (*13)

The crontask currently does not support scheduling, but will probably do so in the future., (*14)

Filters are what Google calls "DimensionFilters", which are contained in a "DimensionFilterClause". A filter, at this stage, is a specific page URL., (*15)

More on DimensionFilterClauses and DimensionFilters can be found in the Google Documentation., (*16)

Did you say Ninja Unicorns?

                                                    /
                                                  .7
                                       \       , //
                                       |\.--._/|//
                                      /\ ) ) ).'/
                                     /(  \  // /
                                    /(   J`((_/ \
                                   / ) | _\     /
                                  /|)  \  eJ    L
                                 |  \ L \   L   L
                                /  \  J  `. J   L
                                |  )   L   \/   \
                               /  \    J   (\   /
             _....___         |  \      \   \```
      ,.._.-'        '''--...-||\     -. \   \
    .'.=.'                    `         `.\ [ Y
   /   /                                  \]  J
  Y / Y                                    Y   L
  | | |          \                         |   L
  | | |           Y                        A  J
  |   I           |                       /I\ /
  |    \          I             \        ( |]/|
  J     \         /._           /        -tI/ |
   L     )       /   /'-------'J           `'-:.
   J   .'      ,'  ,' ,     \   `'-.__          \
    \ T      ,'  ,'   )\    /|        ';'---7   /
     \|    ,'L  Y...-' / _.' /         \   /   /
      J   Y  |  J    .'-'   /         ,--.(   /
       L  |  J   L -'     .'         /  |    /\
       |  J.  L  J     .-;.-/       |    \ .' /
       J   L`-J   L____,.-'`        |  _.-'   |
        L  J   L  J                  ``  J    |
        J   L  |   L                     J    |
         L  J  L    \                    L    \
         |   L  ) _.'\                    ) _.'\
         L    \('`    \                  ('`    \
          ) _.'\`-....'                   `-....'
         ('`    \
          `-.___/ 

License

BSD-3 clause, (*17)

The Versions

20/11 2017

4.x-dev

4.9999999.9999999.9999999-dev

Connect to the Google Analytics API to get page visits

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Ninja Unicorns

api analytics google silverstripe ninja ninja unicorns unicorns

26/10 2017

0.40.1

0.40.1.0

Connect to the Google Analytics API to get page visits

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Ninja Unicorns

api analytics google silverstripe ninja ninja unicorns unicorns

26/10 2017

dev-master

9999999-dev

Connect to the Google Analytics API to get page visits

  Sources   Download

BSD-3-Clause

The Requires

 

by Ninja Unicorns

api analytics google silverstripe ninja ninja unicorns unicorns

26/10 2017

0.0.3

0.0.3.0

Connect to the Google Analytics API to get page visits

  Sources   Download

BSD-3-Clause

The Requires

 

by Ninja Unicorns

api analytics google silverstripe ninja ninja unicorns unicorns

25/10 2017

0.0.2

0.0.2.0

Connect to the Google Analytics API to get page visits

  Sources   Download

BSD-3-Clause

The Requires

 

by Ninja Unicorns

api analytics google silverstripe ninja ninja unicorns unicorns

20/10 2017

0.0.1

0.0.1.0

Connect to the Google Analytics API to get page visits

  Sources   Download

BSD-3-Clause

The Requires

 

by Ninja Unicorns

api analytics google silverstripe ninja ninja unicorns unicorns