Replit

Add DataSaaS analytics to a project built on Replit. Whether you're using Replit Agent or building manually, you can add tracking with a simple prompt or code edit.

Using Replit Agent

1

Get your website ID and domain

Log in to your DataSaaS dashboard and go to your website settings. Copy your Website ID (starts with ds_) and your domain.

2

Send the installation prompt

Open your Repl and send the following prompt to Replit Agent. Replace the placeholder values with your actual credentials:

Add DataSaaS analytics tracking to this project. Add the following script tag to the <head> of the main HTML file or root layout:

<script
  defer
  data-website-id="ds_YOUR_WEBSITE_ID"
  data-domain="yourdomain.com"
  src="https://datasaas.co/js/script.min.js"
></script>

Replace ds_YOUR_WEBSITE_ID with my actual website ID and yourdomain.com with my domain.

Framework-specific guidance:
- If this is a Node.js/Express project with EJS or Handlebars: add to the main layout template
- If this is a Flask/Django project: add to the base template
- If this is a Vite/React project: add to index.html inside <head>
- If this is a Next.js project: use the next/script Script component in the root layout
- If this is a static HTML project: add directly to the <head> of index.html

The script must load on every page. It handles SPA navigation automatically.
3

Deploy and verify

After Replit Agent applies the changes, deploy your project using Replit's Deploy button. Visit your live site and check your DataSaaS dashboard to confirm events are being received.

Manual Setup

If you prefer to add the script yourself instead of using Replit Agent, find the main HTML file or template in your project and add the tracking script to the <head> section:

Common file locations by framework

FrameworkFile
Static HTMLindex.html
React (Vite)index.html
Next.jsapp/layout.tsx
Express + EJSviews/layout.ejs
Flasktemplates/base.html
Djangotemplates/base.html
<!-- Add inside <head> -->
<script
  defer
  data-website-id="ds_YOUR_WEBSITE_ID"
  data-domain="yourdomain.com"
  src="https://datasaas.co/js/script.min.js"
></script>

Troubleshooting

If events aren't showing up, send this follow-up prompt to Replit Agent:

Can you verify the DataSaaS analytics setup?
1. What framework is this project using?
2. Where did you place the tracking script?
3. Will it load on all pages including future ones?
4. Show me the implementation.

Common issues

  • Domain mismatch — If you're testing on a .replit.dev domain, update data-domain to match. You can change it to your custom domain later after deployment.
  • Script in the wrong template— For server-rendered apps (Express, Flask, Django), the script must be in the base/layout template that all pages inherit from, not in a single page template.
  • Script URL modified — Verify the src URL is exactly https://datasaas.co/js/script.min.js.
Tip

Replit supports many frameworks and languages. The DataSaaS tracking script is framework-agnostic — as long as it's in the <head> of every page, it will work regardless of your stack.