I’m toying with an idea of moving my client’s news portal site to JAMstack (Ghost + 11ty + Netlify). There are a couple of things that I’d need to sort out before that endeavor, but my biggest problem is the requirement to have the “Most popular articles” widget.
I was hoping to get that information from Netlify Analytics, and only in build-time since the actual count is not important, but it seems that there is no API available for Netlify Analytics.
Have I missed something or I’ll have to pull my sleeves up and build something on my own with Firebase or FaunaDB?
That sounds like a great idea - at the moment, however, there isn’t an API endpoint you can query per se to pull the data and transform it in some way. We have an open feature request for this from a few folks, and I have added your voice to that issue, but i don’t have an ETA on when we might work on this at the moment.
There is some additional data and a workaround in this thread you should read, but it is a bit experimental. Nevertheless, it might work for your purposes.
Hi, @Brian_OC. We do have an open feature request for an Analytics API intended to be utilized by site owners.
If this feature becomes available, we will post an update here to let you know about it.
EDIT: I want to be clear @Brian_OC that each +1 like this is tracked and does get sent to our product managers to help them prioritize these feature requests. We do pay attention to each individual comment and each one is escalated to the appropriate product manager for the team in charge of that area.
There are undocumented APIs that do exist at the moment. You can use them, however, please proceed with caution as these APIs might change in the future without a warning.
But, you can go in the UI and open the developer tools to see the network requests being made to https://analytics.services.netlify.com/v1/<site-id>/.... This might not be the most ideal way to use the API, but might work for the time being depending on the use case.