The Lumen JavaScript SDK allows you to seamlessly identify and track user attributes and events on your client. Plus other perks.

Getting Started

  1. 1.
    Setup your Lumen account
  2. 2.
    To retrieve your API key, navigate to Settings.
  3. 3.
    Select the API Key tab to view and copy your key.


Install the SDK via yarn or npm
npm install lumen-js
// or yarn
yarn add lumen-js
The SDK can be used on the browser, node.js and React Native.


To use the SDK, you have to initialize the SDK with your public key. Any request that doesn't include a valid API key will return an error.
You can generate an API key from your Dashboard at any time.
import Lumen from 'lumen-js'
const lumenClient = Lumen({
publicKey: "<- your-api-key ->"


Identify a user

You must identify users with a unique identifier before you can track their events. A new customer record is created if the identifier doesn't exist. If the identifier exists, then the customer record is updated with the new data supplied.
lumenClient.identify("identifier", {
email: "email",
first_name: "john",
last_name: "doe",
attributes: { // optional
// other user attributes
"age": 20,
"hasCompletedVerification": false,
Ideally, identify should be called when a user creates a new account. To update an existing user’s records, simply call identify and add any property you want to add or change. If the property already exists, we overwrite them. If it is new, we add them to the user's record.
To ensure your data is in sync with our record, make sure you update your user's records when they change so as to prevent stale data.
You can manage your user records on the dashboard.

Track an event

After identifying users, you can now capture their actions like "Product Clicked" or "Product Viewed" with other custom properties.
lumenClient.track("identifier", "Clicked 'Add To Cart'");
// >> with custom properties
const customProperties = {
sku: "skksosownw",
category: "electronics",
lumenClient.track("identifier", "Clicked 'Add To Cart'", customProperties);