定制 hametuha/gapiwp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hametuha/gapiwp

最新稳定版本:1.0.3

Composer 安装命令:

composer require hametuha/gapiwp

包简介

Google API Library wrapper for WordPress.

README 文档

README

Google API Library wrapper for WordPress.

How to use

Install

Install this libary in your theme or plugin via Composer.

To do so, you need write commposer.json like below.

{
  "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.

composer install --no-dev

Load library

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

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

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

What you should enter is...

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

// 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

Lisence

Released under MIT lisence. See LISENCE.md.

统计信息

  • 总下载量: 1.85k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固