如何存储来自谷歌分析的API谷歌驱动器抽样报告? [英] How to store unsampled reports from Google Analytics API to Google Drive?

查看:159
本文介绍了如何存储来自谷歌分析的API谷歌驱动器抽样报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读了如何检索从谷歌分析的API谷歌驱动器抽样报告数据指令:<一href=\"https://developers.google.com/analytics/devguides/config/mgmt/v3/unsampled-reports#introduction\" rel=\"nofollow\">https://developers.google.com/analytics/devguides/config/mgmt/v3/unsampled-reports#introduction

I read this instruction on how to retrieve data for unsampled reports from Google Analytics API to Google Drive: https://developers.google.com/analytics/devguides/config/mgmt/v3/unsampled-reports#introduction

据我了解,这里有检索抽样报告的步骤:
 1. Store中的非抽样报告给谷歌云端硬盘API
 2.使用驱动API下载文件

As far as I understand, here are the steps to retrieve unsampled reports: 1. Store the unsampled reports to Google Drive API 2. Use Drive API to download the file

不过,我无法找到如何存储谷歌云端硬盘API的抽样报告的说明。你能告诉我在如何做到这一点的详细信息?此外,如果你可以,请告诉我如何使用API​​驱动下载的文件也是如此。

However, I couldn't find the instructions on how to store the unsampled reports to Google Drive API. Could you please tell me in details on how to do this? Also if you could, please tell me how to use Drive API to download the file as well.

感谢您提前。

推荐答案

首先,抽样报告仅提供给谷歌Analytics(分析)360(previously谷歌分析premium)的用户。所以,如果你只使用该产品的免费版本此功能根本就没有用,API应该给你一个错误。

First of all, Unsampled Report is only available to Google Analytics 360 (Previously Google Analytics Premium) users. So if you use only the free version of the product this feature is simply not available, the API should give you an error.

非抽样API有3种方法:

The Unsampled API has 3 methods:


  • 插入 - 创建一个新的抽样报告

  • 获得 - 获取给定的抽样报告的状态

  • 列表 - 列出你在一个给定的配置文件ID创建的所有抽样报告的状态

  • insert - Creates a new Unsampled Report
  • get - Get the status of a given Unsampled Report
  • list - list the status of all unsampled reports you created in a given profileId

现在,你必须记住,非抽样报告可以采取生成了几个小时。因此,使用非抽样报告API的动力显然是从核心报告API有点不同。在核心报告API查询后得到的结果的时候了。随着非抽样API,您只需创建一个报告,并等待它做好准备。

Now you have to keep in mind that Unsampled Reports can take a few hours to be generated. So the dynamics of using the Unsampled Reporting API are obviously a bit different from the Core Reporting API. After a query on the Core Reporting API you get the results right away. With the Unsampled API you just create a report and have to wait for it to be ready.

这里的,大概,是如何从非抽样API作品导出数据。

Here's, roughly, how exporting data from the Unsampled API works.


  1. 使用<一个href=\"https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/unsampledReports/insert\"相对=nofollow> 插入 方法的API来创建一个新的抽样报告。在<一个href=\"https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/unsampledReports#resource-re$p$psentations\"相对=nofollow>响应将可​​能有一个状态:待这意味着正在处理的报告。要存储在 ID 参数你从这个请求得到的。

  2. 等待了一个小时

  3. 使用 ID 步骤(1),并发出<一个href=\"https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/unsampledReports/get\"相对=nofollow> GET 请求API。这会给你的抽样报告的当前状态。如果这仍有待返回步骤(2)。

  4. 如果状态为完成这份报告,应该是完整的,在谷歌驱动器已经在等你。该API应该返回 driveDownloadDetails.documentId 要存储这一点。

  5. 使用谷歌云端硬盘API 来获取文件的内容引用您步骤得到(4)

  1. Use the insert method on the API to create a new Unsampled Report. The Response will probably have a status: PENDING which means the report is being processed. You want to store the id parameter you get from this request.
  2. Wait for an hour
  3. Use the id from step (1) and issue a get request to the API. This will give you the current status of the unsampled report. If this is still PENDING go back to step (2).
  4. If the status is COMPLETE the report should be complete and already waiting for you in Google Drive. The API should return a driveDownloadDetails.documentId you want to store this.
  5. Use the Google Drive API to fetch the contents of the file reference you got from step (4)

这篇关于如何存储来自谷歌分析的API谷歌驱动器抽样报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆