Sign inGet started
Tracking

Bolt

View as MarkdownOpen in ChatGPTOpen in Claude
Connect your agent
Add to CursorAdd to VS Code

Add nextanalytica to an app built with Bolt: a prompt in Bolt's chat or one line in index.html, then ask your own agent about visits and sign-ups.

Updated

Bolt builds JavaScript apps from a chat and hosts them on a bolt.host address. To count your app's visits with nextanalytica, add the tag once, in index.html or through Bolt's chat, then publish.

How do you add nextanalytica to Bolt?

Copy your tag line from Site in nextanalytica, then paste this into the builder's chat, with your line in place of the example:

Prompt
Add this script tag inside <head> on every page, in the root layout, exactly as written. Don't change it and don't add anything else:
<script async src="https://t.nextanalytica.app/t.js" data-project="na_…"></script>

na_… is your project's key. Never let the builder write the line from memory: a made-up key counts nothing. Then publish the app, since the tag only counts the published version.

Bolt has no project setting for code in the <head>. Its own docs on adding analytics say the same: paste the provider's code in Code view, or ask in chat.

Where does the line go if you edit the code?

Open Code view. Most Bolt apps are React with Vite, and a single-page app loads from index.html. Put the line inside <head>:

index.html
<head>
  <!-- the rest of your head -->
  <script async src="https://t.nextanalytica.app/t.js" data-project="na_…"></script>
</head>

Editing in Code view uses no tokens. If Bolt built your app with another framework, such as Next.js or Astro, use its page: see Add the tag.

Can Bolt's chat connect to nextanalytica?

Bolt adds custom MCP servers with a URL and OAuth.

The builder's chat can also connect to nextanalytica as a custom MCP server, with the address https://mcp.nextanalytica.app/mcp and OAuth. Its agent can then take your tag line from get_tag and check the setup with check_setup, instead of you copying the line. Builders use MCP servers only while building: the published app never calls them.

What about Bolt's own analytics?

Bolt counts visitors, pages and sources for apps on Bolt Hosting, on paid plans, and its numbers include bots. Keep it if you like. Add nextanalytica when you want conversions, AI assistants as their own channel and your own agent reading the numbers. See Why not the builder's own analytics?

How do you check it works?

Publish the app and open it once in your browser. Within about a minute, Site shows the domain as live. If your agent is connected, ask it "Check my nextanalytica setup": check_setup lists the hosts that sent something and what to do next.

How do you count sign-ups and other actions?

The tag counts visits and pages on its own. Actions only your app knows about, such as a sign-up, need one line where they happen. Ask the builder's chat to add it after the sign-up succeeds:

window.nextanalytica?.track("signup_completed", { plan: "team" });

Then tell your agent which events count as conversions, and it reads conversion rates by channel and page. See Custom events.

Not for the tag. It counts without cookies until a visitor agrees, so people who never answer a banner are still counted. If your app has a banner, pass the answer with window.nextanalytica?.consent(true) or consent(false). See Cookieless counting and consent.

What can you ask your agent?

Connect your own agent (Claude, Cursor, Codex) to nextanalytica once, and ask in plain words:

  • "How many people visited the app this week, and from where?"
  • "Which channel brings sign-ups?"
  • "I deployed a new version. Did I break anything?"

See Your agent to connect it.

Next steps

Related
  • What the tag collects: Page views, clicks, forms, scroll, errors and page speed, counted without code. What never leaves the page.
  • Add the tag: Put one script line in the head of every page. Where it goes in plain HTML, site builders and each framework.
  • Next.js analytics: Add analytics to Next.js with @nextanalytica/tag: install, events, consent and AI crawlers, counted without cookies until a yes and read by your agent.
  • Next.js custom events: Send custom events from a Next.js app with @nextanalytica/tag: sign-ups, demo requests and conversions your agent reads by channel.
  • Next.js cookie consent: Wire a cookie banner in Next.js to analytics: count without cookies until the answer, and pass the saved answer on every page.
  • Next.js revenue tracking: Record orders in a Next.js app, from the browser or from your server, so revenue ties to the visit, channel and campaign it came from.
Still have questions?
Was this page useful?