Antlytics logoAntlytics
← Blog
4

Analytics for AI-Built Sites: A Practical Guide

You built your site with Cursor, Claude Code, or Bolt. Now you need to know if anyone's visiting. Here's how to add analytics without breaking your vibe-coded app.

Analytics for AI-Built Sites: A Practical Guide

AI coding tools like Cursor, Claude Code, Bolt, Lovable, and v0 have made it possible to ship a working web application in an afternoon. The tools handle auth, database schema, UI components, and deployment. One thing they consistently skip: analytics.

This guide is for developers who have shipped something with an AI coding tool and want to know if anyone is using it — without derailing the momentum.

The vibe coder's analytics problem

You just built an app with Cursor. It's live. Someone asks: "How many people are using it?"

You realise you have no idea.

This happens for predictable reasons:

The result: you launch with no visibility. You get a traffic spike from your announcement, and you miss all of it. The most interesting data you will ever have about your product — launch day — is invisible.

Why AI-built sites often ship without instrumentation

AI tools are excellent at generating UI, API routes, database schema, and deployment configuration. They are prompt-driven: if you do not ask for analytics, you do not get it.

The other factor is deployment speed. If it takes two hours to build a full app and deploy it, adding analytics feels like an interruption to the flow. You tell yourself you will add it later.

Later never comes.

Adding analytics in 60 seconds

The fastest path is a single script tag. Add this to the <head> of every page you want to track, replacing YOUR_TRACKING_ID with the ID from your Antlytics dashboard:

<!-- Get your tracking ID from: https://www.antlytics.com/dashboard -->
<script>
(function(){
  var t="YOUR_TRACKING_ID",
      u="https://www.antlytics.com/api/ingest/pageview",
      k="ant_sid";
  function sid(){
    try{var s=sessionStorage.getItem(k);if(s)return s;
    s=crypto.randomUUID();sessionStorage.setItem(k,s);return s;}
    catch(e){return crypto.randomUUID();}
  }
  function send(){
    fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},
    keepalive:true,body:JSON.stringify({tracking_id:t,
    pathname:location.pathname,referrer:document.referrer||undefined,
    session_id:sid()})}).catch(function(){});
  }
  send();
  window.addEventListener("popstate",send);
})();
</script>

For Next.js projects, the SDK install is even simpler: one import, one component in your layout.

What to track on a freshly shipped MVP

When you first ship, you do not need a tracking plan. You need four numbers:

  1. Are people coming? — Total visitors in the first 24 hours.
  2. What do they look at? — Top pages by pageview count.
  3. How did they find it? — Referrer breakdown (which sites, which posts, which links sent traffic).
  4. Did they do the thing? — Set up one conversion goal for your primary action (sign up, download, contact, subscribe).

That is your MVP analytics setup. You can add more later when you know what questions to ask.

Analytics as part of your AI coding workflow

Once you have analytics installed, you can close the loop between building and learning. Every time you ship a change, watch whether it moves the numbers.

A useful pattern: add analytics as the first step in any new project, before you write a single line of product code. If analytics is already running when you start building features, you will have data from day one.

If you are using Cursor or Claude Code, prompt your AI coding tool to add the tracking snippet when you set up the project structure. The install is simple enough that AI tools handle it correctly.

Example prompt: "Add Antlytics analytics to this Next.js project. Install the @antlytics/analytics package and add the <Analytics /> component to app/layout.tsx. The tracking ID is [your-uuid]."

Using your analytics from your AI coding tool

The Antlytics Model Context Protocol (MCP) server lets AI coding tools query your analytics directly. When the MCP server is connected, you can ask questions like:

Your AI coding tool answers using live data from your dashboard, without you leaving the editor. This turns analytics from a dashboard you visit occasionally into an always-available data source for your AI workflow.

See the AI coding tools documentation for setup instructions once the MCP integration is available.

Common mistakes when instrumenting AI-generated code

Forgetting the tracking ID — The script or SDK requires a real tracking ID UUID. Placeholder text like YOUR_TRACKING_ID will not cause an error, but it will silently send data to the wrong place (or nowhere).

Blocking your own development traffic — If you are testing with an ad blocker or privacy extension, the analytics request may be blocked. Disable extensions in your development browser, or check the network tab to confirm the ingest request fires.

Not setting up the first-party proxy — For production sites where accuracy matters, the first-party proxy routes analytics requests through your domain to bypass ad blockers. Optional, but worth five minutes of setup.

Installing on only one page — The snippet needs to be on every page you want to track. In a Next.js app, add it to app/layout.tsx so it runs on every route automatically.

FAQ

Do I need analytics on an MVP? Yes. Even basic analytics tells you if anyone is visiting and what they are doing. Without it, you are building blind.

Will analytics slow down my app? The Antlytics tracker is lightweight and loads asynchronously. In typical setups it has negligible impact on page speed and Core Web Vitals.

Can I add analytics by prompting Cursor or Claude Code? Yes. The install is simple enough that AI tools handle it well. Provide the package name (@antlytics/analytics) and your tracking ID UUID in the prompt.

What if I am using Bolt.new or Lovable? Both typically output HTML or React apps. Add the script tag to your index.html or layout component.

Can I track multiple AI-built projects under one account? Yes. Antlytics Starter supports unlimited sites. Add each project as a separate site in your dashboard.


Next steps: Quick start guide · Analytics for vibe-coded apps · MCP server docs