Lesson 3
How to track events from Node
Send events, identity, consent and commerce from your Node server, and read recommendations on the request path.
Video comingThe video is being filmed. The steps below are the whole lesson.
In this lesson
- 1Get an API key in prefix.secret form from Settings, API keys, and keep it out of source control.
- 2Node: npm install intempt-nodejs-sdk, then Intempt.init({ org, project, apiKey, sourceId }) once per process, with sourceId as a string.
- 3Node: await intempt.identify({ userId, traits }) and await intempt.track('event', { userId, properties }); call await intempt.close() at shutdown.
Setup checklist
The 18 steps to ship the SDK, from your first line of code to an identified event in Live. Tick them off as you go; your ticks stay in this browser.
Open the setup checklist (PDF)0 of 18 ticked
You are done when
- Your custom event appears on Events, Live in the console.
- The event is attached to the identified user's profile, not an anonymous one.
- Browser only: tested on a real domain, since tracking is blocked on localhost.
- Server SDKs: flush or close ran so buffered events were sent before the process exited.
Your tech stack and tools
The core stack (everything you actually need)
- IntemptJS (CDN script tag) (This is the browser SDK. One script tag, nothing to install)
- intempt-nodejs-sdk (This is the SDK for Node servers)
- intempt (PyPI) (This is the SDK for Python)
- intempt/intempt-php (This is the SDK for PHP)
- Intempt (CocoaPods) (This is the SDK for iPhone and iPad apps)
- com.intempt.sdk:intempt-android (This is the SDK for Android apps)
- @intempt-technologies/react-native (This is the SDK for React Native apps)
Highly recommended optional upgrades that level up your work
- Track Data API (This is how you send events with no SDK at all)
- Autocapture and automatic events (This is what every SDK tracks for you, before you write any code)
- Java SDK (This is the SDK for Java, if that is your stack)
Every SDK is free. Your first 100K events a month are included on every plan.