Cloudflare 中文文档
Analytics
Analytics
编辑这个页面
跳转官方原文档
Set theme to dark (⇧+D)

Zone Analytics to GraphQL Analytics

The Zone Analytics API allows you to get request data by zone. It offers optional since and until parameters to specify the request time period and a continuous parameter to indicate whether the time period should be moved backward to find a period with completely aggregated data.

For example, here is a sample curl call to get data for a two minute period:

Response

As you can see from the response, Zone Analytics returns metrics along many dimensions and does not give you the option to control what you receive. With GraphQL Analytics, you can ask for only the data that you need. However, if you wanted to get exactly the same metrics and dimensions as you would from Zone Analytics, here is the query you would make:

Response

Notice that you can specify the request time period using a dataset filter (refer to Filtering). The continuous parameter is no longer needed because GraphQL Analytics is designed to provide data as soon as it is available.

Also, if you want to get the totals for a particular period, rather than a breakdown by time period, simply remove the datetimeMinute field under dimensions.