Netlify Analytics can track visitors without a single line of JavaScript on your site, and it does so by leveraging your DNS.

Let’s watch it in action. Imagine you have a site my-awesome-site.com and you’ve enabled Netlify Analytics. When a user requests my-awesome-site.com, their browser first performs a DNS lookup to find the IP address associated with that domain. Netlify Analytics hooks into this process. Instead of directly returning the IP address of your Netlify-hosted site, the DNS lookup for my-awesome-site.com is configured to go through Netlify’s infrastructure. Netlify’s servers see the incoming DNS request, log the visit, and then return the correct IP address for your site. The user’s browser gets the IP, fetches the site, and the whole interaction is invisible to them.

This approach solves a few key problems. First, it eliminates the need for client-side JavaScript, which means your page load performance isn’t impacted by an analytics script. No more worrying about ad blockers or users disabling JavaScript. Second, it provides a more privacy-respecting way to track visitors, as it doesn’t rely on cookies or browser fingerprinting techniques. Third, it captures traffic at the edge, meaning it can count visits even before your site’s HTML has fully loaded.

Here’s how the internal flow looks:

  1. User Request: A user types my-awesome-site.com into their browser.
  2. DNS Query: The user’s computer queries its configured DNS resolver (e.g., Google DNS, Cloudflare DNS, or their ISP’s DNS) for the IP address of my-awesome-site.com.
  3. Netlify’s DNS Edge: Your domain’s DNS records are set up to delegate authority for my-awesome-site.com to Netlify. This means the DNS resolver forwards the query to Netlify’s DNS servers.
  4. Visit Logging: Netlify’s DNS servers receive the query. Before responding, they log the incoming request – this is a "visit." They record the timestamp, the requesting IP address (anonymized), the user agent string (also anonymized), and the requested hostname.
  5. IP Address Resolution: Netlify’s DNS servers then look up the actual IP address for your Netlify-hosted site (e.g., 75.2.60.5).
  6. Response to Resolver: Netlify’s DNS servers return the IP address 75.2.60.5 to the user’s DNS resolver.
  7. Response to Browser: The user’s DNS resolver forwards this IP address back to the user’s browser.
  8. Site Fetch: The user’s browser uses the IP address 75.2.60.5 to connect to Netlify’s edge network and retrieve the content of my-awesome-site.com.

The exact levers you control are primarily within your domain registrar or wherever your DNS is managed. When you enable Netlify Analytics, Netlify provides you with specific Name Server (NS) records. You’ll typically find these under a "Custom Domains" or "DNS" section in your Netlify site settings. These NS records look something like this:

  • dns1.p01.nsone.net.
  • dns2.p01.nsone.net.
  • dns3.p01.nsone.net.
  • dns4.p01.nsone.net.

You need to replace your existing NS records at your domain registrar with these Netlify-provided ones. This delegation means that all DNS queries for your domain (not just for your website, but also for www.my-awesome-site.com or any other subdomain) will be handled by Netlify’s DNS infrastructure. Netlify’s DNS service is itself a managed service, designed for high availability and low latency, making this an efficient way to route DNS queries.

A common misconception is that this method only tracks visits to the root domain. In reality, any subdomain that relies on Netlify’s DNS for resolution will have its traffic logged by Netlify Analytics. This includes www.my-awesome-site.com, blog.my-awesome-site.com, etc., provided their DNS records are managed by Netlify.

The data you see in the Netlify Analytics dashboard – unique visitors, page views, referrer sources, and popular pages – is all aggregated from these DNS-level logs. Because it happens at the DNS layer, it captures bots that might otherwise be filtered out by JavaScript-based analytics, and it also counts visitors who might block JavaScript.

One subtle point often missed is how Netlify handles anonymization. While the DNS logs capture the requesting IP address, Netlify employs a process to anonymize this data before it’s presented in the dashboard. Typically, this involves zeroing out the last octet of IPv4 addresses (e.g., 192.168.1.100 becomes 192.168.1.0) or the last 64 bits of IPv6 addresses. This ensures that individual user IPs are not stored long-term or used for precise geolocation, aligning with privacy best practices without sacrificing the ability to count unique visitors within a general geographic area.

The next step in understanding Netlify’s advanced features is exploring how to integrate custom event tracking without client-side code.

Want structured learning?

Take the full Netlify course →