---
title: Analytics
---

[Skip to content](#%5Ftop) 

[API Reference](https://developers.cloudflare.com/api/typescript)

[Spectrum](https://developers.cloudflare.com/api/typescript/resources/spectrum)

Copy Markdown

Open in **Claude**

Open in **ChatGPT**

Open in **Cursor**

---

**Copy Markdown**

**View as Markdown**

# Analytics

#### AnalyticsAggregates

#### AnalyticsAggregatesCurrents

##### [Get current aggregated analytics](https://developers.cloudflare.com/api/typescript/resources/spectrum/subresources/analytics/subresources/aggregates/subresources/currents/methods/get)

client.spectrum.analytics.aggregates.currents.get(CurrentGetParams { zone\_id, appID, colo\_name } params, RequestOptionsoptions?): [CurrentGetResponse](https://developers.cloudflare.com/api/typescript/resources/spectrum#%28resource%29%20spectrum.analytics.aggregates.currents%20%3E%20%28model%29%20current%5Fget%5Fresponse%20%3E%20%28schema%29) { appID, bytesEgress, bytesIngress, 2 more } 

GET/zones/{zone\_id}/spectrum/analytics/aggregate/current

##### ModelsExpand Collapse 

CurrentGetResponse \= Array<CurrentGetResponseItem\>

appID: string

Application identifier.

maxLength32

bytesEgress: number

Number of bytes sent.

bytesIngress: number

Number of bytes received.

connections: number

Number of connections.

durationAvg: number

Average duration of connections.

#### AnalyticsEvents

##### ModelsExpand Collapse 

Dimension \= "event" | "appID" | "coloName" | "ipVersion"

One of the following:

"event"

"appID"

"coloName"

"ipVersion"

#### AnalyticsEventsBytimes

##### [Get analytics by time](https://developers.cloudflare.com/api/typescript/resources/spectrum/subresources/analytics/subresources/events/subresources/bytimes/methods/get)

client.spectrum.analytics.events.bytimes.get(BytimeGetParams { zone\_id, time\_delta, dimensions, 5 more } params, RequestOptionsoptions?): [BytimeGetResponse](https://developers.cloudflare.com/api/typescript/resources/spectrum#%28resource%29%20spectrum.analytics.events.bytimes%20%3E%20%28model%29%20bytime%5Fget%5Fresponse%20%3E%20%28schema%29) { data, data\_lag, max, 5 more } 

GET/zones/{zone\_id}/spectrum/analytics/events/bytime

##### ModelsExpand Collapse 

BytimeGetResponse { data, data\_lag, max, 5 more } 

data: Array<Data\>

List of columns returned by the analytics query.

dimensions?: Array<string\>

metrics?: Array<number\> | Array<Array<number\>\>

One of the following:

Array<number\>

Array<Array<number\>\>

data\_lag: number

Number of seconds between current time and last processed event, i.e. how many seconds of data could be missing.

minimum0

max: Record<string, number\>

Maximum result for each selected metrics across all data.

min: Record<string, number\>

Minimum result for each selected metrics across all data.

query: Query { dimensions, filters, limit, 4 more } 

dimensions?: Array<[Dimension](https://developers.cloudflare.com/api/typescript/resources/spectrum#%28resource%29%20spectrum.analytics.events%20%3E%20%28model%29%20dimension%20%3E%20%28schema%29)\>

Can be used to break down the data by given attributes. Options are:

| Dimension | Name                          | Example                                                    |
| --------- | ----------------------------- | ---------------------------------------------------------- |
| event     | Connection Event              | connect, progress, disconnect, originError, clientFiltered |
| appID     | Application ID                | 40d67c87c6cd4b889a4fd57805225e85                           |
| coloName  | Colo Name                     | SFO                                                        |
| ipVersion | IP version used by the client | 4, 6.                                                      |

One of the following:

"event"

"appID"

"coloName"

"ipVersion"

filters?: string

Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are:

| Operator | Name                     | URL Encoded |
| -------- | ------------------------ | ----------- |
| \==      | Equals                   | %3D%3D      |
| !=       | Does not equals          | !%3D        |
| \>       | Greater Than             | %3E         |
| <        | Less Than                | %3C         |
| \>=      | Greater than or equal to | %3E%3D      |
| <=       | Less than or equal to    | %3C%3D      |

Use the above to construct filters.

limit?: number

Limit number of returned metrics.

metrics?: Array<"count" | "bytesIngress" | "bytesEgress" | 4 more\>

One or more metrics to compute. Options are:

| Metric         | Name                                | Example | Unit                  |
| -------------- | ----------------------------------- | ------- | --------------------- |
| count          | Count of total events               | 1000    | Count                 |
| bytesIngress   | Sum of ingress bytes                | 1000    | Sum                   |
| bytesEgress    | Sum of egress bytes                 | 1000    | Sum                   |
| durationAvg    | Average connection duration         | 1.0     | Time in milliseconds  |
| durationMedian | Median connection duration          | 1.0     | Time in milliseconds  |
| duration90th   | 90th percentile connection duration | 1.0     | Time in milliseconds  |
| duration99th   | 99th percentile connection duration | 1.0     | Time in milliseconds. |

One of the following:

"count"

"bytesIngress"

"bytesEgress"

"durationAvg"

"durationMedian"

"duration90th"

"duration99th"

since?: string

Start of time interval to query, defaults to `until` \- 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified.

formatdate-time

sort?: Array<string\>

The sort order for the result set; sort fields must be included in `metrics` or `dimensions`.

until?: string

End of time interval to query, defaults to current time. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified.

formatdate-time

rows: number

Total number of rows in the result.

minimum0

totals: Record<string, number\>

Total result for each selected metrics across all data.

time\_intervals?: Array<Array<string\>\>

List of time interval buckets: \[start, end\].

#### AnalyticsEventsSummaries

##### [Get analytics summary](https://developers.cloudflare.com/api/typescript/resources/spectrum/subresources/analytics/subresources/events/subresources/summaries/methods/get)

client.spectrum.analytics.events.summaries.get(SummaryGetParams { zone\_id, dimensions, filters, 4 more } params, RequestOptionsoptions?): [SummaryGetResponse](https://developers.cloudflare.com/api/typescript/resources/spectrum#%28resource%29%20spectrum.analytics.events.summaries%20%3E%20%28model%29%20summary%5Fget%5Fresponse%20%3E%20%28schema%29) { data, data\_lag, max, 5 more } 

GET/zones/{zone\_id}/spectrum/analytics/events/summary

##### ModelsExpand Collapse 

SummaryGetResponse { data, data\_lag, max, 5 more } 

data: Array<Data\>

List of columns returned by the analytics query.

dimensions?: Array<string\>

metrics?: Array<number\> | Array<Array<number\>\>

One of the following:

Array<number\>

Array<Array<number\>\>

data\_lag: number

Number of seconds between current time and last processed event, i.e. how many seconds of data could be missing.

minimum0

max: Record<string, number\>

Maximum result for each selected metrics across all data.

min: Record<string, number\>

Minimum result for each selected metrics across all data.

query: Query { dimensions, filters, limit, 4 more } 

dimensions?: Array<[Dimension](https://developers.cloudflare.com/api/typescript/resources/spectrum#%28resource%29%20spectrum.analytics.events%20%3E%20%28model%29%20dimension%20%3E%20%28schema%29)\>

Can be used to break down the data by given attributes. Options are:

| Dimension | Name                          | Example                                                    |
| --------- | ----------------------------- | ---------------------------------------------------------- |
| event     | Connection Event              | connect, progress, disconnect, originError, clientFiltered |
| appID     | Application ID                | 40d67c87c6cd4b889a4fd57805225e85                           |
| coloName  | Colo Name                     | SFO                                                        |
| ipVersion | IP version used by the client | 4, 6.                                                      |

One of the following:

"event"

"appID"

"coloName"

"ipVersion"

filters?: string

Used to filter rows by one or more dimensions. Filters can be combined using OR and AND boolean logic. AND takes precedence over OR in all the expressions. The OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. The AND operator is defined using a semicolon (;) or AND keyword surrounded by whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison options are:

| Operator | Name                     | URL Encoded |
| -------- | ------------------------ | ----------- |
| \==      | Equals                   | %3D%3D      |
| !=       | Does not equals          | !%3D        |
| \>       | Greater Than             | %3E         |
| <        | Less Than                | %3C         |
| \>=      | Greater than or equal to | %3E%3D      |
| <=       | Less than or equal to    | %3C%3D      |

Use the above to construct filters.

limit?: number

Limit number of returned metrics.

metrics?: Array<"count" | "bytesIngress" | "bytesEgress" | 4 more\>

One or more metrics to compute. Options are:

| Metric         | Name                                | Example | Unit                  |
| -------------- | ----------------------------------- | ------- | --------------------- |
| count          | Count of total events               | 1000    | Count                 |
| bytesIngress   | Sum of ingress bytes                | 1000    | Sum                   |
| bytesEgress    | Sum of egress bytes                 | 1000    | Sum                   |
| durationAvg    | Average connection duration         | 1.0     | Time in milliseconds  |
| durationMedian | Median connection duration          | 1.0     | Time in milliseconds  |
| duration90th   | 90th percentile connection duration | 1.0     | Time in milliseconds  |
| duration99th   | 99th percentile connection duration | 1.0     | Time in milliseconds. |

One of the following:

"count"

"bytesIngress"

"bytesEgress"

"durationAvg"

"durationMedian"

"duration90th"

"duration99th"

since?: string

Start of time interval to query, defaults to `until` \- 6 hours. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified.

formatdate-time

sort?: Array<string\>

The sort order for the result set; sort fields must be included in `metrics` or `dimensions`.

until?: string

End of time interval to query, defaults to current time. Timestamp must be in RFC3339 format and uses UTC unless otherwise specified.

formatdate-time

rows: number

Total number of rows in the result.

minimum0

totals: Record<string, number\>

Total result for each selected metrics across all data.

time\_intervals?: Array<Array<string\>\>

List of time interval buckets: \[start, end\].