Scaffold only. The CLI writes a starter file with a placeholder; you
still need to add the script tag (or import it from your bundler entry
point) yourself.
Install with the CLI
npx @lucenthq/cli init luc_pk_...
Pick Vanilla JavaScript when prompted.
Manual setup
Install the SDK
npm install @lucenthq/sdk
Create an init file
lucent-init.js:import { LucentTracker } from "@lucenthq/sdk";
const tracker = new LucentTracker({
publicKey: "luc_pk_...",
});
tracker.start();
Import from your app entry
If you’re using a bundler (Vite, Webpack, esbuild, Parcel…), import the
file from your main entry point so it runs once when the page loads:import "./lucent-init.js";
Loading without a bundler
If you don’t use a bundler, load the SDK from a CDN with an ESM <script>:
<script type="module">
import { LucentTracker } from "https://esm.sh/@lucenthq/sdk";
const tracker = new LucentTracker({
publicKey: "luc_pk_...",
});
tracker.start();
</script>
The CDN form is convenient for quick tests but adds a round‑trip on first
page load. For production use, bundle @lucenthq/sdk into your app.
Notes
- Replace
"luc_pk_..." with a real key. Reading it from an env var is your
bundler’s job — e.g. process.env.LUCENT_PUBLIC_KEY with Webpack’s
DefinePlugin, or import.meta.env.VITE_LUCENT_PUBLIC_KEY with Vite.
- For TypeScript projects,
@lucenthq/sdk ships its own types — no
@types/* package needed.
- If you’re using React, Vue, Svelte, or one of the other supported
frameworks, use the dedicated framework page instead of this one.