The init() method initializes Smartlook recorder.

Syntax

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

Parameters

key

  1. Project key.

options

  1. Optional object where you can specify region and version.

    • region - eu or us
    • version - nextgen or legacy

doneCallback

  1. Optional callback to determine when Smartlook is initialized.

Return value

void

Description

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

Examples

Simple initialization.

Smartlook.init('YOUR_PROJECT_KEY')

Initialization with region selection.

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

Initialization with version selection.

Smartlook.init('YOUR_PROJECT_KEY', { version: 'nextgen' })

Initialization with region and version selection.

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

Initialization with doneCallback.

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