Analytics API
Hi Everyone, since last week I try to get Analytics of my domain but I totally don't understand how the API and how GraphQL works... Can you help me please?
Thanks
ps: Sorry for my bad English.
9 Replies
Ok so I tried a lot of things. Here’s where I am:
My query:
The API response:
I think it's just a dumb problem, but I don't understand why it's doing this
oh very dumb, the limit argument is not in the filter
Now I have this:
Ok I found a solution
but
Did I make something wrong?
You want zone analytics of http requests via GraphQL?
Do you have Pro (Web Traffic Analytics) or higher? Otherwise the datasets you can get are limited. You can get account-aggregated stats if that's also fine
example for simple account-wide analytics:
grouped by hour
Replace Acct Id with your own
Use something like GraphiQL for schema introspection, helps a lot. The GraphQL Schema data is also online at https://cfdata.lol/graphql/
GraphQL - Cloudflare Datamining
Discover Cloudflare's full GraphQL Schema
Yes, particulary this data

No just the free plan
My Account ID is on the Overview page?
Because if I use it, the server responds this:
yes, under Account ID
I would double check you didn't put in Zone ID for Account ID /somehow messed it up
On free, you still have access to some of the datasets. Looks like free analytics just pull from
httpRequests1dGroups
, ex
(that's a zone data/set needs Zone ID, not an account id Here is my entire query with zoneTag and accountTag
Thanks
Just this data?
(Sorry about 'dumb' question but I don't find any information about this in the documentation or in the internet)
GraphQL has a schema you can explore to get information on all of the datasets/types
You can use a client like GraphiQL which has schema introspection to help you out (https://developers.cloudflare.com/analytics/graphql-api/getting-started/compose-graphql-query/), as well as using the Dev Tools Network Tab (look for requests for the file graphql) to find the datasets/use the queries the dashboard uses as a starting point. There's a nicely formatted community website here also showing the graphql schema: https://cfdata.lol/graphql/
GraphQL - Cloudflare Datamining
Discover Cloudflare's full GraphQL Schema
I used Dev Tools on the free analytics page to find the GraphQL Query it was making, found it was using the dataset
httpRequests1dGroups
, and then I used GraphiQL's schema introspection to discover all of the fields on it