@getcandle/web-sdk
v0.0.21
Published
This is the web SDK for [Candle](https://getcandle.app). It allows you to record user sessions on your website and analyze them in your Candle dashboard.
Readme
Candle Web SDK
This is the web SDK for Candle. It allows you to record user sessions on your website and analyze them in your Candle dashboard.
Installation
npm install @getcandle/web-sdkUsage
import { init, setUser } from "@getcandle/web-sdk";
// Initialize the SDK and begin recording.
init({
token: process.env.NEXT_PUBLIC_CANDLE_API_KEY,
// The user config is optional, and can be set later using the setUser function.
user: {
id: "123",
name: "John Doe",
email: "[email protected]",
},
// The release key allows you to specify the version of your application that the session belongs to.
release: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,
});
// Set the user for the session. This can only be called after the SDK has been initialized.
setUser({
id: "123",
name: "John Doe",
email: "[email protected]",
});Contributing
- Clone the repo
- Build changes with
yarn build-dev. - To test your changes in a local version of another website, you can run
yarn linkin the root of this repo, thenyarn link @getcandle/web-sdkin the repo of the local codebase you want to test it in. Follow the Usage instructions above to install your changed version of this SDK on the site. - To publish changes, increment the version of the package in package.json, run
yarn build-prod, and then runyarn publish.
