File tree Expand file tree Collapse file tree 1 file changed +29
-9
lines changed Expand file tree Collapse file tree 1 file changed +29
-9
lines changed Original file line number Diff line number Diff line change 66See: [ settings.ts] ( src/types/settings.ts )
77
88## Quick start
9+
10+ ## Snippet Users
11+ ``` html
12+ <!-- Load SignalsPlugin -->
13+ <script src =" https://cdn.jsdelivr.net/npm/@segment/analytics-signals@latest/dist/umd/analytics-signals.umd.js" ></script >
14+
15+ <!-- Load Segment (copy snippet from app.segment.com) -->
16+ <script >
17+ ! function (){var i= " analytics" ,analytics= window [i]... .
18+ analytics .load (" <YOUR_WRITE_KEY>" );
19+ analytics .page ();
20+ }}();
21+ </script >
22+
23+ <!-- Register SignalsPlugin -->
24+ <script >
25+ const signalsPlugin = new SignalsPlugin ()
26+ analytics .register (signalsPlugin)
27+ </script >
28+ ```
29+
30+ ## NPM Users
931### Installation
1032``` bash
1133# npm
@@ -30,7 +52,13 @@ analytics.load({
3052})
3153
3254```
33-
55+ ### Extending / Emitting Custom Signals
56+ ``` ts
57+ signalsPlugin .addSignal ({
58+ type: ' userDefined' ,
59+ data: { foo: ' bar' }
60+ })
61+ ```
3462
3563### Debugging
3664#### Enable debug mode
@@ -52,14 +80,6 @@ const signalsPlugin = new SignalsPlugin()
5280signalsPlugin .onSignal ((signal ) => console .log (signal ))
5381```
5482
55- ### Emitting Signals
56- ``` ts
57- const signalsPlugin = new SignalsPlugin ()
58- signalsPlugin .addSignal ({
59- type: ' userDefined' ,
60- data: { foo: ' bar' }
61- })
62- ```
6383
6484### Playground / Development / Testing
6585See the [ signals example repo] ( ../signals-example ) .
You can’t perform that action at this time.
0 commit comments