Socket
Book a DemoInstallSign in
Socket

@luckyorange/server

Package Overview
Dependencies
Maintainers
8
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@luckyorange/server

Official library for sending data to Lucky Orange from a server environment.

latest
npmnpm
Version
1.1.2
Version published
Maintainers
8
Created
Source

luckyorange-server

Official library for sending data to Lucky Orange from a Node.js server environment.

Installation

npm i @luckyorange/server

Usage

The following are a few common usage examples to get started sending data to your site in Lucky Orange.

Connecting to your site

The only requirement to get started is passing your site's unique ID to the siteId parameter.

const LuckyOrange = require('@luckyorange/server')
const luckyorange = new LuckyOrange({ siteId: 'YOUR-SITE-ID' })

Tracking events

The track() method accepts three arguments. The first is the name of the event you wish to track. The second is any arbitrary metadata that you want to associate with the event. Finally, you can send a context object. This allows the event to be associated with a particular user that you have identified or a session created by the Lucky Orange browser tracking code.

luckyorange.events.track(
  'Account Created', 
  { acceptedTerms: true }, 
  { userId: 'test-user-id' }
)

Identifying users

In order to connect user accounts and their properties in your system with visitor profiles in Lucky Orange, use identify(). You must provide a unique ID that will then become an alias for a visitor created internally by Lucky Orange. If you also use identify() in the browser tracking code, the same user's behavior will be combined into one profile.

const LuckyOrange = require('@luckyorange/server')
const luckyorange = new LuckyOrange({ siteId: 'YOUR-SITE-ID' })

luckyorange.visitors.identify('test-user-id', { email: 'test@example.com' })

If you are also using Lucky Orange in the browser, you can pass an additional visitorId option to identify a visitor already created in the browser. If you skip this step, an entirely new visitor will be created unless the browser has already called identify(). You can get the browser's visitor ID by calling the LO.visitor.getVisitorId() on-page API.

const LuckyOrange = require('@luckyorange/server')
const luckyorange = new LuckyOrange({ siteId: 'YOUR-SITE-ID' })

luckyorange.visitors.identify('test-user-id', { email: 'test@example.com' }, { visitorId: 'visitor-id-from-browser' })

FAQs

Package last updated on 02 May 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.