Trackthemetric + Replit
Replit supports many frameworks and includes an AI assistant to help modify your code. You can ask Replit Agent to integrate Trackthemetric analytics into your application.
1Locate your Trackthemetric credentials
Copy your Website ID and root domain from your Trackthemetric site settings.


Your script should look like this:
<script defer id="TrackTheMetric" data-website-id="YOUR_WEBSITE_ID" data-domain="YOUR_DOMAIN.COM" src="https://app.trackthemetric.com/tracker.js" ></script>
Replace the YOUR_WEBSITE_ID
and YOUR_DOMAIN.COM
with your actual values.
2Ask Replit Agent to add tracking
Open Replit Agent and use this customized prompt:
Help me integrate Trackthemetric analytics into my web project. I need this tracking script added to work across my entire application: <script defer data-website-id="⚠️[[[REPLACE WITH YOUR WEBSITE ID]]]⚠️" data-domain="⚠️[[[REPLACE WITH YOUR DOMAIN]]]⚠️" src="https://app.trackthemetric.com/tracker.js" ></script> Implementation based on my project type: - HTML/CSS/JS: Add to the <head> of index.html (and all pages) - React: Use proper Script handling; add to index.html or inject via useEffect - Next.js: Use next/script in app/layout.tsx (App Router) or _app.tsx/_document.tsx - Express/Node.js: Include in template engine layout or static HTML head - Python Flask/Django: Add to base template head section Requirements: - Script must load on every page/route - Preserve the defer attribute - Use the exact source URL: https://app.trackthemetric.com/tracker.js Please implement this and show me exactly what changes you made to which files.
3Test your implementation
- Run your project using Replit’s run button.
- Open the webview or your app’s public URL.
- Check your Trackthemetric dashboard.
4Troubleshooting with Replit Agent
Trackthemetric analytics isn't working as expected. Please help debug: 1) What type of project is this (React, HTML, Next.js, etc.)? 2) Which files did you modify to add analytics? 3) Is the script visible in the browser Network tab? 4) Will it track visitors on all pages/routes? Analytics must load from: https://app.trackthemetric.com/tracker.js With my website ID: ⚠️[[[REPLACE WITH YOUR WEBSITE ID]]]⚠️
Common issues
- Script only added to one page instead of globally.
- Wrong file modified for the project framework.
- Analytics not visible in Replit’s preview yet.
- Project not publicly accessible for testing.