Skip to content

Commit dda1314

Browse files
committed
cleanup second pass
1 parent 2f4a8e9 commit dda1314

File tree

1 file changed

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

1 file changed

+20
-20
lines changed

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ These methods correspond with those used in the [Segment Spec](/docs/connections
5050
5151
### Identify
5252

53-
Use the Identify method to link your users and their actions, to a recognizable `userId` and `traits`. You can see [an Identify call 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/).
53+
Use the Identify method to link your users and their actions to a recognizable `userId` and `traits`. You can see [an Identify call 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/).
5454

5555
> info "Identify calls and anonymous visitors"
56-
> 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, and then attaches it to all `page` and `track` events both before and after an `identify`.
56+
> Segment recommends _against_ using Identify call for anonymous visitors to your site. Analytics.js automatically retrieves an `anonymousId` from `localStorage` or assigns one for new visitors, and then attaches it to all Page and Track events both before and after an Identify call.
5757
5858
The Identify method follows the format below:
5959

@@ -84,7 +84,7 @@ analytics.identify({
8484
});
8585
```
8686

87-
Then, when the user completes the sign up process, you might see the following:
87+
Then, when the user completes the sign-up process, you might see the following:
8888

8989
```js
9090
analytics.identify('12091906-01011992', {
@@ -144,7 +144,7 @@ The only required argument on Track calls in Analytics.js is an `event` name str
144144

145145
`trackLink` is a helper method that attaches a Track call as a handler to a link. When a user clicks the link, `trackLink` delays the navigation event by 300 ms before proceeding, ensuring the Track request has enough time to send before the page starts unloading.
146146

147-
This is useful when a page redirects too quickly, preventing the Track method from completing all requests. By momentarily holding off navigation, `trackLink` increases the likelihood that tracking data reaches Segment and destinations successfully.
147+
This is useful when a page redirects too quickly, preventing the Track method from completing all requests. By momentarily delaying navigation, `trackLink` increases the likelihood that tracking data reaches Segment and destinations successfully.
148148

149149
The `trackLink` method follows the format below:
150150

@@ -354,7 +354,7 @@ if (userConsentsToBeingTracked) {
354354
}
355355
```
356356

357-
You can also use `load` if you fetch some settings asynchronously.
357+
You can also use the Load method if you fetch some settings asynchronously.
358358
```js
359359
const analytics = new AnalyticsBrowser()
360360
fetchWriteKey().then(writeKey => analytics.load({ writeKey }))
@@ -366,7 +366,7 @@ analytics.identify("hello world")
366366

367367
The Ready method lets you pass in a method that gets called after Analytics.js finishes initializing and after all enabled device-mode destinations load. It's like [jQuery's `ready` method](https://api.jquery.com/ready/){:target="_blank"}, except for destinations. Because it doesn't fire until all enabled device-mode destinations are loaded, it can't be used to change configuration options for downstream SDKs. That can only be done if the SDK is loaded natively.
368368

369-
The Ready method isn't invoked if any destination throws an error (for example, for an expired API key, incorrect settings configuration, or when a destination is blocked by the browser) during initialization. If you want to check when Analytics.js has loaded, you can look at the value of `window.analytics.initialized`. When it’s true, the library has successfully initialized, even if some destinations are blocked.
369+
The Ready method isn't invoked if any destination throws an error (for example, for an expired API key, incorrect settings configuration, or when a destination is blocked by the browser) during initialization. If you want to check when Analytics.js has loaded, you can look at the value of `window.analytics.initialized`. When this value is `true`, the library has successfully initialized, even if some destinations are blocked.
370370

371371
**Note**: `window.analytics.initialized` is a simple boolean, not an event or a pub/sub system. This means you can't subscribe to changes in its value. If you need to detect when it changes from `false` to `true`, you must set up a polling mechanism to monitor the value.
372372

@@ -381,7 +381,7 @@ analytics.ready(() => {
381381
});
382382
```
383383

384-
The `ready` method uses the following format:
384+
The Ready method uses the following format:
385385

386386
```js
387387
analytics.ready(callback);
@@ -748,11 +748,11 @@ For advanced modification to the event pipeline.
748748

749749
| Type | Details
750750
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
751-
| `before` | Executes before event processing begins. These are plugins that run before any other plugins run. Thrown errors here can block the event pipeline. Source middleware added via `addSourceMiddleware` is treated as a `before` plugin. |
751+
| `before` | Executes before event processing begins. These are plugins that run before any other plugins run. Thrown errors here can block the event pipeline. Source middleware added using `addSourceMiddleware` is treated as a `before` plugin. |
752752
| `enrichment` | Executes as the first level of event processing. These plugins modify an event. Thrown errors here can block the event pipeline. |
753753
| `destination` | Executes as events begin to pass off to destinations. Segment.io is implemented as a destination plugin. Thrown errors here will _not_ block the event pipeline. |
754754
| `after` | Executes after all event processing completes. You can use this to perform cleanup operations. |
755-
| `utility` | Executes _only once_ during the analytics.js bootstrap. Gives you access to the analytics instance via the plugin's `load()` method. This doesn't allow you to modify events. |
755+
| `utility` | Executes _only once_ during the analytics.js bootstrap. Gives you access to the analytics instance using the plugin's `load()` method. This doesn't allow you to modify events. |
756756

757757
### Example plugins
758758
Here's an example of a plugin that converts all track event names to lowercase before the event goes through the rest of the pipeline:
@@ -875,7 +875,7 @@ To track activity on your subdomains, include the Segment Analytics.js snippet o
875875
Because Segment tracks across subdomains, you can either use the same Segment source, or use separate sources for each subdomain. What you decide depends on your team's goals for tracking each subdomain.
876876

877877
> info ""
878-
> Segment doesn't offer tracking across top-level domains out of the box. If you want to track across top-level domains, you can use Segment's [Querystring API](/docs/connections/sources/catalog/libraries/website/javascript/querystring/) to pass the anonymousId from Website A to Website B in the query string. When a user moves from Website A to Website B with the anonymousId in the query string, Analytics.js reads that value and sets the anonymousId to it, rather than generating a new one.
878+
> Segment doesn't offer tracking across top-level domains out of the box. If you want to track across top-level domains, you can use Segment's [Querystring API](/docs/connections/sources/catalog/libraries/website/javascript/querystring/) to pass the `anonymousId` from Website A to Website B in the query string. When a user moves from Website A to Website B with the `anonymousId` in the query string, Analytics.js reads that value and sets the `anonymousId` to it, rather than generating a new one.
879879
880880
## UTM tracking
881881

@@ -920,11 +920,11 @@ This middleware filters out any non-standard parameters from the `context.campai
920920
921921
## Analytics.js performance
922922
923-
The Analytics.js library and all Destination libraries are loaded with the [HTML script `async` tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async){:target="_blank"}. This also means that Segment fires methods asynchronously, so you should adjust your code accordingly if you require that events be sent from the browser in a specific order.
923+
The Analytics.js library and all destination libraries are loaded with the [HTML script `async` tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async){:target="_blank"}. This also means that Segment fires methods asynchronously, so you should adjust your code accordingly if you require that events be sent from the browser in a specific order.
924924
925925
While many tools require access to the DOM or cookies, for the Zendesk, Salesforce, and Mailchimp destinations, Segment doesn't need to load a native JavaScript library. Instead, Segment's servers send data to the end-tools.
926926
927-
Segment loads the libraries required for your **enabled** Destinations. When you disable a destination, the custom version of Analytics.js loaded on your site stops requesting that library.
927+
Segment loads the libraries required for your **enabled** destinations. When you disable a destination, the custom version of Analytics.js loaded on your site stops requesting that library.
928928
929929
Using Analytics.js doesn't offer a large performance benefit, but is more performant than installing each of the destinations individually. And as more destinations move to accept data directly from Segment, you'll receive more performance benefits automatically.
930930
@@ -987,7 +987,7 @@ To minimize client-side data loss, Segment provides a few workarounds. However,
987987
988988
- Create a [custom proxy](/docs/connections/sources/catalog/libraries/website/javascript/custom-proxy/). This changes the URL that Segment loads from (cdn.segment.com) and the outgoing requests generated when events are triggered (api.segment.io).
989989
990-
- Consider implementing the [Segment Edge SDK](https://segment.com/blog/twilio-segment-edge-sdk/){:target="_blank”}. The Segment Edge SDK leverages Cloudflare Workers to facilitate first-party data collection and real-time user profiling for app personalization. It integrates Segment's library into web apps, manages user identity via HttpOnly cookies, and employs an internal router for efficient data processing and user experience customization. This innovative approach simplifies tracking and personalization for Segment customers. More information is available in the [Edge SDK README](https://github.com/segmentio/analytics-edge/blob/main/packages/edge-sdk/README.md){:target="_blank”}.
990+
- Consider implementing the [Segment Edge SDK](https://segment.com/blog/twilio-segment-edge-sdk/){:target="_blank”}. The Segment Edge SDK uses Cloudflare Workers to facilitate first-party data collection and real-time user profiling for app personalization. It integrates Segment's library into web apps, manages user identity using HTTPOnly cookies, and employs an internal router for efficient data processing and user experience customization. This innovative approach simplifies tracking and personalization for Segment customers. More information is available in the [Edge SDK README](https://github.com/segmentio/analytics-edge/blob/main/packages/edge-sdk/README.md){:target="_blank”}.
991991
992992
* Consider using one of Segment’s [server-side libraries](/docs/connections/sources/#server). Using a server-side library eliminates concerns about tracking blockers and privacy browsers that can prevent Segment from loading. This option may require additional code to track actions like a Page call, as you now need to manually pass contextual information that would have been automatically collected by Analytics.js, like `url`, `path`, and `referrer`. Note that some destinations are device-mode only.
993993
@@ -1006,7 +1006,7 @@ Change the global variable in the beginning of your snippet code as shown below.
10061006
10071007
Bundle the destinations you want loaded from [npm](https://www.npmjs.com/package/@segment/analytics-next){:target="_blank"} instead of having them loaded from a remote CDN. This enables you to have fewer network requests when adding destinations.
10081008
1009-
* To add actions-based destinations from npm:
1009+
- To add actions-based destinations from npm:
10101010
10111011
```js
10121012
import vwo from '@segment/analytics-browser-actions-vwo'
@@ -1021,7 +1021,7 @@ Bundle the destinations you want loaded from [npm](https://www.npmjs.com/package
10211021
Pass in the destination plugin to the added config option called `plugins`. A list of all action destination packages can be found on GitHub in the [@segmentio/action-destinations](https://github.com/segmentio/action-destinations/blob/main/packages/destinations-manifest/package.json){:target="_blank"} repository.
10221022
10231023
1024-
* To add classic destinations from npm:
1024+
- To add classic destinations from npm:
10251025
10261026
```js
10271027
import { AnalyticsBrowser } from '@segment/analytics-next'
@@ -1067,11 +1067,11 @@ The Segment Inspector is composed of these three components:
10671067
## Example uses
10681068
Here are some examples of using Analytics.js. Note that the examples assume Analytics.js is installed through [npm](https://github.com/segmentio/analytics-next/tree/master/packages/browser){:target="_blank”}.
10691069
1070-
* **Next.js**
1071-
* [with-segment-analytics](https://github.com/vercel/next.js/tree/canary/examples/with-segment-analytics){:target="_blank”}
1072-
* [with-segment-analytics-pages-router](https://github.com/vercel/next.js/tree/canary/examples/with-segment-analytics-pages-router){:target="_blank”}
1073-
* **Vanilla React, Vue**
1074-
* See [Usage in Common Frameworks and SPAs](https://github.com/segmentio/analytics-next/tree/master/packages/browser#examples--usage-in-common-frameworks-and-spas){:target="_blank”}
1070+
- **Next.js**
1071+
- [with-segment-analytics](https://github.com/vercel/next.js/tree/canary/examples/with-segment-analytics){:target="_blank”}
1072+
- [with-segment-analytics-pages-router](https://github.com/vercel/next.js/tree/canary/examples/with-segment-analytics-pages-router){:target="_blank”}
1073+
- **Vanilla React, Vue**
1074+
- See [Usage in Common Frameworks and SPAs](https://github.com/segmentio/analytics-next/tree/master/packages/browser#examples--usage-in-common-frameworks-and-spas){:target="_blank”}
10751075
10761076
## External dependencies
10771077

0 commit comments

Comments
 (0)