2017 © Pedro Peláez
 

library gapiwp

Google API Library wrapper for WordPress.

image

hametuha/gapiwp

Google API Library wrapper for WordPress.

  • Monday, June 15, 2015
  • by fumikito
  • Repository
  • 1 Watchers
  • 3 Stars
  • 63 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

gapiwp

Google API Library wrapper for WordPress., (*1)

How to use

Install

Install this libary in your theme or plugin via Composer., (*2)

To do so, you need write commposer.json like below., (*3)

{
  "name": "your-name/your-theme",
  "description": "WordPress theme",
  "require": {
    "hametuha/gapiwp": "1.0.x"
  }
}

Now you can execute composer install. Google API Client is a bit bigger library, --no-dev option is recommended., (*4)

composer install --no-dev

Load library

In your entry point( theme's functions.php or plugin's base file), initialize library., (*5)

// Load auto loader.
include __DIR__.'/vendor/autoload.php';
// Initialize library
\Hametuha\GapiWP\Loader::load();

Googla Analytics

Currently, only Google Analytics API is supported. You can now easily contact with Google Analytics data., (*6)

After initliazing the library, you can see setting screen on admin panel. Go to Setting > Analytics Setting., (*7)

What you should enter is..., (*8)

  • Client ID
  • Client secret

You can get them on Google Developers console. Besides that, you have to save your admin screen URL(e.g. http://local.sample.in/wp-admin//options-general.php?page=gapiwp-analytics) as redirect URI. It will be treated as white-listed., (*9)

// Get Google Analytics client.
$ga = \Hametuha\GapiWP\Loader::analytics();
// Get top 100 pave views of this year.
$result = $ga->fetch('2015-01-01', date_i18n('Y-m-d'), 'ga:pageviews', array(
    'max-results' => 100,
    'dimensions'  => 'ga:pagePath',
    'sort' => '-ga:pageviews'
));
// See what is retrieved.
var_dump($result);
exit;

GapiWP, (*10)

Lisence

Released under MIT lisence. See LISENCE.md., (*11)

The Versions

15/06 2015

dev-master

9999999-dev

Google API Library wrapper for WordPress.

  Sources   Download

MIT

The Requires

 

by Hametuha INC.

15/06 2015

1.0.3

1.0.3.0

Google API Library wrapper for WordPress.

  Sources   Download

MIT

The Requires

 

by Hametuha INC.

07/05 2015

1.0.2

1.0.2.0

Google API Library wrapper for WordPress.

  Sources   Download

MIT

The Requires

 

by Hametuha INC.

20/04 2015

1.0.1

1.0.1.0

Google API Library wrapper for WordPress.

  Sources   Download

MIT

The Requires

 

by Hametuha INC.

20/04 2015

1.0

1.0.0.0

Google API Library wrapper for WordPress.

  Sources   Download

MIT

The Requires

 

by Hametuha INC.