Install Orwel in Lovable
-
Ask the Lovable chat
Lovable installs the package and writes the code for you. Paste this message into your project chat.
Lovable chatInstall the npm package orwel@latest. Import { orwel } from 'orwel' and call orwel.init({ apiKey: 'orwel_TU_KEY' }) exactly once, in the browser, when the app starts: in src/main.tsx before rendering if this is a React and Vite project, or in a client-only effect of the root route if it is a TanStack Start project. Never call it during server rendering. The key is public. Then, on submit of every contact form call orwel.identify({ email, name }) and await orwel.conversion('contact_form') before showing the success message. -
Add your production API key
The key already goes inside the message of step 1. It is public, not a secret. Signed out you see a placeholder. Sign in and your real key shows up here.
production API keyorwel_TU_KEY -
Check the init
Lovable should leave something like this where the app starts on the client: src/main.tsx in a React and Vite project, or the root route in a newer TanStack Start project. If not, ask it to fix it.
src/main.tsximport { orwel } from 'orwel' orwel.init({ apiKey: 'orwel_TU_KEY' }) -
Capture your leads
On submit of every form that captures a contact: identify the person and await the conversion before redirecting. If r.success is false, r.reason tells you why.
contact formimport { orwel } from 'orwel' async function onSubmit(data) { orwel.identify({ email: data.email, name: data.name }) const r = await orwel.conversion('contact_form') if (!r.success) console.warn('Orwel:', r.reason) } -
Verify it live
Use the dev key instead of the production one while you test. Those events are flagged as test and never count in your reports.
Open your site with the dev key and watch every event arrive in Dev mode Open Dev mode
No key yet?
Create your workspace and this guide fills in your keys.