@logspot/web
v5.1.1
Published
Logspot Web SDK
Downloads
81
Readme
@logspot/web
Logspot SDK for browser applications built with React, Next.js, Angular, etc.
Installation
npm install @logspot/web
or
yarn add @logspot/web
Usage
Init
import Logspot from "@logspot/web";
Logspot.init({ publicKey: "YOUR_PUBLIC_KEY", cookiesDisabled: true });
publicKey
- project public keycookiesDisabled
- use this property to disable anonymous user trackingenableAutoPageviews
- enable auto tracking of pageviews (default: true)stickyCampaigns
- enable storing UTM parameters in cookies (default: true)stickyCampaignsExpirationInSeconds
- timeout for sticky campaigns (default: 7 days)enableAutoClicks
- enable auto capture of user clicks (default: false)externalApiUrl
- provide here API proxy urlonLoad
- use this function to perform actions when Logspot is loaded. E.g. register super properties before initial pageview
Track
Logspot.track({
event: "UserSubscribed",
channel: "Sign ups",
notify: true,
message: "[email protected] has subscribed",
userId: "[email protected]",
metadata: { additionalData: "123" },
});
Pageview
Logspot.pageview({
userId: "[email protected]",
metadata: { additionalData: "123" },
});
Register
Logspot.register({
email: "[email protected]",
authenticated: true,
project: "SuperStartup",
});