/smartlook-react-native-bridge

React native bridge for Android and iOS SDK

Primary LanguageTypeScriptMIT LicenseMIT

README

For further info visit https://smartlook.github.io/docs/sdk/react-native/.

smartlook-react-native-wrapper

Modules

Smartlook

smartlook-react-native-wrapper / Smartlook

Namespace: Smartlook

The main Smartlook SDK wrapper.

Table of contents

Enumerations
Interfaces
1) Setup Functions
2) User Functions
3) Recording Functions
4) Timed events Functions
5) Events Functions
7) Sensitive views Functions
8) Dashboard urls Functions
9) Other Functions

1) Setup Functions

setup

setup(optionsOrAPIKey: SetupOptions | string): void

Setup/initialize Smartlook SDK. This method DOESN'T start the recording (@see Smartlook.startRecording())

Parameters
Name Type
optionsOrAPIKey SetupOptions | string

Returns: void

Defined in: Smartlook.ts:44


setupAndStartRecording

setupAndStartRecording(optionsOrAPIKey: SetupOptions | string): void

Setup and start Smartlook SDK recording.

Parameters
Name Type
optionsOrAPIKey SetupOptions | string

Returns: void

Defined in: Smartlook.ts:67


2) User Functions

setReferrer

setReferrer(referrer: string, source: string): void

Set a custom referrer.

summary When an application is installed from the Google Play Store, Smartlook SDK automatically tracks install referrer. A custom referrer can also be set by using this function.

Parameters
Name Type
referrer string
source string

Returns: void

Defined in: Smartlook.ts:349


setUserIdentifier

setUserIdentifier(userIdentifier: string, userProperties?: {}): void

Sets a user identifier with optional dictionary of user properties

Parameters
Name Type Default value
userIdentifier string -
userProperties object {}

Returns: void

Defined in: Smartlook.ts:88


3) Recording Functions

isRecording

isRecording(): Promise<boolean>

Returns current recording state

Returns: Promise<boolean>

A promise fulfilled by current recording state boolean

Defined in: Smartlook.ts:121


startRecording

startRecording(): void

Starts recording

Returns: void

Defined in: Smartlook.ts:100


stopRecording

stopRecording(): void

Stops recording

Returns: void

Defined in: Smartlook.ts:110


4) Timed events Functions

cancelTimedCustomEvent

cancelTimedCustomEvent(name: string, reason: string, eventProperties?: Dictionary<string>): void

Cancels a timed event.

summary In case a given action failed this function is called instead of stopTimedCustomEvent.

Parameters
Name Type Default value Description
name string - -
reason string - reason of failure
eventProperties Dictionary<string> {} properties are merged with the properties set in the startTimedCustomEvent

Returns: void

Defined in: Smartlook.ts:179


startTimedCustomEvent

startTimedCustomEvent(eventName: string, eventProperties?: Dictionary<string>): Promise<string>

Starts a timed event.

summary Timed events can be used for measuring duration of any time-sensitive or long-running actions in the application. This will not send out any events but will return a Promise which will resolve with unique eventId that needs to be stored, and it is then used to stop/cancel a custom timed event.

Parameters
Name Type Default value
eventName string -
eventProperties Dictionary<string> {}

Returns: Promise<string>

A promise fulfilled by unique eventId

Defined in: Smartlook.ts:143


stopTimedCustomEvent

stopTimedCustomEvent(eventId: string, eventProperties?: Dictionary<string>): void

Stops a timed event.

Parameters
Name Type Default value Description
eventId string - eventId obtained from startTimedCustomEvent
eventProperties Dictionary<string> {} properties are merged with the properties set in the startTimedCustomEvent

Returns: void

Defined in: Smartlook.ts:161


5) Events Functions

removeAllGlobalEventProperties

removeAllGlobalEventProperties(): void

Returns: void

Defined in: Smartlook.ts:282


removeGlobalEventProperty

removeGlobalEventProperty(key: string): void

Parameters
Name Type
key string

Returns: void

Defined in: Smartlook.ts:290


setEventTrackingMode

setEventTrackingMode(eventTrackingMode: EventTrackingMode): void

Set event tracking mode.

summary It can be beneficial to disable some automatically detected events due to security or usability reasons. This can be done using event tracking modes

Parameters
Name Type
eventTrackingMode EventTrackingMode

Returns: void

Defined in: Smartlook.ts:387


setEventTrackingModes

setEventTrackingModes(eventTrackingModes: EventTrackingMode[]): void

Set event tracking modes.

summary It can be beneficial to disable some automatically detected events due to security or usability reasons. This can be done using event tracking modes

Parameters
Name Type
eventTrackingModes EventTrackingMode[]

Returns: void

Defined in: Smartlook.ts:402


setGlobalEventProperties

setGlobalEventProperties(properties: {}, immutable?: boolean): void

Parameters
Name Type Default value
properties object -
immutable boolean false

Returns: void

Defined in: Smartlook.ts:300


setGlobalEventProperty

setGlobalEventProperty(key: string, value: string, immutable?: boolean): void

Parameters
Name Type Default value
key string -
value string -
immutable boolean false

Returns: void

Defined in: Smartlook.ts:308


trackCustomEvent

trackCustomEvent(name: string, properties?: {}): void

Tracks custom event.

Parameters
Name Type Default value
name string -
properties object {}

Returns: void

Defined in: Smartlook.ts:194


trackNavigationEvent

trackNavigationEvent(screenName: string, viewState: ViewState): void

Tracks navigation event.

Parameters
Name Type
screenName string
viewState ViewState

Returns: void

Defined in: Smartlook.ts:206


7) Sensitive views Functions

registerBlacklistedView

registerBlacklistedView(ref: ComponentOrHandle): void

Parameters
Name Type
ref ComponentOrHandle

Returns: void

Defined in: Smartlook.ts:216


registerWhitelistedView

registerWhitelistedView(ref: ComponentOrHandle): void

Parameters
Name Type
ref ComponentOrHandle

Returns: void

Defined in: Smartlook.ts:242


setViewIsSensitive

setViewIsSensitive(ref: ComponentOrHandle, isSensitive: boolean): void

Parameters
Name Type
ref ComponentOrHandle
isSensitive boolean

Returns: void

Defined in: Smartlook.ts:267


unregisterBlacklistedView

unregisterBlacklistedView(ref: ComponentOrHandle): void

Parameters
Name Type
ref ComponentOrHandle

Returns: void

Defined in: Smartlook.ts:229


unregisterWhitelistedView

unregisterWhitelistedView(ref: ComponentOrHandle): void

Parameters
Name Type
ref ComponentOrHandle

Returns: void

Defined in: Smartlook.ts:255


8) Dashboard urls Functions

enableCrashlytics

enableCrashlytics(enabled: boolean): void

Parameters
Name Type
enabled boolean

Returns: void

Defined in: Smartlook.ts:357


getDashboardSessionUrl

getDashboardSessionUrl(withCurrentTimestamp?: boolean): Promise<string>

Returns a URL leading to the Smartlook Dashboard for a currently recorded session.

Parameters
Name Type Default value Description
withCurrentTimestamp boolean false If withCurrentTimestamp is set to true link it will include information about the current recording timestamp. This will ensure that the player will start playing the session at the moment when getDashboardSessionUrl was called.

Returns: Promise<string>

A promise fulfilled by a Smartlook Dashboard URL

Defined in: Smartlook.ts:324


getDashboardVisitorUrl

getDashboardVisitorUrl(): Promise<string>

A URL leading to the Smartlook Dashboard for a currently recorded visitor.

Returns: Promise<string>

A promise fulfilled by a Smartlook Dashboard URL

Defined in: Smartlook.ts:335


registerIntegrationListener

registerIntegrationListener(dashboardSessionUrlCallback: (url: string) => void, dashboardVisitorUrlCallback: (url: string) => void): void

Parameters
Name Type
dashboardSessionUrlCallback (url: string) => void
dashboardVisitorUrlCallback (url: string) => void

Returns: void

Defined in: Smartlook.ts:416


unregisterIntegrationListener

unregisterIntegrationListener(): void

Returns: void

Defined in: Smartlook.ts:437


9) Other Functions

resetSession

resetSession(resetUser: boolean): void

Parameters
Name Type
resetUser boolean

Returns: void

Defined in: Smartlook.ts:365


setRenderingMode

setRenderingMode(renderingMode: RenderingMode): void

Parameters
Name Type
renderingMode RenderingMode

Returns: void

Defined in: Smartlook.ts:373

Table of contents

Namespaces

Variables

Functions

Variables

SmartlookSensitiveComponent

Const SmartlookSensitiveComponent: ForwardRefExoticComponent<SmartlookSensitiveComponentProps & RefAttributes<View>>

summary SmartlookSensitiveComponent can be used to wrap the component which should be marked as sensitive or vice versa not sensitive. Just be sure that you are not passing functional components as children! Eg. wrap it to React.forwardRef first.

example

<SmartlookSensitiveComponent isSensitive={true}>
	<Button title="Blacklisted button" />
</SmartlookSensitiveComponent>

Defined in: SmartlookSensitiveComponent.tsx:22

Functions

useSmartlookSensitiveRef

useSmartlookSensitiveRef<T>(isSensitive?: boolean): React.MutableRefObject<T | null>

summary custom hook designed to replace useRef. Use the isSensitive parameter to explicitly control the view sensitivity.

example

import { WebView } from 'react-native-webview';
import { useSmartlookSensitiveRef } from 'smartlook-react-native-wrapper';

function MyScreen({ isWebViewSensitive = false }) {
	const ref = useSmartlookSensitiveRef<WebView>(isWebViewSensitive);

	return <WebView ref={ref} source={{ html: "docs." }} />;
}
Type parameters
Name
T
Parameters
Name Type Default value
isSensitive boolean true

Returns: React.MutableRefObject<T | null>

Defined in: hooks/useSmartlookSensitiveRef.ts:21

Enums

Smartlook Eventtrackingmode

smartlook-react-native-wrapper / Smartlook / EventTrackingMode

Enumeration: EventTrackingMode

Smartlook.EventTrackingMode

Table of contents

Enumeration members

Enumeration members

FullTracking

FullTracking: = "FULL_TRACKING"

Default state. SDK tracks all automatically detected events along with all user defined events.

Defined in: Smartlook.ts:468


IgnoreNavigationInteraction

IgnoreNavigationInteraction: = "IGNORE_NAVIGATION_INTERACTION"

Disables automatically detected navigation events. User defined ones are still being sent.

Defined in: Smartlook.ts:476


IgnoreRageClicks

IgnoreRageClicks: = "IGNORE_RAGE_CLICKS"

Disables automatic detection and tracking of rage click events.

Defined in: Smartlook.ts:480


IgnoreUserInteraction

IgnoreUserInteraction: = "IGNORE_USER_INTERACTION"

Disables automatically detected selector (click on a View), focus, touch, gesture and keyboard events.

Defined in: Smartlook.ts:472


NoTracking

NoTracking: = "NO_TRACKING"

No automatically detected events are tracked. Only user defined events are still tracked.

Defined in: Smartlook.ts:484

Smartlook Renderingmode

smartlook-react-native-wrapper / Smartlook / RenderingMode

Enumeration: RenderingMode

Smartlook.RenderingMode

Table of contents

Enumeration members

Enumeration members

Native

Native: = "native"

Defined in: Smartlook.ts:459


NoRendering

NoRendering: = "no_rendering"

Defined in: Smartlook.ts:460


Wireframe

Wireframe: = "wireframe"

Defined in: Smartlook.ts:461

Smartlook Sensitivitytype

smartlook-react-native-wrapper / Smartlook / SensitivityType

Enumeration: SensitivityType

Smartlook.SensitivityType

Table of contents

Enumeration members

Enumeration members

Blacklisted

Blacklisted: = 0

Defined in: Smartlook.ts:488


Whitelisted

Whitelisted: = 1

Defined in: Smartlook.ts:489

Smartlook Viewstate

smartlook-react-native-wrapper / Smartlook / ViewState

Enumeration: ViewState

Smartlook.ViewState

Table of contents

Enumeration members

Enumeration members

Enter

Enter: = "enter"

Defined in: Smartlook.ts:454


Exit

Exit: = "exit"

Defined in: Smartlook.ts:455

Interfaces

Smartlook Setupoptions

smartlook-react-native-wrapper / Smartlook / SetupOptions

Interface: SetupOptions

Smartlook.SetupOptions

Table of contents

Properties

Properties

_reactNativeVersion

Optional _reactNativeVersion: string

Defined in: Smartlook.ts:449


_smartlookPluginVersion

Optional _smartlookPluginVersion: string

Defined in: Smartlook.ts:450


fps

Optional fps: number

Defined in: Smartlook.ts:446


smartlookAPIKey

smartlookAPIKey: string

Defined in: Smartlook.ts:445


startNewSession

Optional startNewSession: boolean

Defined in: Smartlook.ts:447


startNewSessionAndUser

Optional startNewSessionAndUser: boolean

Defined in: Smartlook.ts:448