Available SDK's
Node.js SDK
Getting Started
Deployment
- Self-hosting Dittofeed
- Self-Hosting Options
- Using Dittofeed Cloud
Integrations
- Data Sources
- Data Source Types
- Message Channels
- Message Channel Types
- SDK's
- Available SDK's
- Data Destinations
- Data Destination Types
Workspace Resources
- Resources
- Journeys
- Journey Nodes
- Segments
- Segment Nodes
- Templates
- Template Types
- Workspaces
- Subscription Groups
- User Properties
- User Property Types
- Broadcasts
User Guides
Available SDK's
Node.js SDK
Send events from your node app to Dittofeed’s API
Dittofeed’s Node SDK allows you to send events from your node app to Dittofeed’s API.
Installation
# Using Yarn
yarn add @dittofeed/sdk-node
# Using NPM
npm install --save @dittofeed/sdk-node
Usage
Dittofeed’s node sdk can be useful for sending Dittofeed events about your application and users.
import { DittofeedSdk } from '@dittofeed/sdk-node';
// Initialize the sdk with a writeKey, which is used to identify your
// workspace. This key can be found at
// https://app.dittofeed.com/dashboard/settings
await DittofeedSdk.init({
writeKey: "Basic abcdefg...",
});
// Lets you tie a user to their actions and record traits about them. It
// includes a unique User ID and any optional traits you know about the
// user, like their email, name, and more.
DittofeedSdk.identify({
userId: "123",
traits: {
email: "[email protected]",
firstName: "John"
},
});
// The track call is how you record any actions your users perform, along
// with any properties that describe the action.
DittofeedSdk.track({
userId: "123",
event: "Made Purchase",
properties: {
itemId: "abc",
},
});
// Lets you record whenever a user sees a screen, the mobile equivalent of
// page, in your mobile app, along with any properties about the screen.
DittofeedSdk.screen({
userId: "123",
name: "Recipe Screen",
properties: {
recipeType: "Soup",
},
});
// Ensures that asynchronously submitted events are flushed synchronously
// to Dittofeed's API.
await DittofeedSdk.flush();
On this page