package
https://www.npmjs.com/package/@segment/analytics-node
npm install @segment/analytics-nodeGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
https://www.npmjs.com/package/@segment/analytics-node
# npm
npm install @segment/analytics-node
# yarn
yarn add @segment/analytics-node
# pnpm
pnpm install @segment/analytics-nodeAssuming some express-like web framework.
import { Analytics } from '@segment/analytics-node'
// or, if you use require:
const { Analytics } = require('@segment/analytics-node')
// instantiation
const analytics = new Analytics({ writeKey: '<MY_WRITE_KEY>' })
app.post('/login', (req, res) => {
analytics.identify({
userId: req.body.userId,
previousId: req.body.previousId
})
res.sendStatus(200)
})
app.post('/cart', (req, res) => {
analytics.track({
userId: req.body.userId,
See our official documentation for more examples and information.
See the documentation: https://segment.com/docs/connections/sources/catalog/libraries/server/node/#configuration
You can also see the complete list of settings in the AnalyticsSettings interface.
segmentio
tools@segment.com
Estimated unpacked size across 11 packages.
1.0 MB
Includes dependencies.
6 direct · 1 outdated
^5.1.0
6.2.17
^2.4.1
2.9.1
^6.0.3
6.0.3
^2.0.0
2.0.1
1.8.3
1.2.0