Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smartlook-client

Package Overview
Dependencies
Maintainers
12
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smartlook-client

Official Smartlook client for easy frontend integration.

  • 6.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
33K
increased by1.72%
Maintainers
12
Weekly downloads
 
Created
Source

Smartlook-client

Imports and initializes Smartlook recorder into a page.

  1. Installation

    npm install smartlook-client --save
    

    or

    yarn add smartlook-client
    
  2. Import

    import smartlookClient from 'smartlook-client'
    

    or

    var smartlookClient = require('smartlook-client')
    
  3. API

    init(string key)
    init(string key, params?: { region?: 'eu' | 'us', version?: 'legacy' | 'nextgen' })
    
    track(string eventName, object<key:value> props)
    
    identify(integer | string userId, object<key:value> props)
    
    anonymize()
    
    disable()
    
    consentForms(string | false consent)
    
    consentIP(string | false consent)
    
    consentAPI(string | false consent)
    
    getData(function callback)
    
    restart()
    
    pause()
    
    resume()
    
    error(string | Error error)
    
    navigation(string locationOrPath)
    
    properties(object<key:value> properties)
    
    initialized()
    
    playUrl
    
    sessionId
    
    visitorId
    
    recordId
    
    key
    
    version
    
  4. Example usage in React

    Usage in other libraries is similar.

    import React, { Component } from 'react'
    import smartlookClient from 'smartlook-client'
    
    class App extends Component {
    	handleIdentify = () => {
    		smartlookClient.identify(12345, {
    			name: 'John Doe',
    			email: 'email@domain.com',
    			// other custom properties
    		})
    	}
    	handleTrack = () => {
    		smartlookClient.track('transaction', {
    			value: 150,
    			currency: 'usd',
    			product: 'Product Description',
    			// other custom properties
    		})
    	}
    	handlePause = () => {
    		smartlookClient.pause()
    	}
    	render() {
    		return (
    			<div>
    				<button onClick={this.handleIdentify}>Identify visitor</button>
    				<button onClick={this.handleTrack}>Track event</button>
    				<button onClick={this.handlePause}>Pause recording</button>
    			</div>
    		)
    	}
    	componentDidMount() {
    		smartlookClient.init('43bc84d9a8406exxxxxxxxxb5601f5bbf8d2ed')
    	}
    }
    
    export default App
    

For more info visit https://www.smartlook.com/docs/api.html

Keywords

FAQs

Package last updated on 10 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc