-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
36 lines (30 loc) · 818 Bytes
/
example.js
File metadata and controls
36 lines (30 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// npm install lotus-node --save
// or
// yarn add lotus-node
import Lotus from 'lotus-node'
const lotus = new Lotus(
'', // project API key
{
host: 'https://www.uselotus.app/', // You can omit this line if using Lotus Cloud
}
)
// Capture an event
lotus.trackEvent({
idempotencyId: 'test_event_1',
eventName: 'test',
timeCreated: new Date(),
customerId: '123',
properties: { test: 'test', numericQuantity: 3.1415 },
})
// console.log("sleeping")
// sleep 5
// Capture an event
lotus.trackEvent({
idempotencyId: 'test_event_2',
eventName: 'test',
timeCreated: new Date(),
customerId: '123',
properties: { test: 'test', stringField: 'test' },
})
// On program exit, call shutdown to stop pending pollers and flush any remaining events
client.shutdown()