# @luckyorange/server

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

Latest version **1.1.4** (published 2026-01-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install @luckyorange/server
pnpm add @luckyorange/server
yarn add @luckyorange/server
bun add @luckyorange/server
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2026-01-15 |
| First published | 2021-03-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | loengineer, cerihaf, jollendick, plee95, audryf, bhenke, cpetro |

## Links

- npm: https://www.npmjs.com/package/@luckyorange/server
- Homepage: https://developers.luckyorange.com
- Issues: https://help-preview.luckyorange.com
- npm.io page: https://npm.io/package/@luckyorange/server

## Dependencies (2)

- [ow](https://npm.io/package/ow.md) ^0.23.0
- [got](https://npm.io/package/got.md) ^11.8.2

## Recent versions

- 1.1.4 (latest) — 2026-01-15
- 1.1.3 — 2025-04-01
- 1.1.2 — 2022-05-02
- 1.1.1 — 2022-05-02
- 1.1.0 — 2021-07-13
- 1.0.0 — 2021-05-03
- 0.2.0 — 2021-03-19

## README

# luckyorange-server

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

## Installation

```shell
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.

```javascript
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.

```javascript
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.

```javascript
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.

```javascript
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' })
```

## Contributing
Interested in contributing to this project? Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to set up your local environment and submit changes.

---
_Source: https://npm.io/package/@luckyorange/server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
