Skip to content

Commit f7148c4

Browse files
authored
Merge pull request #6533 from segmentio/pir-fix-plugins
Fix analytics.js plugin section
2 parents 203d81d + 4e2cb69 commit f7148c4

File tree

1 file changed

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

1 file changed

+6
-19
lines changed

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

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -683,29 +683,16 @@ Here are some examples of using `addSourceMiddleware` for enrichment and validat
683683
});
684684
```
685685

686-
### Plugin categories
687-
Plugins are bound by Analytics 2.0 which handles operations such as observability, retries, and error handling. There are two different categories of plugins:
688-
* **Critical Plugins**:
689-
- Errors thrown in `load()` will completely stop segment from initializing.
690-
691-
| Type | Details |
692-
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
693-
| `before` | Executes before event processing begins. These are plugins that run before any other plugins run. <br><br> See the example of how Analytics.js uses the [Event Validation plugin](https://github.com/segmentio/analytics-next/blob/master/packages/browser/src/plugins/validation/index.ts){:target="_blank"} to verify that every event has the correct shape.<br><br> Source middleware added via `addSourceMiddleware` is treated as a before plugin. |
694-
695-
* **Non-critical Plugins**:
696-
- This plugin can throw an error on `load()`, and all other segment plugins, including destinations, will load as usual, without blocking the delivery pipeline.
697-
698-
> info ""
699-
> Non-critical plugins are only non-critical from a loading standpoint. For example, if the `before` plugin crashes, this can still halt the event delivery pipeline.
700-
701-
Non-critical plugins run through a timeline that executes in order of insertion based on the entry type. Segment has these four entry types of non-critical plugins:
686+
### Advanced Plugin API
687+
For advanced modification to the event pipeline.
702688

703689
| Type | Details
704690
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
705-
| `enrichment` | Executes as the first level of event processing. These plugins modify an event. |
706-
| `destination` | Executes as events begin to pass off to destinations. <br><br> This doesn't modify the event outside of the specific destination, and failure doesn't halt the execution. |
691+
| `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. |
692+
| `enrichment` | Executes as the first level of event processing. These plugins modify an event. Thrown errors here can block the event pipeline. |
693+
| `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. |
707694
| `after` | Executes after all event processing completes. You can use this to perform cleanup operations. |
708-
| `utility` | Executes once during the bootstrap, to give you an outlet to make any modifications as to how Analytics.js works internally. This allows you to augment Analytics.js functionality. |
695+
| `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. |
709696

710697
### Example plugins
711698
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:

0 commit comments

Comments
 (0)