[英]Simplest way to get data from Google Analytics?
I am building a service like Wix.com, users can build simple mutli-pages website with ease. 我正在建立Wix.com之类的服务,用户可以轻松地构建简单的多页面网站。 Every website will be including in a global Google Analytics account with a unique profile, then the tracking code is to be placed in the website pages.
每个网站都将包含在具有唯一配置文件的全球Google Analytics(分析)帐户中,然后将跟踪代码放置在网站页面中。
Now, on the website dashboard i want to show the online visitors and the total number of visists for the website for each website separatly, trying to do so i have : 现在,我想在网站仪表板上分别显示每个网站的在线访问者和访客总数,尝试这样做:
Tried using GAPI ( http://code.google.com/p/gapi-google-analytics-php-interface/ ) but due to Google Analytics major update it doesn't work anymore. 使用GAPI( http://code.google.com/p/gapi-google-analytics-php-interface/ )进行了尝试,但是由于Google Analytics(分析)的重大更新,它不再起作用。
I found Google Core reporting API for Analytics, but i believe it's made for 3rd party applications that accesses GA data for their clients, meaning that the user should have a Google account and GA profile for the website, and the App just connects to the account and retrieves data. 我找到了Google Core Analytics(分析)报告API,但我相信它是为访问其客户的GA数据的第三方应用程序制作的,这意味着用户应具有该网站的Google帐户和Google Analytics(分析)配置文件,并且该应用程序仅连接到该帐户并检索数据。 And this of course isn't the case here;
当然这里不是这种情况。 i can't ask the user to create a Google account and embed the tracking code in the website HTML;
我不能要求用户创建一个Google帐户并将跟踪代码嵌入网站HTML中; else what am i here for ?
否则我在这里做什么?
Got the picture ? 有照片吗? I need the simplest method to do this, no fancy stuff.
我需要最简单的方法来做到这一点,没有花哨的东西。
PS: Minutes ago i found this: Google Analytics Query Explorer ( http://ga-dev-tools.appspot.com/explorer/ ), it's a 3rd party app that builds custom queries for GA and gives you the link, something like that : PS:几分钟前,我发现了这一点:Google Analytics(分析)查询浏览器( http://ga-dev-tools.appspot.com/explorer/ ),它是一个第三方应用程序,可为GA建立自定义查询并为您提供链接,例如那:
https://www.googleapis.com/analytics/v3/data/ga?ids= (the ID) &dimensions=ga%3AvisitCount&metrics=ga%3Avisitors&segment=gaid%3A%3A-1&start-date=2013-02-01&end-date=2013-02-23&max-results=50 https://www.googleapis.com/analytics/zh-CN/v3/data/ga?ids=(ID)&dimensions = ga%3AvisitCount&metrics = ga%3Avisitors&segment = gaid%3A%3A-1&start-date = 2013-02-01&end-日期= 2013年2月23日与最大结果= 50
Now, trying to access the URL (thinking; this is easy :) ) the respond is a request for login first : 现在,尝试访问URL(认为;这很容易:)),响应是首先登录的请求:
{"error":{"errors":[{"domain":"global","reason":"required","message":"Login Required","locationType":"header","location":"Authorization"}],"code":401,"message":"Login Required"}} {“错误”:{“错误”:[{“域”:“全局”,“原因”:“必填”,“消息”:“需要登录”,“ locationType”:“ header”,“ location”:“授权“}],”代码“:401,”消息“:”需要登录“}}
Thanks in advance. 提前致谢。
Unless you have fewer than 50 clients this plan is not going to work the way you're asking for. 除非您的客户少于50名,否则该计划将无法按照您的要求进行。 (There is a limit of 50 profiles per account.)
(每个帐户最多只能有50个个人资料。)
The client will have to make their own GA number and provide it to you as a setting for their website. 客户必须制作自己的通用编号,并将其提供给您作为其网站的设置。
In order to display the customers reports on a dashboard on your site you're also going to have to get them to authorize a GA App you create for access. 为了在您网站的仪表板上显示客户报告,您还必须让他们授权您创建的GA应用以供访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.