Trackthemetric + Lovable
Lovable is an AI website builder that creates websites through prompts. Since you don't write code directly, you'll ask Lovable's AI to add the Trackthemetric tracking script for you.
1Get your Trackthemetric details
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.
2Copy and customize this prompt into Lovable
Replace the placeholders with your Website ID and domain, then paste the prompt below into Lovable's chat:
Please add Trackthemetric analytics tracking to my website so it loads on every page of the site. If using raw HTML: Add this script tag to the <head> section of every page: <script defer id="TrackTheMetric" data-website-id="⚠️[[[REPLACE WITH YOUR WEBSITE ID]]]⚠️" data-domain="⚠️[[[REPLACE WITH YOUR DOMAIN]]]⚠️" src="https://app.trackthemetric.com/tracker.js" ></script> If using React, Next.js, or similar frameworks: - Next.js: Use the Script component from 'next/script' in the root layout (app/layout.tsx) - React (Vite/Create React App): Add the script to index.html or inject via useEffect - Other frameworks: Ensure the script loads in <head> on every route Please confirm which framework you're using and how you implemented the tracking, and confirm it will load on all current and future pages.
3Verify the installation
- Publish your website using Lovable's publish feature.
- Visit your live site.
- Open your Trackthemetric dashboard. You should see data within a few minutes.
4Troubleshooting
If analytics data isn't appearing, ask Lovable to double-check:
Can you please verify that the Trackthemetric tracking script is properly installed and will load on all pages? Please confirm: 1) What framework are you using for my website? 2) How did you implement the tracking? 3) Where exactly did you add the script? 4) Will it load on every page, including future pages I create? The script URL should be: https://app.trackthemetric.com/tracker.js With my website ID: ⚠️[[[REPLACE WITH YOUR WEBSITE ID]]]⚠️ and domain: ⚠️[[[REPLACE WITH YOUR DOMAIN]]]⚠️ set correctly.
Common issues
- The script is only placed on the homepage instead of being added across all pages.
- The script hasn't been implemented correctly for the chosen framework.
- The website has not been published yet.
- A framework-specific integration component is missing (e.g., Script in Next.js).
- The Website ID or domain is either missing or incorrect.