Skip to content

Commit 6343267

Browse files
committed
update signals README
1 parent ee838db commit 6343267

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

packages/signals/signals/README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,19 @@ https://my-website.com?segment_signals_debug=false
8282

8383
* This also logs all signals to the js console.
8484

85-
#### Alternative method of enabling debug mode
86-
In your JS console:
85+
#### Alternative method(s) of enabling debug mode
86+
1. In your JS console:
8787
```js
88-
SegmentSignalsPlugin.debug()
88+
window.SegmentSignalsPlugin.debug()
89+
```
90+
91+
92+
2. Passed as a setting
93+
```js
94+
const signalsPlugin = new SignalsPlugin({
95+
enableSignalsIngestion: process.env.SIGNALS_DEBUG_ENABLED = 'true'
96+
})
97+
analytics.register(signalsPlugin)
8998
```
9099

91100
### Advanced
@@ -105,19 +114,22 @@ import { SignalsPlugin, SignalsMiddleware } from '@segment/analytics-signals'
105114

106115
class MyMiddleware implements SignalsMiddleware {
107116
process(signal: Signal) {
108-
// drop the event if some conditions are met
117+
// drop all instrumentation signals
109118
if (
110-
signal.type === 'network' &&
111-
signal.data.action === 'request' &&
112-
...
119+
signal.type === 'instrumentation'
113120
) {
114121
return null;
115122
} else {
116123
return signal;
117124
}
118125
}
119126
}
120-
const signalsPlugin = new SignalsPlugin({ middleware: [myMiddleware]})
127+
128+
const signalsPlugin = new SignalsPlugin({
129+
middleware: [
130+
new MyMiddleware()
131+
]
132+
})
121133
analytics.register(signalsPlugin)
122134
```
123135

0 commit comments

Comments
 (0)