Skip to content

Commit d536b36

Browse files
authored
Merge pull request #5907 from segmentio/change-order-ajs
make snippet come first
2 parents 0f8dd55 + 7168436 commit d536b36

File tree

1 file changed

+26
-25
lines changed
  • src/connections/sources/catalog/libraries/website/javascript

1 file changed

+26
-25
lines changed

src/connections/sources/catalog/libraries/website/javascript/quickstart.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,34 @@ When you create a source in the Segment web app, it tells the Segment servers th
2525

2626
You can choose to install Segment to your site in 1 of 2 ways:
2727

28-
[a. Install Segment as a NPM package](#step-2a-install-segment-as-a-npm-package)
28+
[a. Add the Segment snippet to your app](#step-2a-add-the-segment-snippet)
2929

30-
[b. Add the Segment snippet to your app](#step-2b-add-the-segment-snippet)
3130

32-
### Step 2a: Install Segment as a npm package
31+
[b. Install Segment as a NPM package](#step-2b-install-segment-as-a-npm-package)
32+
33+
### Step 2a: Add the Segment Snippet
34+
35+
To add the Segment snippet to your app:
36+
37+
Paste the snippet into the `<head>` tag of your site to install Segment.
38+
39+
{% include content/snippet-helper.md %}
40+
41+
Replace `YOUR_WRITE_KEY` in the snippet you pasted with your Segment project's **Write Key**. [Find the write key](/docs/connections/find-writekey/) in your project set up guide or in the source's settings.
42+
43+
> info ""
44+
> 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.
45+
46+
That snippet loads Analytics.js onto the page _asynchronously_, so it won't affect your page load speed. Once the snippet is running on your site, you can turn on destinations from the destinations page in your workspace and they start loading on your site automatically.
47+
48+
Note that you should remove other native third-party destination code that you might have on your site. For example, if you're using Segment to send data to Google Analytics, make sure you remove the Google Analytics snippet from your site source code to prevent sending the data twice.
49+
50+
> info ""
51+
> If you only want the most basic Google Analytics setup, there's no need to continue with the setup. Just toggle on Google Analytics in the Segment interface.
52+
53+
A lot 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.
54+
55+
### Step 2b: Install Segment as a npm package
3356

3457
To install Segment as a npm package:
3558

@@ -61,28 +84,6 @@ To install Segment as a npm package:
6184
6285
For more initialization patterns and general information on `@segment/analytics-next`, see the repository's [README](https://github.com/segmentio/analytics-next/tree/master/packages/browser){:target="_blank"}.
6386
64-
### Step 2b: Add the Segment Snippet
65-
66-
To add the Segment snippet to your app:
67-
68-
Paste the snippet into the `<head>` tag of your site to install Segment.
69-
70-
{% include content/snippet-helper.md %}
71-
72-
Replace `YOUR_WRITE_KEY` in the snippet you pasted with your Segment project's **Write Key**. [Find the write key](/docs/connections/find-writekey/) in your project set up guide or in the source's settings.
73-
74-
> info ""
75-
> 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.
76-
77-
That snippet loads Analytics.js onto the page _asynchronously_, so it won't affect your page load speed. Once the snippet is running on your site, you can turn on destinations from the destinations page in your workspace and they start loading on your site automatically.
78-
79-
Note that you should remove other native third-party destination code that you might have on your site. For example, if you're using Segment to send data to Google Analytics, make sure you remove the Google Analytics snippet from your site source code to prevent sending the data twice.
80-
81-
> info ""
82-
> If you only want the most basic Google Analytics setup, there's no need to continue with the setup. Just toggle on Google Analytics in the Segment interface.
83-
84-
A lot 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.
85-
8687
## Step 3: Identify users
8788
8889
> info ""

0 commit comments

Comments
 (0)