Skip to content

Install on Replit

View as Markdown

Add Reveata to an app built and deployed on Replit.

On this page

A Replit app can use any stack, so the snippet goes wherever your app renders the <head> of its pages: index.html for a Vite or plain HTML app, the root layout for Next.js, the base template for Flask or Django.

Copy the snippet from your Reveata dashboard (it contains your website’s tracking id):

html
<script
  defer
  data-website-id="ws_your_tracking_id"
  src="https://reveata.com/js/script.js"
></script>

Add it to your app

Either ask the Replit Agent, for example:

Add this script tag exactly as written to the <head> of every page this app serves. Find the one file that renders the head for all pages (index.html, the root layout or the base template) and add it there once. Don’t change anything else: (paste the snippet)

Or open that file in the editor and paste the snippet before </head> yourself. The framework guides say which file it is: React, Vue, Next.js, Flask, Django, PHP.

Then publish the app, or Republish it if it is already live: changes in the workspace don’t reach the published app until you do. In Reveata, add the website with the address visitors use: your custom domain, or the .replit.app address of your deployment. Visits to the development preview in the workspace are on another address, so they are not counted.

Page changes in a single-page app go through the browser’s History API, which the script follows.

Check it works

Open your deployed app in a private window, then check that the visit appears in your Reveata dashboard. If it doesn’t, follow Verify your installation.

Goals

Add data-reveata-goal="signup" to a button or link, or call window.reveata?.('goal', 'signup') in a click handler. You can ask the Agent to do either. See Custom goals.

Serve it from your own subdomain

Two options:

  • The managed proxy. With a custom domain, add one DNS record (for example stats.example.com) and paste the new snippet Reveata gives you. See Managed proxy.
  • Your app’s own server. Replit apps have a backend, so it can pass the script and events through two routes. Ask the Agent to follow the guide for your server: Express, Flask, FastAPI or Next.js. Store the proxy secret in Secrets as REVEATA_PROXY_SECRET. Replit puts your app behind its own proxy, so read the visitor’s address from the first entry of X-Forwarded-For.

Revenue

Replit’s Stripe integration takes payments into your own Stripe account (a sandbox while you build, your live account once you publish). The checkout code is in your app:

  1. Connect the same live Stripe account in Reveata under Settings → Payments (restricted key or Connect with Stripe).
  2. Paste the prompt from Revenue in apps built with AI into the Agent. It sends window.reveata.metadata() with the request that creates the checkout and adds the visitor id to the checkout metadata, so each payment is credited to its visit.

If your backend records payments itself, it can send them with the Payments API instead. Other providers: Connect a payment provider.

Common pitfalls

  • Not republished. The published app keeps the old code until you republish.
  • Testing in the workspace preview. It runs on another address; test the published .replit.app address or your domain.
  • The snippet in a component. If the Agent adds it inside a React component with useEffect, the tag can be added twice or lose its attributes. Keep it as a plain tag in index.html or the root layout.
  • Sandbox payments. Test payments from the Stripe sandbox are not imported from your live Stripe account.

Was this helpful?