Node.js SDK

Enabling Ninetailed Experiences within Node.js.

The Node.js SDK enables you to interact easily format and send events to Experience API endpoints in Node.js run times.

The Node.js SDK contains the methods sendTrackEvent and sendIdentifyEvent. These SDK methods automatically generate the event payloads necessary for the Experience API events endpoint as track and identify events, respectively.

import { NinetailedAPIClient } from "@ninetailed/experience.js-node";

const apiClient = new NinetailedAPIClient({
  clientId: "YOUR_API_KEY"
  environment: "YOUR_NINETAILED_ENV"
})

apiClient.sendTrackEvent(
    id: string,
    event: name, 
    properties?: JsonObject, // A JSON object of arbitrary key:value pairs
    options?: {
        anonymousId?: string,
        timestamp?: number,
        timeout?: number | undefined // Default: 5000
    }
)

apiClient.sendIdentifyEvent(
    id: string,
    traits: Traits, // A JSON object of arbitrary key:value pairs
    options?: {
        anonymousId?: string,
        timestamp?: number,
        timeout?: number | undefined // Default: 5000
    }
)

apiClient.getProfile(
    id: string,
    options?: {
        timeout?: number | undefined // Default: 5000
    }
)

Last updated