GAPI正在关闭需要Google Analytics的轻量级PHP API [英] GAPI is Shutting Down Need A Lightweight PHP API for Google Analytics

查看:133
本文介绍了GAPI正在关闭需要Google Analytics的轻量级PHP API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是昨天关闭的GAPI用户的问题:

https://code.google.com/p/gapi-google-analytics-php-interface



GAPI - Google AnalyticsAPI PHP界面是一个简单但功能强大的Google Analytics库。它使用的是旧API,并且需要完整的Google用户名和密码,这真是老式的,但它像一个魅力。但是在这里,我们的基于GAPI的代码给出了消息:
$ b


无法验证用户AuthForInstalledApps
blockquote>

唯一的选择是使用oAuth2.0,所以我们到了这里?

Google客户端Libray: https://github.com/google/google-api-php -client



这个图书馆的问题在于,它不仅仅是Google Analytics的共同库。因此,如果您打算仅将它用于Google Analytics,那么它有很多不必要的类,例如Fitness,Adsense,Book,Blogger?好的一面是,我们可以只使用一个基本的PHP类来完成整个工作,现在为什么我们需要使用千行代码?

我真的读了很多Q& A,几乎尝试了所有PHP类,但他们都参考了Google Client Library。当我找到 wanze的Analytics API 时,我非常兴奋,因为它使用的是Oauth 2.0和更新的库,但这行返回空,所以它没有工作。

  $ auth = $ ga-> auth-> getAccessToken($ code); 

所以,我们现在正在寻找一个适用于Google Analytics的轻量级PHP库,使用oAuth2,什么是您的建议在客户端库旁边?

解决方案

我是维护者,今天就GAPI和OAuth2要求联系了。刚刚从社区发布的 GitHub 2.0版上发布。



Version 2.0是一个1.3 / 1.4的直接端口,应该与您现有的系统匹配。请注意,OAuth2会要求您创建一个服务帐户,然后下载P12文件上传到服务器。最后,您需要调整开发者控制台,启用分析API。最后,让这位新用户对您要访问的Google Analytics帐户拥有读取和分析权限。


This is the question for GAPI users which shut down yesterday:

https://code.google.com/p/gapi-google-analytics-php-interface

GAPI - Google Analytics API PHP Interface was a simple yet powerfull Google Analytics library. It was using the old API and required full Google username and password which was really old fashioned but it was working like a charm. bUT here we are, our GAPI based codes gives the message:

Failed to authenticate user AuthForInstalledApps

The only option is to use the oAuth2.0, so what we got here?

Google Client Libray: https://github.com/google/google-api-php-client

The issue with this library is, it's a common library, not just for Analytics. So if you're going to use it just for Analytics, it has lots of unnecessary classes like, Fitness, Adsense, Book, Blogger? The good side was, we can use just one basic php class to do the whole work, now why do we need to use thousand lines of codes?

I really read lots of Q&A, tried nearly all the PHP classes for that issue but they all referenced Google Client Library. When I found wanze's Analytics API I was really excited because it's using Oauth 2.0 and an updated library but this line returned empty, so it didn't work.

$auth = $ga->auth->getAccessToken($code); 

So here we are, looking for a lightweight PHP library just for Google Analytics, using oAuth2, what's your suggestions beside Client Library?

解决方案

I am maintainer and was contacted today regarding GAPI and the OAuth2 requirement. Just released Version 2.0 on GitHub from contributions from the community.

Version 2.0 is a straight port from 1.3/1.4 and should match your existing system. Note that OAuth2 will require you to create a 'service account' and then download a P12 file to upload to the server. Finally you will need to adjust the developers console, enable 'analytics API'. Finally give this new user 'Read and Analyse' permissions on the Google Analytics accounts you want to access.

这篇关于GAPI正在关闭需要Google Analytics的轻量级PHP API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆