Add analytics and revenue tracking to your Replit app
Replit Agent builds and publishes the whole app. It doesn't tell you which channel brings visitors or which visit paid.
Updated Dec 4, 2026.
The short answer.
Paste the prompt below into Replit Agent: it adds the Appsdash script tag inside the <head> of the HTML your app serves. Or open Files, find that HTML file and paste the tag yourself. Publish, open the published address once, and the visit counts. Then connect the Stripe account behind the app (the one the Replit Stripe connector went live with, or your own keys) with a restricted read-only key.
The tag for Replit.
Add your app to Appsdash first: its install step shows this tag with your own id in place of YOUR_SITE_ID.
<script defer src="https://appsdash.co/v/s.js" data-site="YOUR_SITE_ID"></script>Rather not touch the code? Paste this into the Replit chat, with YOUR_SITE_ID replaced by your id:
Add this analytics script tag to my app. Find the HTML that renders the <head> of every page (index.html in a React + Vite app, the root layout in Next.js) and put it there. Keep it a plain <script> tag with these exact attributes (no npm package, no tag manager, no component that adds it later) and change nothing else.
<script defer src="https://appsdash.co/v/s.js" data-site="YOUR_SITE_ID"></script>Where the tag goes
The tag belongs in the <head> of every page, and which file holds it depends on how Agent built your app: index.html in a React + Vite app, the root layout in a Next.js one. Agent knows which one your app has, so the prompt is the quickest route.
To do it by hand, select Files in the sidebar, search for <head>, and paste the tag just before </head>.
Revenue from Stripe on Replit
Replit takes payments through Stripe two ways. The Replit Stripe connector starts in a sandbox, and you go live by installing the Replit Integrated Payments app on your live Stripe account. Or you manage your own keys in Secrets. Either way the live account is yours.
Make a separate key there for Appsdash: Settings > Revenue in Appsdash has a link that opens Stripe with the right Read permissions already ticked. Paste the key back in Appsdash, not in Replit's Secrets: Appsdash reads Stripe from its own servers every 15 minutes and never writes to it.
For revenue per source, the Stripe checkout needs the visit id as its client_reference_id. Ask Agent to make that change, with the code lines on this page as the example.
Check that it works
Publish the app so the change reaches the live address (replit.app or your own domain), and open it once with any ad blocker off. The development URL you see while building is another address, so its visits don't count.
The Appsdash install step says Counting when the first visit lands. If nobody has visited yet, Check installation in the app's Settings in Appsdash opens your home page and sends a test visit.
How to set it up.
14 days of everything, no card. Then from $29 a month for up to 5 apps, up to $99 for 50, every feature on each.
- Add the app. Type its published address. Appsdash gives you the tag with your site id filled in.
- Ask Agent. Paste the prompt from this page, or add the tag yourself just before </head> in the HTML file your app serves.
- Publish and visit. Publish, then open the published address once. The install step turns to Counting.
- Connect Stripe. A restricted read-only key from your live Stripe account, pasted in Appsdash, not in Replit's Secrets.
Tie each sale to its visit.
Optional: revenue counts without it. With it, every sale shows the source, page and campaign of the visit that bought.
// browser: send the visit id with the request that makes the session
fetch("/api/checkout", { method: "POST", body: JSON.stringify({ priceId, visit: window.appsdash?.visit?.() ?? "" }) });
// server
const session = await stripe.checkout.sessions.create({
mode: "subscription", // or "payment"
line_items: [{ price: priceId, quantity: 1 }],
client_reference_id: visit || undefined,
success_url, cancel_url,
});Already use client_reference_id? Put it in metadata: { appsdash_visit: visit } instead. The key needs Checkout Sessions read.
What it doesn't do.
- Visits on the development URL don't count: only the address you added and its subdomains do.
- Some ad blockers stop analytics scripts, so a few visitors won't show.
- Without the visit id on the checkout session, a sale still counts, but is matched to a visit only if exactly one person was on the site in the 30 minutes before it.
Questions.
Which file will Agent edit?
The one that holds every page's head: index.html in a React + Vite app, the root layout in Next.js. Ask it to show you the change before it publishes.
Does the Replit Stripe connector clash with this key?
No. Replit allows one Stripe setup inside your app, and the Appsdash key lives in Appsdash, not in your app.
Will it slow the app down?
No. The script is under 2 KB and loads after the page, so the page never waits for it.
Read next.
- Add analytics and revenue tracking to your Lovable app
- Add analytics and revenue tracking to your v0 app
- Track revenue across all your apps
- Stripe revenue in Appsdash
- All guides
Sources, checked Dec 4, 2026
- Replit: Web apps
- Replit: Navigate your editor
- Replit: Stripe payments
- Replit: Accept payments with Stripe
- Replit: Publish your app
Spotted something wrong? Write to younes@appsdash.co and it gets fixed.
See which app and which channel pays.
14 days free · no card