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
Copy file name to clipboardExpand all lines: src/connections/destinations/catalog/braze/index.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -309,7 +309,7 @@ The `inAppMessages` parameter will be an array of [`appboy.ab.InAppMessage`](htt
309
309
});
310
310
```
311
311
312
-
**Note:** We recommend placing this snippet outside of your [Segment Snippet](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-1-copy-the-snippet) within your `script` tag.
312
+
**Note:** We recommend placing this snippet outside of your [Segment Snippet](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet) within your `script` tag.
313
313
314
314
**Note:** This will immediately request push permission from the user.
315
315
@@ -384,7 +384,7 @@ analytics.ready(function() {
384
384
385
385
For more details on this snippet, check out the Braze's docs [here](https://www.braze.com/documentation/Web/#soft-push-prompts).
386
386
387
-
**Note:** We recommend placing this snippet outside of your [Segment Snippet](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-1-copy-the-snippet) within your `script` tag.
387
+
**Note:** We recommend placing this snippet outside of your [Segment Snippet](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet) within your `script` tag.
388
388
389
389
4. When you'd like to display the Soft Push to a user, call:
Copy file name to clipboardExpand all lines: src/connections/destinations/catalog/hubspot/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ If you're not familiar with the Segment Specs, take a look to understand what th
26
26
```
27
27
analytics.page()
28
28
```
29
-
**IMPORTANT:** An initial `page` call is required for data to be sent to HubSpot using Analytics.js. This is included by default in your [Segment snippet](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-1-copy-the-snippet).
29
+
**IMPORTANT:** An initial `page` call is required for data to be sent to HubSpot using Analytics.js. This is included by default in your [Segment snippet](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet).
Copy file name to clipboardExpand all lines: src/connections/destinations/catalog/klaviyo/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ analytics.identify({
51
51
52
52
When you call `identify` on analytics.js, we call Klaviyo's `identify` with the `traits` object. We augment the `traits` object to have `traits.$id` be the `userId` since Klaviyo takes the user ID on the `traits` object itself.
53
53
54
-
**Note:** When sending data to Klaviyo using `analytics.js`, an initial `page` call is required. By default, this is already added in your [Segment snippet](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-1-copy-the-snippet).
54
+
**Note:** When sending data to Klaviyo using `analytics.js`, an initial `page` call is required. By default, this is already added in your [Segment snippet](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet).
55
55
56
56
We will map the following Segment spec'd traits to Klaviyo [special people properties](http://www.klaviyo.com/docs):
Copy file name to clipboardExpand all lines: src/connections/destinations/catalog/mouseflow/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ If you're not familiar with the Segment Specs, take a look to understand what th
22
22
```
23
23
analytics.page()
24
24
```
25
-
An initial `page` call is required for data to be sent to Mouseflow using Analytics.js and sends a page view. This is included by default in your [Segment snippet](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-1-copy-the-snippet).
25
+
An initial `page` call is required for data to be sent to Mouseflow using Analytics.js and sends a page view. This is included by default in your [Segment snippet](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet).
Copy file name to clipboardExpand all lines: src/connections/sources/catalog/libraries/website/javascript/index.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,9 +19,12 @@ The basic tracking methods below are the building blocks of your Segment trackin
19
19
20
20
These names may seem familar because these are the basic methods covered by the [Segment Spec](/docs/connections/spec/). The documentation on this page explains how to use these methods in Analytics.js specifically.
21
21
22
+
> note ""
23
+
> **Good to know**: For any of the different methods described in this page, you can replace the properties in the code samples with variables that represent the data collected.
24
+
22
25
### Identify
23
26
24
-
The `identify` method is how you link your users, and their actions, to a recognizable `userId` and `traits`. You can see [an `identify` example in the Quickstart guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-identify-users) or [find details on the identify method payload](/docs/connections/spec/identify/).
27
+
The `identify` method is how you link your users, and their actions, to a recognizable `userId` and `traits`. You can see [an `identify` example in the Quickstart guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-3-identify-users) or [find details on the identify method payload](/docs/connections/spec/identify/).
25
28
26
29
> note ""
27
30
> Segment recommends _against_ using `identify` for anonymous visitors to your site. Analytics.js automatically retrieves an `anonymousId` from localStorage or assigns one for new visitors, which is attached to all `page` and `track` events both before and after an `identify`.
The Track method lets you record actions your users perform. You can [see a track example in the Quickstart guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-3-track-actions) or find details on [the track method payload](/docs/connections/spec/track/).
101
+
The Track method lets you record actions your users perform. You can [see a track example in the Quickstart guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-4-track-actions) or find details on [the track method payload](/docs/connections/spec/track/).
99
102
100
103
The Track method follows the format below:
101
104
@@ -233,7 +236,7 @@ The [Page](/docs/connections/spec/page/) method lets you record page views on yo
233
236
234
237
Because some destinations require a `page` call to instantiate their libraries, **you must call `page`** at least once per page load. You can call it more than once if needed, for example on virtual page changes in a single page app.
235
238
236
-
A Page call is included by default as the final line in [the Analytics.js snippet](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-1-copy-the-snippet). You can modify this `page` call within the guidelines below.
239
+
A Page call is included by default as the final line in [the Analytics.js snippet](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet). You can modify this `page` call within the guidelines below.
> **Note:** To use this feature, you must be on snippet version 4.1.0 or later. You can get the latest version of the snippet [here](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-1-copy-the-snippet).
604
+
> **Note:** To use this feature, you must be on snippet version 4.1.0 or later. You can get the latest version of the snippet [here](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet).
602
605
603
606
This way, you can conditionally load integrations based on what customers opt into on your site. The pseudocode example below shows how you might load only the tools the user consented to.
Copy file name to clipboardExpand all lines: src/connections/sources/catalog/libraries/website/javascript/quickstart.md
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,14 +11,28 @@ This tutorial gets you started sending data from your website to Segment and any
11
11
12
12
Want to learn more? Check out the [Analytics.js reference](/docs/connections/sources/catalog/libraries/website/javascript/).
13
13
14
+
## Step 1: Create a Source in the Segment app
14
15
15
-
## Step 1: Copy the Snippet
16
+
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.
17
+
18
+
19
+
To create an Analytics.js source from your Workspace:
20
+
21
+
1. Click **Add Source**.
22
+
2. From the source catalog page, click **Javascript**.
23
+
3. Click **Add Source** again from the informational panel that appears to the right.
24
+
4. Give the source a display name, and enter the URL the source will collect data from.
25
+
26
+
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 website code to tell the Segment servers where the data is coming from, so Segment can route it to your destinations and other tools.
27
+
28
+
29
+
## Step 2: Copy the Segment Snippet
16
30
17
31
Installing Segment is easy, just paste this snippet into the `<head>` tag of your site.
18
32
19
33
{% include content/snippet-helper.md %}
20
34
21
-
Next, replace `YOUR_WRITE_KEY` in the snippet you pasted with your Segment project's **Write Key**, which you can find in your project set up guide or settings.
35
+
Next, replace `YOUR_WRITE_KEY` in the snippet you pasted with your Segment project's **Write Key**. You can [find the write key](/docs/connections/find-writekey/)in your project set up guide or in the source's settings.
22
36
23
37
> note ""
24
38
> **Note:** When you use Analytics.js in device-mode the source's Write Key is public, because it runs in a user's browser and can be accessed using the browser's developer tools. If this is not acceptable to your organization, you can explore [other Segment Sources](/docs/connections/sources/catalog/) which collect data from a server-based installation, and which are not accessible to the user.
@@ -31,7 +45,10 @@ Note that you should remove other native third-party destination code that you m
31
45
32
46
However, lots of analytics and marketing tools need to record _who_ each user is on your site. If you want to use any tool that deals with the identity of your users, read on about the `identify` method.
33
47
34
-
## Step 2: Identify Users
48
+
## Step 3: Identify Users
49
+
50
+
> note ""
51
+
> **Good to know**: For any of the different methods described in this quickstart, you can replace the properties in the code samples with variables that represent the data collected.
35
52
36
53
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 method reference](/docs/connections/sources/catalog/libraries/website/javascript#identify).
That identifies Michael by his unique User ID (in this case, `f4ca124298`, which is what you know him by in your database) and labels him with `name` and `email` traits.
49
66
50
-
**Hold up though!** When you actually put that code on your site,you need to replace those hard-coded trait values with the variables that represent the details of the currently logged-in user.
67
+
**Hold up though!** When you actually put that code on your site,you need to replace those hard-coded trait values with the variables that represent the details of the currently logged-in user.
51
68
52
69
To do that, we recommend that you use a backend template to inject an `identify` call into the footer of **every page** of your site where the user is logged in. That way, no matter what page the user first lands on, they will always be identified. You don't need to call `identify` if your unique identifier (`userId`) is not known.
53
70
@@ -69,7 +86,7 @@ With that call in your page footer, you successfully identify every user that vi
69
86
Of course, lots of analytics tools record more than just _identities_... they record the actions each user performs too! If you're looking for a complete event tracking analytics setup, keep reading...
70
87
71
88
72
-
## Step 3: Track Actions
89
+
## Step 4: Track Actions
73
90
74
91
The `track` method is how you tell Segment about the actions your users are performing on your site. Every action triggers what we call an "event", which can also have associated properties. You can read more about `track` in the [track method reference](/docs/connections/sources/catalog/libraries/website/javascript#track).
Copy file name to clipboardExpand all lines: src/protocols/apis-and-extensions/typewriter.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ Once you've installed Node and NPM, run the `--version` commands again to verify
88
88
89
89
Before you start, make sure you have `node` installed using the instructions in the [prerequisites](#prerequisites) above.
90
90
91
-
Next, install `analytics.js` in your app. For now, you just need to complete [`Step 1: Copy the Snippet`](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-1-copy-the-snippet) from the [`analytics.js` Quickstart Guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/).
91
+
Next, install `analytics.js` in your app. For now, you just need to complete [`Step 1: Copy the Snippet`](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/#step-2-copy-the-segment-snippet) from the [`analytics.js` Quickstart Guide](/docs/connections/sources/catalog/libraries/website/javascript/quickstart/).
92
92
93
93
Once you've got `analytics.js` installed, add Typewriter as a developer dependency in your project:
0 commit comments