H tspot Docs
Hotspot › Docs › SDK & Privacy API › SDK API Reference

JavaScript SDK API Reference

Complete documentation for window.hotspot methods, options, event attributes, and lifecycle hooks.

The window.hotspot object is automatically initialized when hotspot.js loads. All methods are safe to call synchronously.

hotspot.identify(distinctId, traits, options)

Associates the current visitor and session with a user profile.

hotspot.identify(distinctId: string, traits?: object, options?: { hash?: boolean })
  • distinctId: User identifier (database ID, UUID, or email).
  • traits: Key-value metadata (plan, role, company, cycle).
  • options.hash: When set to true, salts and hashes the ID with HMAC-SHA256.

hotspot.trackPurchase(details)

Records a conversion or subscription event. Automatically purges card numbers and CVVs.

hotspot.trackPurchase({
  plan: "pro",        // "free", "pro", "enterprise"
  value: 49,          // numeric price
  cycle: "monthly",   // "monthly" | "annual"
  order_id: "ord_101" // optional transaction ID
});

hotspot.trackPaymentFailure(details)

Logs payment declines to alert the VIP Radar and drop-off diagnostics.

hotspot.trackPaymentFailure({
  error_code: "card_declined",
  step: "checkout_submit"
});

hotspot.trackHesitation(details)

Records friction or pricing dwell time before a user navigates away.

hotspot.trackHesitation({
  plan: "enterprise",
  dwell_seconds: 24
});

hotspot.reset()

Clears user identity, rotates the session ID, and resets visitor tracking on logout.

hotspot.reset();