AI app builders
Add Loogika to Lovable
Lovable projects have no setting for custom head code. The Loogika tag therefore enters the HTML head of the app as a code change. Request that change from Lovable in the chat, or edit the file yourself in the Code tab. The live app picks up the tag after you publish the change.
Last updated .
What do you need before you start?
You need your Loogika script tag. Find it in the Loogika dashboard under Site Settings, on the Tracking Script tab. Your site ID, a 12-character string, takes the place of YOUR_SITE_ID:
<script src="https://app.loogika.com/api/script.js?siteId=YOUR_SITE_ID" defer></script>
How do you ask Lovable to add the Loogika tag?
Paste the prompt below into the chat, with your own tag in it. The chat prompt works on every plan, the Free plan included.
Add this script tag to the <head> of the app on every page. Do not remove any existing head tags.
<script src="https://app.loogika.com/api/script.js?siteId=YOUR_SITE_ID" defer></script>
Check the diff that Lovable shows you. A React component is the wrong place for the tag, which must sit in the document head.
How do you add the tag yourself in the Code tab?
The project toolbar has a Code tab, and you edit the file there. Editing needs a paid plan, because the editor is read-only on the Free plan. Which file holds the head depends on the creation date of the project.
Which file do you edit in a project created from 13 May 2026?
Projects created from 13 May 2026 use TanStack Start, and you edit src/routes/__root.tsx. The root route has a head() function, and the script goes into it. The <HeadContent /> component that is already in the file renders it into the head.
export const Route = createRootRoute({
head: () => ({
scripts: [
{ src: "https://app.loogika.com/api/script.js?siteId=YOUR_SITE_ID", defer: true },
],
}),
component: RootComponent,
});
Which file do you edit in an older React and Vite project?
In an older React and Vite project, the project root holds one index.html file. Paste the tag before the closing </head> tag:
<head>
<meta charset="UTF-8" />
<title>My app</title>
<script src="https://app.loogika.com/api/script.js?siteId=YOUR_SITE_ID" defer></script>
</head>
Save the file with Cmd+S or Ctrl+S.
How do you publish the change?
Click Publish at the top right, then pick Publish changes. Edits never reach the published app until you do, because Lovable does not send them there by itself. A dot on the Publish button tells you that the project has unpublished changes.
Loogika records route changes inside the app as pageviews automatically. The SPA Navigation setting in Site Settings controls that, and it is on for a new site.
How do you check that Loogika is installed?
Load the published app in a fresh browser tab and visit a few pages. The pageviews show up in the Loogika dashboard within a few seconds. If nothing arrives, open the page source and look for script.js?siteId=, then see the script troubleshooting page.
What if the Loogika tag disappears after a later prompt?
Lovable may rewrite the head while it regenerates the layout or moves the project to a newer template. Add the instruction "keep the Loogika script tag" to the Knowledge of the project, so later edits preserve it. Check the page source again after big changes.