The `smartlook-client` is the official JavaScript client library designed for integrating Smartlook's user session recording and analytics into web applications. Currently at stable version 10.0.0, this package is under active development with frequent major and minor releases, typically introducing new features or improvements every few months. Key differentiators include robust support for advanced network recording, enabling the capture of request/response bodies and headers, and a flexible interceptor system to precisely control and obscure sensitive data across various capture points like URLs, network calls, errors, focus events, and clicks. It provides granular control over data capture regions, cookie usage, and integrates seamlessly with Smartlook's Relay Proxy for self-hosted data routing. The client also supports modern web features such as 1st party iframes and shadow DOM, ensuring comprehensive recording coverage across complex web interfaces.
npm install smartlook-clientVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the Smartlook client with a project key, demonstrates configuration for region, cookie behavior, advanced network recording, and sets up interceptors to control and obscure data from clicks, network requests, and errors. It also includes examples of identifying visitors and tracking custom events.
Migrate your implementation to use the new Record API. Refer to the Smartlook documentation on 'Web/Consent Sensitive Data' for details.
Ensure your project is not relying on the legacy web SDK. If using a Relay proxy, refer to Smartlook documentation on 'Relay proxy' for configuration guidance.
Update your import statements from `const Smartlook = require('smartlook-client')` to `import Smartlook from 'smartlook-client'` in ESM-aware environments.Ensure your `relayProxyUrl` configuration includes the full and correct protocol (e.g., `'https://my-proxy-domain.com/'`).
Only set `cookies: false` if cross-domain visitor tracking is not required, or if you have alternative methods for visitor identification across domains. The default value is `true`.
Do not modify the `region` parameter unless you have confirmed the correct region for your project with Smartlook support.
Ensure `import Smartlook from 'smartlook-client'` is at the top of your module, or verify that the script loading order correctly places Smartlook initialization after the library is available. For CJS environments with ESM interop, `const Smartlook = require('smartlook-client').default;` might be necessary, though `import` is preferred for new code.Provide your project's Smartlook key: `Smartlook.init('YOUR_SMARTLOOK_PROJECT_KEY', { ...params })`.When loading your application in an iframe, initialize Smartlook with the `standalone: true` option to prevent connection attempts with the parent: `Smartlook.init(key, { standalone: true })`.No dependency data recorded yet.