The init() method initializes Smartlook recorder.


init(key, options)
init(key, options, doneCallback)



  1. Project key.


  1. Optional object with the initial configuration.

    1. region

      1. eu or us
    2. cookies

      • (default) true - enable storing of metadata in cookies and local storage.
      • false - disable storing of metadata in cookies, using only local storage.
    3. relayProxyUrl

      1. string
        • Used together with smartlook relay proxy and should be full url with protocol e.g.
    4. standalone

      1. Boolean

        • (default) false - makes Smartlook try to establish a connection with the parent window and join the session. The session will be reused only when the parent window loads Smartlook and records it as the same project. See more in the iframe recordings section. if the communication is not established within 10 seconds, the recording starts as a standalone anyway, but these first 10 seconds may be missing.
        • true - enable when your application is loaded in an iframe and you do not want Smartlook to try to connect with the parent window. Enabling this might be useful especially when you develop a third-party integration (e.g. payment gateway) that is inserted as an iframe on multiple websites.
    5. advancedNetwork

      1. Object with settings that control network data capture.
      2. For more information, see Advanced network recording
        1. allowedUrls
          1. allows recording of request/response bodies
          2. an Array of exact, string patterns or regular expressions
        2. allowedHeaders
          1. allows recording of non-standard headers
          2. an Array of exact, case-insensitive patterns
    6. interceptors

      1. Object with settings that allows control the data that Smartlook captures.
      2. For more information, see Interceptors
        1. url
          1. URL interceptor that can obscure sensitive data from URLs
          2. (data, context) => void
            • data—an object consisting of
              • urlstring URL can be changed
            • context—is not defined
        2. network
          1. Network interceptor that can obscure sensitive data from recorded network calls—bodies, headers, and URLs.
          2. Network events can be completely omitted by returning false from the interceptor.
          3. (data, context) => void | false
            • dataobject
              • urlstring
              • requestobject
                • headersRecord<string, Array<string>>
                • bodystring
              • responseobject
                • headersRecord<string, Array<string>>
                • bodystring
            • contextobject
              • pageUrlstring URL of the page where the request was initiated.


  1. Optional callback to determine when Smartlook is initialized.

Return value



Smartlook.init() lets you initialize Smartlook. There is one obligatory parameter key, which you can find in the project settings.


Simple initialization.


Initialization with region selection.

Smartlook.init('YOUR_PROJECT_KEY', { region: 'eu' })

Initialization with advanced network settings

Smartlook.init('YOUR_PROJECT_KEY', {
  region: 'eu',
  advancedNetwork: {
  	allowedUrls: [/.*/],
    allowedHeaders: ['x-custom-header'],

Initialization with interceptors

Smartlook.init('YOUR_PROJECT_KEY', {
  region: 'eu',
  interceptors: {
  	url: (data) => {
      const tokenIndex = data.url.indexOf('tokenId=');
      if (tokenIndex > -1) {
        data.url = data.url.slice(0, tokenIndex) + 'tokenId=[OBSCURED]';

Initialization with doneCallback.

    () => console.log('Smartlook is now initialized'),