Vue, Svelte and SvelteKit analytics: cookieless setup guide
Add Shipabase to a Vue or Svelte app built with Vite, or to SvelteKit.
Vue or Svelte with Vite#
npm i @shipabase/jsCall init at the top of src/main.ts, before the app is mounted.
import { init } from "@shipabase/js"; init(import.meta.env.VITE_SHIPABASE_KEY, { appVersion: import.meta.env.VITE_APP_VERSION });SvelteKit#
Call init in onMount of the root layout, so it only runs in the browser.
<script> import { onMount } from "svelte"; import { init } from "@shipabase/js"; import { PUBLIC_SHIPABASE_KEY } from "$env/static/public"; onMount(() => init(PUBLIC_SHIPABASE_KEY));</script> <slot />Track events#
import { trackEvent } from "@shipabase/js"; trackEvent("project_created", { plan: "pro" });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.