Guide
How to add analytics to a website built with Lovable
You built the site by describing it in a chat, so add analytics the same way. Paste one prompt into your project's Lovable chat, publish, and Lomen starts counting your visitors. No code to edit yourself.
From sign-up to your first visitor
You never open the code. Lovable makes the change, the same way it built the site.
Sign up for Lomen
Create an account. Lomen is free during the beta, with no credit card.
Add your published address
In the dashboard, click "Add your site" and enter the address your Lovable site is published at: your own domain if you connected one, otherwise the one ending in lovable.app. Not the preview link from the editor.
Copy the prompt
Under the snippet, the dialog asks if an AI tool built your site. Click "Copy a prompt instead" and the prompt below is copied with your site id already in it.
Paste it into Lovable and publish
Paste the prompt into your project's chat and let Lovable make the change. Then click Publish in Lovable: the script only reaches your visitors once the published site has it.
Open your site and see yourself live
Open your published site in a new tab. The snippet dialog says your website is connected as soon as the first pageview arrives, and the Live tab shows you on the page you opened.
Paste this into your Lovable chat
In your Lomen dashboard the same prompt comes with your site id filled in.
Add Lomen Analytics to this website.Put this script tag in the <head> of every page, exactly as written:<script defer data-site-id="your-site-id" src="https://lomenanalytics.com/api/public/track.js"></script>- If the project has an index.html, add it inside the <head> there. If the head is built in code instead, for example in a root layout or root route, add it there so every page gets it.- Add it once, as a plain script tag. Don't load it from a React effect or a component, and don't change or remove any of its attributes.- Don't change anything else in the project.
Copying it from here instead? Replace your-site-id with the id from your snippet.
Common questions
See who visits what you built
One prompt, one publish. Free during the beta, no credit card.