Skip to main content

Installation

Requirements

  • Node.js 18+ (recommended) or any runtime with global fetch
  • TypeScript 5+ (optional, for type safety)

Quick Start

Non-Deferred Lead Tracking

Use non-deferred lead tracking when you can send the clickId at the moment you want to record a lead event.

Lead Payload Fields

  • clickId: string - The unique click identifier
  • eventName: string - Name of the lead event (e.g., “signup_started”, “email_verified”)
  • customerExternalId: string - Your internal customer identifier
  • timestamp?: string - ISO 8601 timestamp (defaults to current time)
  • customerName?: string - Full name of the customer
  • customerEmail?: string - Customer’s email address

Deferred Lead Tracking

Use deferred mode when you can’t reliably send the clickId at the moment of recording a lead event. This enables two-step lead attribution.

Step 1: Store the clickId Association

Step 2: Track Using Only customerExternalId

Key Differences:
  • In deferred mode’s first call, you associate a clickId with a customerExternalId
  • In subsequent calls, you only need the customerExternalId the SDK will use the stored association
  • This is useful for complex user journeys where the click context may be lost

Sale Tracking

Track sales/conversions with detailed transaction information.

Sale Payload Fields

  • eventName: string - Name of the sale event (e.g., “purchase_completed”)
  • customerExternalId: string - Your internal customer identifier
  • invoiceId: string - Invoice or transaction identifier
  • amount: number - Amount in cents (e.g., 4999 = $49.99)
  • currency: string - 3-letter currency code (e.g., “USD”, “EUR”, “GBP”)
  • timestamp?: string - ISO 8601 timestamp (defaults to current time)
  • customerName?: string - Customer’s name
  • customerEmail?: string - Customer’s email

Error Handling

Documentation

For complete documentation, visit TypeScript SDK Docs