Docs/Frameworks
.md

Vue & Svelte

Add Shipabase to a Vue or Svelte app built with Vite, or to SvelteKit.

Vue or Svelte with Vite#

Terminal
npm i @shipabase/js

Call init at the top of src/main.ts, before the app is mounted.

src/main.ts
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.

src/routes/+layout.svelte
<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#

anywhere
import { trackEvent } from "@shipabase/js"; trackEvent("project_created", { plan: "pro" });