@logspot/web
TypeScript icon, indicating that this package has built-in type declarations

5.1.1 • Public • Published

@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 key
  • cookiesDisabled - use this property to disable anonymous user tracking
  • enableAutoPageviews - 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 url
  • onLoad - 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: "john@doe.com has subscribed",
  userId: "john@doe.com",
  metadata: { additionalData: "123" },
});

Pageview

Logspot.pageview({
  userId: "john@doe.com",
  metadata: { additionalData: "123" },
});

Register

Logspot.register({
  email: "john@doe.com",
  authenticated: true,
  project: "SuperStartup",
});

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i @logspot/web

    Weekly Downloads

    11

    Version

    5.1.1

    License

    MIT

    Unpacked Size

    37.4 kB

    Total Files

    25

    Last publish

    Collaborators

    • logspot