Replit
Add nextanalytica to an app built with Replit Agent: a prompt in the chat or one line in the app's head, then ask your own agent about visits and sign-ups.
Updated
Replit Agent builds full-stack apps from a chat, in any framework, and publishes them on a replit.app address. To count your app's visits with nextanalytica, ask the Agent to add the tag to every page, then publish again.
How do you add nextanalytica to Replit?
Copy your tag line from Site in nextanalytica, then paste this into the builder's chat, with your line in place of the example:
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.
Replit has no setting for code in the <head>, and where the head lives depends on the stack the Agent chose. That's why the chat is the surest way.
Where does the line go if you edit the code?
Open the file tree and find the app's stack:
| If the app has | The line goes in |
|---|---|
index.html and vite.config (React with Vite) | index.html, inside <head> |
app/layout.tsx (Next.js) | The root layout, with next/script: see Next.js |
| Server-rendered HTML templates | The shared template's <head> |
For other frameworks, see Add the tag.
Can Replit Agent connect to nextanalytica?
Replit Agent adds remote MCP servers with 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 Replit's own analytics?
Replit's Project Analytics counts visits to published apps when you switch it on. 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.
Do you need a cookie banner?
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.