Skip to content

Commit 5970648

Browse files
authored
Merge pull request #3302 from segmentio/fixes-from-docs-dashboard-1
Fixes from docs dashboard set 1
2 parents 01e5d49 + a34bd70 commit 5970648

File tree

9 files changed

+94
-119
lines changed

9 files changed

+94
-119
lines changed

src/_data/sidenav/strat.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,11 @@ sections:
185185
title: Analytics-Swift
186186
- path: /connections/sources/catalog/libraries/mobile/swift-ios/migration
187187
title: Analytics-Swift Migration Guide
188+
189+
- slug: node-js
190+
section_title: Analytics-Node.js Documentation
191+
section:
192+
- path: /connections/sources/catalog/libraries/server/node/
193+
title: Analytics-Node.js
194+
- path: /connections/sources/catalog/libraries/server/node/quickstart/
195+
title: Quickstart Node.js

src/connections/destinations/catalog/google-analytics/index.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,7 @@ Google Universal Analytics has multiple scopes for each custom dimensions: hit (
112112
#### Setting up Custom Dimensions
113113
First, [configure the Custom Dimensions](https://support.google.com/analytics/answer/2709829?hl=en) from your Google Universal Analytics admin page.
114114

115-
Once you finish this set up in Google Universal Analytics, you can to map traits and properties to your custom dimensions. Go to the Google Universal Analytics destination settings in the Segment App and locate the **Custom Dimensions** setting. This is where you will enter your mapping.
116-
117-
The following images show an example of mapping "Gender" to dimension "1" and "User Type" to dimension "2":
118-
119-
On Segment:
120-
![custom dimension mapping screenshot](images/dimension-mapping.png)
121-
On Google:
122-
![custom dimension mapping screenshot](images/dimension-mapping-google-analytics.png)
123-
124-
You can only map each trait or property to one Custom Dimension at a time.
115+
Once you finish this set up in Google Universal Analytics, you can map traits and properties to your custom dimensions. Go to the Google Universal Analytics destination settings in the Segment App and locate the **Custom Dimensions** setting. This is where you will enter your mapping. You can only map each trait or property to one Custom Dimension at a time.
125116

126117
When you finish mapping dimensions and save the settings, Segment checks if the user traits and properties in [Identify](/docs/connections/spec/identify/), [Track](/docs/connections/spec/track/) and [Page](/docs/connections/spec/page/) calls are defined as a dimension. If they are defined in your mapping, Segment sends that dimension to Google Universal Analytics.
127118

@@ -747,7 +738,7 @@ This source can be your server-side source. From there, its easy to send data to
747738

748739
### Consent Mode
749740

750-
Segment does not support Google's [Consent Mode](https://support.google.com/analytics/answer/9976101?hl=en){:target="_blank"} feature. Consent Mode enables you to adjust how Google's tags load on your site, based on whether users consent to your use of cookies. This feature requires Google's gtag.js library, and does not work when you use Segment's Google Universal Analytics destination, because it loads [Google's analytics.js library](https://support.google.com/analytics/answer/7476135?hl=en#zippy=%2Cin-this-article){:target="blank"} instead of the gtag.js library.
741+
Segment does not support Google's [Consent Mode](https://support.google.com/analytics/answer/9976101?hl=en){:target="_blank"} feature. Consent Mode enables you to adjust how Google's tags load on your site, based on whether users consent to your use of cookies. This feature requires Google's gtag.js library, and does not work when you use Segment's Google Universal Analytics destination, because it loads [Google's analytics.js library](https://support.google.com/analytics/answer/7476135?hl=en#zippy=%2Cin-this-article){:target="blank"} instead of the gtag.js library.
751742

752743
### Cookie Domain Name
753744

src/connections/sources/catalog/cloud-apps/project/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
title: 'Project Source'
33
hidden: true
44
id: qqE6TuEDEM
5+
published: false
56
---
6-
<!-- JR: I don't think this is a real source?-->
7+
<!-- JR: I don't think this is a real source?-->

src/connections/sources/catalog/cloud-apps/twilio-event-streams-beta/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
title: Twilio Event Streams (Beta)
33
hidden: true
44
id: lWMazCg4rS
5+
published: false
56
---
67
{% include content/source-region-unsupported.md %}

src/connections/sources/catalog/libraries/server/node/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Analytics for Node.js
33
redirect_from: '/connections/sources/catalog/libraries/server/node-js/'
44
repo: analytics-node
5+
strat: node-js
56
---
67

78
Our Node.js library lets you record analytics data from your node code. The requests hit our servers, and then we route your data to any destinations you have enabled.
Lines changed: 78 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,89 @@
11
---
22
title: 'Quickstart: Node.js'
33
redirect_from: '/connections/sources/catalog/libraries/server/node-js/quickstart/'
4+
strat: node-js
45
---
56

6-
This tutorial will help you start sending data from your Node servers to Segment and any of our destinations, using our Node library. As soon as you're set up you'll be able to turn on any new destinations with the flip of a switch!
7-
8-
If you want to dive deeper at any point, check out the [Node library reference](/docs/connections/sources/catalog/libraries/server/node).
9-
10-
## Step 1: Create a Source in the Segment app
11-
12-
Before you begin, you need a Workspace (which is a container that holds all of the sources and destinations which are billed together for an organization). If you already created one, great! If not, you can sign up for a free Segment account and create one.
13-
14-
Next, create a Node.js source from your Workspace:
15-
16-
1. Click **Add Source**.
17-
2. From the source catalog page, click **Node.js**.
18-
3. Click **Add Source** again from the informational panel that appears to the right.
19-
4. Give the source a display name, and enter the URL the source will collect data from.
20-
21-
When you create a Source in the Segment web app, it tells the Segment servers that you'll be sending data from a specific source type. When you create (or change!) a Source in the Segment app, Segment generates a new Write Key for that source. You use the write key in your code to tell the Segment servers where the data is coming from, so Segment can route it to your destinations and other tools.
22-
23-
## Step 2: Install the Module
24-
25-
Installing Segment is easy, just run the following npm command:
26-
27-
```
28-
npm install --save analytics-node
29-
```
30-
31-
That will add our Node library module to your `package.json`. The module exposes an `Analytics` constructor, which you need to initialize with your Segment project's **Write Key**, like so:
32-
33-
```javascript
34-
var Analytics = require('analytics-node');
35-
var analytics = new Analytics('YOUR_WRITE_KEY');
36-
```
37-
38-
That will create an instance of `Analytics` that you can use to send data to Segment for your project. The default initialization settings are production-ready and queue 20 messages before sending any requests. In development you might want to use [development settings](/docs/connections/sources/catalog/libraries/server/node#development).
39-
40-
Once you've got that, you're ready to...
41-
42-
43-
## Step 3: Identify Users
44-
45-
> note ""
46-
> **Good to know**: For any of the different methods described in this quickstart, you can replace the properties and traits in the code samples with variables that represent the data collected.
47-
48-
The `identify` method is how you tell Segment who the current user is. It includes a unique User ID and any optional traits you know about them. You can read more about it in the [identify reference](/docs/connections/sources/catalog/libraries/server/node#identify).
49-
50-
Here's what a basic call to `identify` might look like:
51-
52-
```js
53-
analytics.identify({
54-
userId:'f4ca124298',
55-
traits: {
56-
name: 'Michael Bolton',
57-
58-
createdAt: new Date('2014-06-14T02:00:19.467Z')
59-
}
60-
});
61-
```
62-
63-
That's identifying Michael by his unique User ID (the one you know him by in your database) and labeling him with `name` and `email` traits.
64-
65-
When you're using our Node library, you don't need to identify a user on every request they make to your servers. Instead, we recommend calling `identify` a single time when the user's account is first created, and only identifying again later when their traits are change.
66-
67-
Once you've added an identify call, you can move on to...
68-
69-
70-
## Step 4: Track Actions
71-
72-
The `track` method is how you tell Segment about which actions your users are performing. Every action triggers what we call an "event", which can also have associated properties. You can read more about `track` in the [track reference](/docs/connections/sources/catalog/libraries/server/node#track).
73-
74-
Here's what a call to `track` might look like when a user signs up:
75-
76-
```js
77-
analytics.track({
78-
userId:'f4ca124298',
79-
event: 'Signed Up',
80-
properties: {
81-
plan: 'Enterprise'
82-
}
83-
});
84-
```
85-
86-
That's just telling us that your user just triggered the **Signed Up** event and chose your hypothetical `'Enterprise'` plan. Properties can be anything you want to record, for example:
87-
88-
```js
89-
analytics.track({
90-
userId:'f4ca124298',
91-
event: 'Bookmarked Article',
92-
properties: {
93-
title: 'Snow Fall',
94-
subtitle: 'The Avalanche at Tunnel Creek',
95-
author: 'John Branch'
96-
}
97-
});
98-
```
99-
100-
You'll want to track events that are indicators of success for your site, like **Signed Up**, **Item Purchased** or **Article Bookmarked**.
101-
102-
To get started, we recommend tracking just a few important events. You can always add more later!
103-
104-
Once you've added a few `track` calls, **you're done!** You successfully installed analytics tracking on your servers. Now you're ready to turn on any destination you fancy from our interface, margarita in hand.
105-
7+
This tutorial will help you start sending data from your Node servers to Segment and any destination, using Segment's Node library. Check out the full documentation for [Analytics Node.js](/docs/connections/sources/catalog/libraries/server/node) to learn more.
8+
9+
To get started with Analytics Node.js:
10+
1. Create a Node.js source in the Segment app.
11+
1. Navigate to **Connections > Sources > Add Source**.
12+
2. Search for **Node.js** from the source catalog and click **Node.js**.
13+
3. Click **Add Source** again from the informational panel that appears to the right.
14+
4. Give the source a display name, and enter the URL the source will collect data from.
15+
* When you create a Source in the Segment web app, it tells the Segment servers that you'll be sending data from a specific source type. When you create or change a Source in the Segment app, Segment generates a new Write Key for that source. You use the write key in your code to tell the Segment servers where the data is coming from, so Segment can route it to your destinations and other tools.
16+
2. Install the module.
17+
1. Run the following npm command to install Segment:
18+
```
19+
npm install --save analytics-node
20+
```
21+
22+
This will add the Node library module to your `package.json`. The module exposes an `Analytics` constructor, which you need to initialize with your Segment project's **Write Key**, like so:
23+
24+
```javascript
25+
var Analytics = require('analytics-node');
26+
var analytics = new Analytics('YOUR_WRITE_KEY');
27+
```
28+
29+
This will create an instance of `Analytics` that you can use to send data to Segment for your project. The default initialization settings are production-ready and queue 20 messages before sending any requests. In development you might want to use [development settings](/docs/connections/sources/catalog/libraries/server/node#development).
30+
3. Identify Users.
31+
32+
* **Note:** For any of the different methods described in this quickstart, you can replace the properties and traits in the code samples with variables that represent the data collected.
33+
34+
35+
The `identify` method is how you tell Segment who the current user is. It includes a unique User ID and any optional traits you know about them. You can read more about it in the [identify reference](/docs/connections/sources/catalog/libraries/server/node#identify). Here's what a basic call to `identify` might look like:
36+
37+
```js
38+
analytics.identify({
39+
userId:'f4ca124298',
40+
traits: {
41+
name: 'Michael Bolton',
42+
43+
createdAt: new Date('2014-06-14T02:00:19.467Z')
44+
}
45+
});
46+
```
47+
48+
This identifies Michael by his unique User ID (the one you know him by in your database) and labeling him with `name` and `email` traits. When you're using the Node library, you don't need to identify a user on every request they make to your servers. Instead, Segment recommends calling `identify` a single time when the user's account is first created, and only identifying again later when their traits change.
49+
4. Track Actions.
50+
51+
Segment recommends tracking just a few important events. You can always add more later. You should track events that are indicators of success for your site, like **Signed Up**, **Item Purchased** or **Article Bookmarked**.
52+
53+
<br> The `track` method is how you tell Segment about which actions your users are performing. Every action triggers what Segment calls an "event", which can also have associated properties. You can read more about `track` in the [track reference](/docs/connections/sources/catalog/libraries/server/node#track).
54+
55+
Here's what a call to `track` might look like when a user signs up:
56+
57+
```js
58+
analytics.track({
59+
userId:'f4ca124298',
60+
event: 'Signed Up',
61+
properties: {
62+
plan: 'Enterprise'
63+
}
64+
});
65+
```
66+
67+
This tells Segment that your user just triggered the **Signed Up** event and chose your hypothetical `'Enterprise'` plan. Properties can be anything you want to record, for example:
68+
69+
```js
70+
analytics.track({
71+
userId:'f4ca124298',
72+
event: 'Bookmarked Article',
73+
properties: {
74+
title: 'Snow Fall',
75+
subtitle: 'The Avalanche at Tunnel Creek',
76+
author: 'John Branch'
77+
}
78+
});
79+
```
80+
81+
After you've added a few `track` calls, you've successfully installed analytics tracking on your servers. Now you're ready to turn on any destination from the Segment app.
10682
10783
---
10884
109-
11085
## What's Next?
11186
112-
We just walked through the quickest way to get started with Segment using node. You might also want to check out our full [Node library reference](/docs/connections/sources/catalog/libraries/server/node) to see what else is possible, or read about the [Tracking API methods](/docs/connections/sources/catalog/libraries/server/http/) to get a sense for the bigger picture.
87+
You can check out the full docs for [Analytics Node.js](/docs/connections/sources/catalog/libraries/server/node) to see what else is possible, or read about the [Tracking API methods](/docs/connections/sources/catalog/libraries/server/http/) to get a sense for the bigger picture.
11388
114-
You might also want to consider installing [Analytics.js](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/) so that you can use destinations that require being loaded in the browser, like live chat tools or user feedback systems.
89+
You can also consider installing [Analytics.js](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/) so that you can use destinations that require being loaded in the browser, like live chat tools or user feedback systems.

src/connections/spec/identify.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 'Spec: Identify'
3-
related:
4-
- "/docs/connections/sources/catalog/"
53
---
64

75
The Segment Identify call 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.

src/getting-started/02-simple-install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Click a tab below to see the tutorial content for the specific library you chose
6969

7070
### Step 1: Copy the Snippet
7171
<br>
72-
Paste the snippet from the JavaScript Source overview page into the `<head>` tag of your site.
72+
Navigate **Connections > Sources > JavaScript** in the Segment app and copy the snippet from the JavaScript Source overview page and paste it into the `<head>` tag of your site.
7373
<br><br>
7474
That snippet loads Analytics.js onto the page _asynchronously_, so it won't affect your page load speed. Once the snippet runs on your site, you can turn on destinations from the destinations page in your workspace and data starts loading on your site automatically.
7575
<br><br>

src/getting-started/05-data-to-destinations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Once you've got data flowing _into_ Segment, what do you do with it? The Segment
66

77
## Routing data to destinations
88

9-
When you enable a destination in the Segment App, you link it to a specific source (or sources). By default, Segment first processes the data from the selected source(s), then translates it and routes it from the Segment servers to to the API endpoint for that destination.
9+
When you enable a destination in the Segment App, you link it to a specific source (or sources). By default, Segment first processes the data from the selected source(s), then translates it and routes it from the Segment servers to the API endpoint for that destination.
1010

1111
This means that if you previously had loaded code or a snippet for that tool on your website or app, you should remove it once you have Segment implemented so you don't send duplicate data.
1212

0 commit comments

Comments
 (0)