You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Analytics.js can work with your single-page applications built with technologies such as React or Vue.
8
+
9
+
## Integrating with your build tooling
10
+
11
+
If you have a single-page application and plan to use Segment a lot, you might need to add [a Segment server analytics library](/docs/connections/sources/catalog/#server) to your build system. You can do this using Segment's `analytics-node` package instead of using the Analytics.js javascript code snippet. The Analytics-Node package works like any standard node-js dependency.
12
+
13
+
First add the package as a dependency:
14
+
15
+
```sh
16
+
$ npm install analytics-node
17
+
```
18
+
19
+
or, if you are using `yarn`:
20
+
21
+
```sh
22
+
$ yarn add analytics-node
23
+
```
24
+
25
+
Once installed, you can import `analytics-node` and instrument your events the same way you would with Analytics.js. The example implementation below is in React:
**Note:** Segment's `analytics-node` package does not support [device-mode destinations](/docs/utils/cmodes-compare/) or some browser specific features that Analytics.js supports.
0 commit comments