React analytics with Vite: cookieless setup in three steps
Add Shipabase to a React app built with Vite.
Install#
npm i @shipabase/jsVITE_SHIPABASE_KEY=SB-EU-xxxxxxxxxxCall init before rendering#
import { init } from "@shipabase/js"; init(import.meta.env.VITE_SHIPABASE_KEY, { appVersion: import.meta.env.VITE_APP_VERSION });Track events#
import { trackEvent } from "@shipabase/js"; trackEvent("timer_started", { minutes: 25 });Related guides
DocsCheck if analytics is workingSee your first event, and fix it when nothing shows up.DocsAutomatic page view tracking for SPAs and mobile screensPages are tracked automatically in the browser. Screens in mobile apps take one line.DocsHow to name analytics eventsShort, stable names make every chart readable.BlogHow to add analytics to a Lovable appTwo ways to track what users do in an app built with Lovable: one prompt, or three lines of code. Cookieless, no consent banner for the SDK.BlogLovable analytics: built-in, Google Analytics or events?Lovable’s built-in analytics shows visits and sources, not what users do. Compare it with Google Analytics and cookieless event tracking (video, 38 s).