GAPI is Shutting Down Need A Lightweight PHP API for Google Analytics

半腔热情 提交于 2019-11-30 10:14:36

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.

Hello Have you tried working through the recently updated Hello Analytics API for PHP? It goes through two different authentication methods. The web app and service account.

You will probably need to update the underlying client library.

Metablocks Corp

Had the same situation and just made the switch to Google Client Libray: https://github.com/google/google-api-php-client. Trust me, its not bad at all. I prefer lightweight but its pretty easy to use and you don't see much of the excess weight. The reason I would recommend it, once you make the switch, you can leverage Google tools (Analytic Query editor for example) and documentation. Took me an hour or so to 'port' my code. Rather than using a service account and certificate, I just save and store my oauth access token.

This article can help you with setup: http://www.daimto.com/google-oauth2-php/ and the code for actually doing the analytics i have examples of here (in my answer): Get function in Google Analytics API

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!