In a NextJS app using App Router, does Vercel Analytics run client side or server side? And other analytics related questions

I’ve got a blog at michaelcharl.es which recently had an article trend on Reddit and Hacker News, which is cool.

However, something strange is happening with the analytics.

I’m serving both an English and a Japanese version of the article. The vast majority of the traffic is coming from English websites to the English language article.

However, the “Countries” section is showing 100% of my traffic coming from Japan, with <0.5% of my traffic coming from the United States.

The only thing I can think of, is that I’m currently proxying traffic via a Linode instance that is located in Japan, which has got me wondering if perhaps Vercel’s analytics are running server side rather than client side, and are getting confused by the proxy?

Are the analytics run server side? Is it possible to set them up to run client side?

I’m in the process of setting up Cloudflare to use its caching functionality. Would Cloudflare interfere with Vercel analytics, especially if they’re run Server Side?

And I guess while I have you here, one last question: I’m currently on the Pro Trial. I noticed that even on the Pro tier, only 25,000 “events” are provided, with an event meaning something like a page view. I’m up to 39,500 page views at the moment. Does that mean that if I were pay for the Pro tier I’d need to pay an additional $14 for the analytics, since my page views are over 39,500?

Thanks in advance.

Domain proxying traffic to the deployment URL: michaelcharl.es
Deployment URL or Custom Domain: michael-charles-aubrey.vercel.app
Environment (local, preview, production): production
Project Framework: NextJS
Build Settings:
  Framework Preset: Next.JS
Node/Runtime Version:18.x
Package Manager: npm

So I just change the setup so that my DNS records point directly at Vercel instead of proxying through my Linode instance, and I immediately started getting proper country information, so it definitely seems like that was the cause of the weird country analytics, and is strong evidence for the analytics being run on the server side.

I think I’m going to self-host my own Plausible server, because I’m quickly running up against the Vercel limits. It seems like my assumptions regarding paying an extra $14 were true.

I’d still like to know answers to a few of the things I asked, namely:

  1. Is there a way to make Vercel analytics run only on the client side?
  2. Does setting up Cloudflare interfere with Vercel analytics?

Hey @mcaubrey. A proxy can definitely interfere with analytics because it alters the apparent origin of the web traffic. There are some suggestions for how to fix it on the Web Analytics troubleshooting page:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.