🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@clipboard-health/analytics

Package Overview
Dependencies
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clipboard-health/analytics

Type-safe analytics wrapper around our third-party analytics provider for user identification and event tracking.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
3
Created
Source

@clipboard-health/analytics

Type-safe analytics wrapper around our third-party analytics provider for user identification and event tracking.

Table of contents

  • Install
  • Usage
  • Local development commands

Install

npm install @clipboard-health/analytics

Usage

Basic analytics tracking

import { Analytics } from "@clipboard-health/analytics";

const logger = {
  info: console.log,
  warn: console.warn,
  error: console.error,
};

{
  // Basic usage with both features enabled
  const analytics = new Analytics({
    apiKey: "your-segment-write-key",
    logger,
    enabled: { identify: true, track: true },
  });

  // Identify a user
  analytics.identify({
    userId: "user-123",
    traits: {
      email: "user@example.com",
      name: "John Doe",
      createdAt: new Date("2023-01-01"),
      type: "worker",
    },
  });

  // Track an event
  analytics.track({
    userId: "user-123",
    event: "Button Clicked",
    traits: {
      buttonName: "Apply",
      page: "home",
      plan: "worker",
    },
  });
}

{
  // Disabled analytics example
  const analytics = new Analytics({
    apiKey: "your-segment-write-key",
    logger,
    enabled: { identify: false, track: false },
  });

  // These calls will be logged but not sent to Segment
  analytics.identify({
    userId: "user-789",
    traits: { email: "test@example.com" },
  });

  analytics.track({
    userId: "user-789",
    event: "Page View",
    traits: { page: "home" },
  });
}

Local development commands

See package.json scripts for a list of commands.

FAQs

Package last updated on 24 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts