Spectacle JS
Load
Initialize Spectacle tracking
The load()
method initializes Spectacle tracking and must be called before using other methods like page()
, track()
, identify()
, or group()
.
Method Signature
spectacle.load(workspaceId, options?)
Parameters
- workspaceId (required):
string
- Your Spectacle workspace ID - options (optional):
LoadOptions
object with:baseUrl?: string
- Default: "https://t.spectaclehq.com"cookieDomain?: string
- Explicitly define the domain to place the cookie on. Can be used when users land on subdomain A and later convert on subdomain B.autoTrackForms?: boolean
- Automatically track form submissions as Identify (in case an email was found in the form data) and as Event. Default: true
Key Features
- Sets up user identification cookies
- Initializes tracking analytics
- Enables automatic form tracking by default
- Handles cross-subdomain tracking via cookieDomain
Basic Usage
spectacle.load("workspace_123");
With Options
spectacle.load("workspace_123", {
cookieDomain: ".example.com",
autoTrackForms: false
});