Vue & Svelte
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" });