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

@smartlook/nodejs-sdk

Package Overview
Dependencies
Maintainers
9
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smartlook/nodejs-sdk

Smartlook Node.js SDK

  • 1.1.0
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
9
Weekly downloads
 
Created
Source

Smartlook Node.js SDK

This small zero-dependency library can be used to send custom events to Smartlook from your backend Node.js services.

These events can be then views in the events tab and you can use them to create funnels.

If you need to use these events to filter the recordings, you have to send smartlook.vid and smartlook.sid provided by the frontend Smartlook library in the request to your backend service.

However it is not required and you can use the events to track something not related to the user sessions or someting that happens outside of user session. Set the event vid to whatever you want to be identified as a source of the event (eg. your internal user id or job id).

You could have for example a background sequence of jobs that should trigger a user activity in the end. You can track with Smartlook how successful this process is. Such case would be checking last user activity on your web, sending an email to remind them your service or let them know about some news and the last event would be user login.

Usage

$ npm install @smartlook/nodejs-sdk
const smartlook = require('@smartlook/nodejs-sdk')

// set the key directly or with SMARTLOOK_KEY env variable
smartlook.init({
	key: '<PROJECT KEY>',
})

smartlook.event({
	vid: '<SOURCE ID>',
	name: '<EVENT NAME>',
})

Check out a bit more comprehensive example.

API

smartlook.init

Initializes the SDK with your deploy key and starts batch uploading of the events every flushIntervalMillis.

ParameterEnvironment variableDefaultAllowed
keySMARTLOOK_KEYnullstring
flushIntervalMillisSMARTLOOK_FLUSH_INTERVAL_MILLIS10000integer
logLevelSMARTLOOK_LOG_LEVELerrormute/trace/debug/info/error

smartlook.stop

Uploads pending events and stops recording of new events.

smartlook.event

Creates a new custom event.

ParameterTypeDescription
vidstring(required) Event source entity identifier
namestring(required) Event name
valuestringEvent value
propsobjectEvent key/value properties
sidstringUser session id obtained from the frontend Smarltook library

Contributing

Pull requests for new features, bug fixes, and suggestions are welcome!

License

MIT

FAQs

Package last updated on 23 Jun 2021

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