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.

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

报告相同问题?

悬赏问题

  • ¥15 表达式必须是可修改的左值
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题