vercel / analytics

Privacy-friendly, real-time traffic insights
https://vercel.com/analytics
Mozilla Public License 2.0
422 stars 26 forks source link

Feature request: REST API #68

Open sanderpick opened 1 year ago

sanderpick commented 1 year ago

I know this just launched on Vercel, but I'm curious if there will be an API to query page views and events... ideally w/ SQL? Let me know if there's a better place to ask this too.

timolins commented 1 year ago

Yes, an API is on our roadmap. We will keep you updated. 🙌

mt-hagen commented 1 year ago

Hi @timolins - Will this also apply to the Speed Insights data? I would love to use this data for a cusotm reporting dashboard!

Svish commented 1 year ago

I was also looking for this, as it would be a great tool to use for example in generateStaticParams with Next.js.

Instead of pre-generating all or none of the dynamic pages, one could instead use this to for example generate the top N visited pages.

Would be awesome if @vercel/analytics exported some simple utility functions for this!

// Imagined usage in `./src/app/products/[id]/[slug]/page.tsx`

export async function generateStaticParams() {
  return getStaticParamsMatching('/products/[id]/[slug]', { limit: 50 })
}
masnwilliams commented 10 months ago

Pinging this again to see where this is on the roadmap. Would pay to be able to query analytics through this npm library with a queryAnalytics({ queryParams... }).

camcamcamcam commented 10 months ago

Really hoping this happens sometime in 2023 so I can use the analytics coming out of Vercel in a BI tool. Especially now that GA has become pretty useless with some recent law changes in Canada.