Ours Privacy Integration with Lovable
Step-by-step guide to integrate Ours Privacy, built for HIPAA-regulated workflows, with a Lovable-built app to track page views and custom events.
This guide covers adding Ours Privacy tracking to an app built with Lovable, an AI app builder that generates a React codebase you can edit directly.
Integration Options
Lovable projects are standard Vite + React single-page applications, so the same options apply as any React app:
The guide below covers pasting the Ours Privacy Web SDK snippet directly into your project.
For a no-code approach that doesn't require touching index.html, use the Ours Privacy Tag Manager instead.
Steps to Integrate Ours with Lovable
1. Add the Web SDK snippet
- Copy your install snippet from the Install Ours page.
- Open your Lovable project's code editor (or use Lovable's chat and ask it to make the edit for you) and open
index.htmlat the project root. - Paste the snippet inside the
<head>section, before the closing</head>tag.
<!-- index.html -->
<head>
<!-- Ours Pixel Code -->
<script>
// your install code is here
</script>
<!-- End Ours Pixel Code -->
</head>The Web SDK tracks page views automatically, both on initial load and on subsequent client-side route changes, so no additional routing code is required.
2. Publish and verify
- Publish your Lovable project.
- Visit the published site and open the browser console to check for script errors.
- In your Ours account, check Recent Events to confirm page views are coming through.
Track Custom Events
Call window.ours('track', ...) from any component's event handler:
function SignUpButton() {
const handleClick = () => {
if (typeof window !== 'undefined' && window.ours) {
window.ours('track', 'ButtonClicked', { button_name: 'sign_up' });
}
};
return <button onClick={handleClick}>Sign Up</button>;
}Next Steps
- Web SDK reference: full list of tracking methods and options.
- Tag Manager: manage tags visually instead of editing code.
- Cookie Consent installation: add the consent banner so it loads before other tracking scripts.
If you need further assistance, contact us at support@oursprivacy.com.
How is this guide?

