0

I will tell you straight away that I am not very experienced with php, so I kinda need help on this one since the manuals of Google are confusing to me.

What exactly do I need to create a PHP file that can just communicate server-to-server with GA getting the RT data ? I want to create a PHP-API that I can call from elsewhere, but I'm having trouble with setting up the core communication with GA.

What I have done so far: I've followed these instructions to get the library cloning the git. (Instructions I used: https://developers.google.com/api-client-library/php/auth/service-accounts) (Git I cloned: https://github.com/google/google-api-php-client)

What should I do next ? Any Advices or examples from where I could copy and adjust it ? I am sorry for asking such a newbie question.

nik1337
  • 73
  • 1
  • 6
  • 1
    my advice get this to work first https://developers.google.com/analytics/devguides/reporting/core/v3/quickstart/service-php in the mean time apply for beta access for the real time api https://docs.google.com/forms/d/e/1FAIpQLSc9OpoDGB3tBD7oy1OG9fyum8KBIxs-2ihPCsHp13WTnM-SSQ/viewform by the time you get the first one working you should have access to beta and should understand how to change the code to work with the RT api https://developers.google.com/analytics/devguides/reporting/realtime/v3/reference/ – Linda Lawton - DaImTo Sep 28 '16 at 10:22
  • hey @DaImTo , thanks for your reply and your advice ! I already have a running Version for the regular GA information things. My bad, i thought setting up for RT was different. I checked up a bit more and tried to make some changes on my existing code to grab the RT information, but I am not sure how to do that exactly. I already went through the registration for RT access last friday since i knew that I'd have to deal with it eventually. http://pastebin.com/fWj7gCTr this is my current code, i removed sensitive data. getLiveUserCount() is where i try to get RT data. – nik1337 Sep 28 '16 at 13:05
  • that's the Reporting api (analytics v4) not the core reporting api (analytics v3) its way different from the real-time api. Looking at core reporting will be much closer. check my first link – Linda Lawton - DaImTo Sep 28 '16 at 13:10
  • 1
    @DaImTo hey many many thanks for pointing me to the analytics v3 ! I managed to grab the active user count ! many thanks for your help ! :) – nik1337 Oct 25 '16 at 15:26

0 Answers0