Lifecycle & Recording

SDK setup (on application start)

Smartlook SDK setup needs to be called only once during an application’s lifetime and it should be called on application startup. There is no need to stop recording explicitly on application closure, SDK will stop itself automatically.

The best place to setup the SDK is in didFinishLaunchingWithOptions method of the ApplicationDelegate on iOS and in onCreate() method of your Application class on Android:

using Smartlook;
...
Smartlook.Analytics.SetupAndStart("API_KEY");

The easiest way of setting up the SDK is with SetupAndStart() method:

static public void SetupAndStart(string key, SetupOptions options = new SetupOptions())

It will set the SDK up and also start the recording. SDK can be setup without starting the recording using the following:

static public void Setup(string key, SetupOptions options = new SetupOptions())

And then the recording can be started by calling:

public static void StartRecording()

Setup configuration

Some recording parameters can be configured on setup:

ParameterTypeDefault valueDescription
Framerateint2Recorded video frame rate (allowed values between 2 and 10). Note that by setting this value settings from the dashboard will be overridden!
UseAdaptiveFrameratebooltrueBy defaults, Smartlook adapts its recording framerate to the frequency of UI changes in order to lower its footprint in app performace. For details, see Screen Recording Quality.
RenderingModeRenderingModenativeDefine the way SDK is going to capture screen image data.
RenderingModeOptionRenderingModeOptionnoneFurther customize the rendering mode.
EventTrackingModesEventTrackingModeall eventsEvent tracking modes can be used to disable some automatically detected events.
StartNewSessionboolfalseAlways start new session with Smartlook setup.
StartNewSessionAndResetUserboolfalseAlways start new session and reset user with Smartlook setup.

All setup options are optional and can be set using properties of an instance of SetupOptions class.

public struct SetupOptions
{
  public int? Framerate;
  public RenderingMode? RenderingMode;
  public RenderingModeOption? RenderingModeOption;
  public EventTrackingMode? EventTrackingMode;
  public bool? StartNewSession;
  public bool? StartNewSessionAndResetUser;
}

Start and stop recording

Recording can be started or stopped at any time, the only requirement is that the SDK is set up.

public static void StartRecording()
public static void StopRecording()

🚧

StopRecording()

doesn't need to be called on application closure. Recording is stopped automatically.

Check if SDK is recording

Check if SDK is currently recording can be handy when using StartRecording() and StopRecording() methods. Simply call:

public static bool IsRecording

Reset session

Current session can be ended and a new session created by calling:

public static void ResetSession(bool resetUser = false)

If resetUser is set to true, SDK will create a new visitor during the reset. This is especially beneficial when a new user needs to be identified (typically after logout).

A new session can be created on SDK setup:

Analytics.SetupOptions smartlookSetupOptions = new Analytics.SetupOptions(startNewSession: true);
Smartlook.Analytics.Setup(API_KEY, smartlookSetupOptions);

A new visitor can also be created on SDK setup:

Analytics.SetupOptions smartlookSetupOptions = new Analytics.SetupOptions(startNewSessionAndResetUser: true);
Smartlook.Analytics.Setup("API_KEY", smartlookSetupOptions);