doukun5339 2014-01-22 06:54
浏览 58
已采纳

使用Google Analytics的服务帐户

I wanted to create a web service like feature that would provide me the JSON response from the google analytics, i plan to do some processing on the GA data and then output the response to the user who would have requested for my service.

I selected PHP as my language and used google-api-php-client from google and now since i don't want to authorize every time to get Token, i thought of using Service account with which i would directly use keys.

I downloaded the sample code from Google changed client ID and Service Account Name and Key location.

But then this Error Came

Catchable fatal error: Argument 3 passed to Google_HostedmodelsServiceResource::predict() 
must be an instance of Google_Input, none given, called in /var/www/webservice/GA/serviceanalytics.php 
on line 62 and defined in /var/www/webservice/GA/google-api-php-client/src/contrib/Google_PredictionService.php on line 36

I found that the second argument that example is passing should have been the third argument.

So what should be the second argument. A little insight or a working code will be appreciated :)

Thanks

  • 写回答

1条回答 默认 最新

  • dongshang1979 2014-01-22 08:58
    关注

    The link you have posted svn/trunk/examples/prediction/serviceAccount.php

    Is for use with Google Preditions api If you have supplied a client ID and Service Account Name and Key location for an api that was set up to allow google analytics this wont work. I sugest you look for an example using Google Analtyics or change the apis console to allow preditions api while you are getting to know the sample code for Google Preditions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上