@walkeros/web-destination-segment 3.4.1 → 4.0.0-next-1777463920154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -23
- package/dist/dev.d.mts +13 -13
- package/dist/dev.d.ts +13 -13
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +13 -13
- package/dist/examples/index.d.ts +13 -13
- package/dist/examples/index.js +37 -32
- package/dist/examples/index.mjs +37 -32
- package/dist/index.browser.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/walkerOS.json +52 -199
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
[NPM Package](https://www.npmjs.com/package/@walkeros/web-destination-segment)
|
|
12
12
|
• [Documentation](https://www.walkeros.io/docs/destinations/web/segment)
|
|
13
13
|
|
|
14
|
-
This package forwards walkerOS events to [Segment](https://segment.com/)
|
|
14
|
+
This package forwards walkerOS events to [Segment](https://segment.com/) - the
|
|
15
15
|
customer data platform that routes your event data to 400+ downstream
|
|
16
16
|
destinations. Built on the official
|
|
17
17
|
[`@segment/analytics-next`](https://www.npmjs.com/package/@segment/analytics-next)
|
|
@@ -24,26 +24,26 @@ forwards them via the full Segment Spec surface: `track`, `identify`, `group`,
|
|
|
24
24
|
|
|
25
25
|
## Features
|
|
26
26
|
|
|
27
|
-
- **Default event forwarding**
|
|
27
|
+
- **Default event forwarding** - every walkerOS event becomes
|
|
28
28
|
`analytics.track(name, properties)` with no additional config
|
|
29
|
-
- **Custom event properties**
|
|
29
|
+
- **Custom event properties** - flatten walkerOS sections with
|
|
30
30
|
`settings.include` (`data_*`, `globals_*`, etc.) or produce fully-shaped
|
|
31
31
|
Segment Spec properties via `mapping.data`
|
|
32
|
-
- **Identity**
|
|
32
|
+
- **Identity** - destination-level or per-event `settings.identify` resolving to
|
|
33
33
|
`{ userId, traits, anonymousId }`, with runtime state diffing so redundant
|
|
34
34
|
`identify()` calls are skipped
|
|
35
|
-
- **Groups**
|
|
35
|
+
- **Groups** - `settings.group` with Segment-reserved group traits (`name`,
|
|
36
36
|
`industry`, `employees`, `plan`, ...)
|
|
37
|
-
- **Page views**
|
|
37
|
+
- **Page views** - first-class `analytics.page(category, name, properties)` via
|
|
38
38
|
explicit `mapping.settings.page` configuration
|
|
39
|
-
- **Reset on logout**
|
|
39
|
+
- **Reset on logout** - `settings.reset: true` calls `analytics.reset()` so the
|
|
40
40
|
current user identity is cleared
|
|
41
|
-
- **Consent context forwarding**
|
|
41
|
+
- **Consent context forwarding** - walkerOS consent state is automatically
|
|
42
42
|
stamped as `context.consent.categoryPreferences` on every call, with optional
|
|
43
43
|
`settings.consent` key remapping
|
|
44
|
-
- **Deferred-load consent pattern**
|
|
44
|
+
- **Deferred-load consent pattern** - when `config.consent` is declared,
|
|
45
45
|
`AnalyticsBrowser.load()` is held until the first grant
|
|
46
|
-
- **Ecommerce via the Segment Spec**
|
|
46
|
+
- **Ecommerce via the Segment Spec** - walkerOS `mapping.name` + `mapping.data`
|
|
47
47
|
produce PascalCase event names (`Order Completed`) with a `products` array, a
|
|
48
48
|
single `track()` call per order (no loop)
|
|
49
49
|
|
|
@@ -83,12 +83,12 @@ walkerOS-specific fields listed below.
|
|
|
83
83
|
|
|
84
84
|
| Name | Type | Description | Required |
|
|
85
85
|
| -------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
86
|
-
| `apiKey` | `string` | Your Segment source write key
|
|
86
|
+
| `apiKey` | `string` | Your Segment source write key - maps to `writeKey` in `AnalyticsBrowser.load()` | Yes |
|
|
87
87
|
| `identify` | `Mapping.Value` | Destination-level identity mapping resolving to `{ userId, traits, anonymousId }` | No |
|
|
88
88
|
| `group` | `Mapping.Value` | Destination-level group mapping resolving to `{ groupId, traits }` | No |
|
|
89
89
|
| `include` | `string[]` | walkerOS event sections to flatten into Segment `properties` (`data`, `globals`, `context`, `user`, `event`, `all`) | No |
|
|
90
90
|
| `consent` | `Record<string, string>` | Mapping from walkerOS consent keys → Segment `categoryPreferences` keys (e.g. `{ marketing: 'Advertising' }`) | No |
|
|
91
|
-
| `initialPageview` | `boolean` | Default `false`
|
|
91
|
+
| `initialPageview` | `boolean` | Default `false` - walkerOS sources handle page tracking, so the SDK's auto pageview is disabled | No |
|
|
92
92
|
| `disableClientPersistence` | `boolean` | Disable all cookie / localStorage writes | No |
|
|
93
93
|
| `integrations` | `object` | Enable/disable downstream Segment destinations. Example: `{ All: true, Mixpanel: false }` | No |
|
|
94
94
|
|
|
@@ -102,8 +102,8 @@ walkerOS-specific fields listed below.
|
|
|
102
102
|
| `reset` | `Mapping.Value \| true` | Logout trigger. Truthy → `analytics.reset()` |
|
|
103
103
|
| `include` | `string[]` | Override destination-level `include` for this rule |
|
|
104
104
|
|
|
105
|
-
Use `mapping.
|
|
106
|
-
rule runs identity / group / page side effects only.
|
|
105
|
+
Use `mapping.silent: true` to suppress the default `analytics.track()` call when
|
|
106
|
+
a rule runs identity / group / page side effects only.
|
|
107
107
|
|
|
108
108
|
## Event Properties
|
|
109
109
|
|
|
@@ -153,7 +153,7 @@ mapping: {
|
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
The Segment Ecommerce Spec uses a **single**
|
|
156
|
-
`track('Order Completed', { products: [...] })` call
|
|
156
|
+
`track('Order Completed', { products: [...] })` call - not a loop of N revenue
|
|
157
157
|
calls. walkerOS `mapping.data` with a nested `loop` over `nested` builds the
|
|
158
158
|
products array inline.
|
|
159
159
|
|
|
@@ -181,14 +181,14 @@ config: {
|
|
|
181
181
|
}
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
Per-event identity uses a mapping rule with `
|
|
184
|
+
Per-event identity uses a mapping rule with `silent: true` so only the identity
|
|
185
185
|
side effect runs (not a default `track()`):
|
|
186
186
|
|
|
187
187
|
```typescript
|
|
188
188
|
mapping: {
|
|
189
189
|
user: {
|
|
190
190
|
login: {
|
|
191
|
-
|
|
191
|
+
silent: true,
|
|
192
192
|
settings: {
|
|
193
193
|
identify: {
|
|
194
194
|
map: {
|
|
@@ -219,7 +219,7 @@ Use these trait names so downstream destinations recognize them: `email`,
|
|
|
219
219
|
mapping: {
|
|
220
220
|
company: {
|
|
221
221
|
update: {
|
|
222
|
-
|
|
222
|
+
silent: true,
|
|
223
223
|
settings: {
|
|
224
224
|
group: {
|
|
225
225
|
map: {
|
|
@@ -245,7 +245,7 @@ Reserved Segment group traits: `name`, `industry`, `employees`, `plan`,
|
|
|
245
245
|
|
|
246
246
|
## Page Views
|
|
247
247
|
|
|
248
|
-
Segment's `page()` is first-class
|
|
248
|
+
Segment's `page()` is first-class - walkerOS `page view` events should map to
|
|
249
249
|
`analytics.page()`, not `analytics.track('page view')`. Configure explicitly via
|
|
250
250
|
`mapping.settings.page`:
|
|
251
251
|
|
|
@@ -253,7 +253,7 @@ Segment's `page()` is first-class — walkerOS `page view` events should map to
|
|
|
253
253
|
mapping: {
|
|
254
254
|
page: {
|
|
255
255
|
view: {
|
|
256
|
-
|
|
256
|
+
silent: true,
|
|
257
257
|
settings: {
|
|
258
258
|
page: {
|
|
259
259
|
map: {
|
|
@@ -279,7 +279,7 @@ on the SDK's automatic url/path/referrer/title collection:
|
|
|
279
279
|
mapping: {
|
|
280
280
|
page: {
|
|
281
281
|
view: {
|
|
282
|
-
|
|
282
|
+
silent: true,
|
|
283
283
|
settings: {
|
|
284
284
|
page: true,
|
|
285
285
|
},
|
|
@@ -330,7 +330,7 @@ destinations: {
|
|
|
330
330
|
```
|
|
331
331
|
|
|
332
332
|
This is the primary consent mechanism for Segment, since Segment's SDK has no
|
|
333
|
-
`optOut()` method
|
|
333
|
+
`optOut()` method - the only way to enforce consent is to avoid loading the SDK
|
|
334
334
|
in the first place.
|
|
335
335
|
|
|
336
336
|
## Reset (Logout)
|
|
@@ -339,7 +339,7 @@ in the first place.
|
|
|
339
339
|
mapping: {
|
|
340
340
|
user: {
|
|
341
341
|
logout: {
|
|
342
|
-
|
|
342
|
+
silent: true,
|
|
343
343
|
settings: {
|
|
344
344
|
reset: true,
|
|
345
345
|
},
|
package/dist/dev.d.mts
CHANGED
|
@@ -162,13 +162,13 @@ type SegmentStepExample = Flow.StepExample & {
|
|
|
162
162
|
*/
|
|
163
163
|
declare const init: Flow.StepExample;
|
|
164
164
|
/**
|
|
165
|
-
* Default event forwarding
|
|
165
|
+
* Default event forwarding - every walkerOS event becomes
|
|
166
166
|
* analytics.track(event.name, properties). With no mapping and no
|
|
167
167
|
* destination-level include, properties is `{}`.
|
|
168
168
|
*/
|
|
169
169
|
declare const defaultEventForwarding: SegmentStepExample;
|
|
170
170
|
/**
|
|
171
|
-
* Wildcard ignore
|
|
171
|
+
* Wildcard ignore - walkerOS's standard way to drop events. The rule
|
|
172
172
|
* matches but does nothing. The destination fires zero SDK calls.
|
|
173
173
|
*/
|
|
174
174
|
declare const wildcardIgnored: SegmentStepExample;
|
|
@@ -191,48 +191,48 @@ declare const ruleIncludeReplaces: SegmentStepExample;
|
|
|
191
191
|
*/
|
|
192
192
|
declare const destinationLevelIdentify: SegmentStepExample;
|
|
193
193
|
/**
|
|
194
|
-
* Per-event identify with traits
|
|
195
|
-
*
|
|
194
|
+
* Per-event identify with traits - the canonical "user login" pattern.
|
|
195
|
+
* silent: true suppresses the default analytics.track() call because we're
|
|
196
196
|
* running identity side effects only. Matches Segment Spec reserved traits
|
|
197
197
|
* (email, name, plan, company) so downstream destinations recognize them.
|
|
198
198
|
*/
|
|
199
199
|
declare const userLoginIdentify: SegmentStepExample;
|
|
200
200
|
/**
|
|
201
|
-
* Profile update
|
|
201
|
+
* Profile update - omit userId. Segment's SDK uses the currently stored
|
|
202
202
|
* userId and merges the traits into the existing trait set.
|
|
203
203
|
*/
|
|
204
204
|
declare const profileUpdateTraitsOnly: SegmentStepExample;
|
|
205
205
|
/**
|
|
206
|
-
* User logout
|
|
206
|
+
* User logout - reset: true fires analytics.reset(), which clears userId,
|
|
207
207
|
* anonymousId, traits, and generates a new anonymous ID.
|
|
208
|
-
*
|
|
208
|
+
* silent: true because we're only running the reset side effect.
|
|
209
209
|
*/
|
|
210
210
|
declare const userLogoutReset: SegmentStepExample;
|
|
211
211
|
/**
|
|
212
|
-
* Per-event group assignment
|
|
212
|
+
* Per-event group assignment - company update event attaches the user
|
|
213
213
|
* to a company and sets the company's traits in one call.
|
|
214
214
|
*/
|
|
215
215
|
declare const companyUpdateGroup: SegmentStepExample;
|
|
216
216
|
/**
|
|
217
|
-
* Explicit page() call
|
|
218
|
-
*
|
|
217
|
+
* Explicit page() call - the canonical Segment pattern for page views.
|
|
218
|
+
* silent: true suppresses the default track() call; settings.page fires
|
|
219
219
|
* analytics.page(category, name, properties) instead.
|
|
220
220
|
*/
|
|
221
221
|
declare const pageViewAsPage: SegmentStepExample;
|
|
222
222
|
/**
|
|
223
|
-
* Minimal page() call
|
|
223
|
+
* Minimal page() call - settings.page: true produces an empty
|
|
224
224
|
* analytics.page() relying entirely on SDK auto-collection.
|
|
225
225
|
*/
|
|
226
226
|
declare const pageViewMinimal: SegmentStepExample;
|
|
227
227
|
/**
|
|
228
|
-
* Segment ecommerce spec
|
|
228
|
+
* Segment ecommerce spec - Order Completed event. One track() call with
|
|
229
229
|
* a products array. Uses mapping.name to produce the Segment Spec name
|
|
230
230
|
* and mapping.data to build the properties object including the nested
|
|
231
231
|
* products loop. The loop filters via condition to products with prices.
|
|
232
232
|
*/
|
|
233
233
|
declare const orderCompletedEcommerce: SegmentStepExample;
|
|
234
234
|
/**
|
|
235
|
-
* Consent context forwarding
|
|
235
|
+
* Consent context forwarding - when the event has consent state,
|
|
236
236
|
* the destination automatically stamps every track/identify/group/page
|
|
237
237
|
* call with context.consent.categoryPreferences. settings.consent
|
|
238
238
|
* remaps walkerOS keys to Segment category names.
|
package/dist/dev.d.ts
CHANGED
|
@@ -162,13 +162,13 @@ type SegmentStepExample = Flow.StepExample & {
|
|
|
162
162
|
*/
|
|
163
163
|
declare const init: Flow.StepExample;
|
|
164
164
|
/**
|
|
165
|
-
* Default event forwarding
|
|
165
|
+
* Default event forwarding - every walkerOS event becomes
|
|
166
166
|
* analytics.track(event.name, properties). With no mapping and no
|
|
167
167
|
* destination-level include, properties is `{}`.
|
|
168
168
|
*/
|
|
169
169
|
declare const defaultEventForwarding: SegmentStepExample;
|
|
170
170
|
/**
|
|
171
|
-
* Wildcard ignore
|
|
171
|
+
* Wildcard ignore - walkerOS's standard way to drop events. The rule
|
|
172
172
|
* matches but does nothing. The destination fires zero SDK calls.
|
|
173
173
|
*/
|
|
174
174
|
declare const wildcardIgnored: SegmentStepExample;
|
|
@@ -191,48 +191,48 @@ declare const ruleIncludeReplaces: SegmentStepExample;
|
|
|
191
191
|
*/
|
|
192
192
|
declare const destinationLevelIdentify: SegmentStepExample;
|
|
193
193
|
/**
|
|
194
|
-
* Per-event identify with traits
|
|
195
|
-
*
|
|
194
|
+
* Per-event identify with traits - the canonical "user login" pattern.
|
|
195
|
+
* silent: true suppresses the default analytics.track() call because we're
|
|
196
196
|
* running identity side effects only. Matches Segment Spec reserved traits
|
|
197
197
|
* (email, name, plan, company) so downstream destinations recognize them.
|
|
198
198
|
*/
|
|
199
199
|
declare const userLoginIdentify: SegmentStepExample;
|
|
200
200
|
/**
|
|
201
|
-
* Profile update
|
|
201
|
+
* Profile update - omit userId. Segment's SDK uses the currently stored
|
|
202
202
|
* userId and merges the traits into the existing trait set.
|
|
203
203
|
*/
|
|
204
204
|
declare const profileUpdateTraitsOnly: SegmentStepExample;
|
|
205
205
|
/**
|
|
206
|
-
* User logout
|
|
206
|
+
* User logout - reset: true fires analytics.reset(), which clears userId,
|
|
207
207
|
* anonymousId, traits, and generates a new anonymous ID.
|
|
208
|
-
*
|
|
208
|
+
* silent: true because we're only running the reset side effect.
|
|
209
209
|
*/
|
|
210
210
|
declare const userLogoutReset: SegmentStepExample;
|
|
211
211
|
/**
|
|
212
|
-
* Per-event group assignment
|
|
212
|
+
* Per-event group assignment - company update event attaches the user
|
|
213
213
|
* to a company and sets the company's traits in one call.
|
|
214
214
|
*/
|
|
215
215
|
declare const companyUpdateGroup: SegmentStepExample;
|
|
216
216
|
/**
|
|
217
|
-
* Explicit page() call
|
|
218
|
-
*
|
|
217
|
+
* Explicit page() call - the canonical Segment pattern for page views.
|
|
218
|
+
* silent: true suppresses the default track() call; settings.page fires
|
|
219
219
|
* analytics.page(category, name, properties) instead.
|
|
220
220
|
*/
|
|
221
221
|
declare const pageViewAsPage: SegmentStepExample;
|
|
222
222
|
/**
|
|
223
|
-
* Minimal page() call
|
|
223
|
+
* Minimal page() call - settings.page: true produces an empty
|
|
224
224
|
* analytics.page() relying entirely on SDK auto-collection.
|
|
225
225
|
*/
|
|
226
226
|
declare const pageViewMinimal: SegmentStepExample;
|
|
227
227
|
/**
|
|
228
|
-
* Segment ecommerce spec
|
|
228
|
+
* Segment ecommerce spec - Order Completed event. One track() call with
|
|
229
229
|
* a products array. Uses mapping.name to produce the Segment Spec name
|
|
230
230
|
* and mapping.data to build the properties object including the nested
|
|
231
231
|
* products loop. The loop filters via condition to products with prices.
|
|
232
232
|
*/
|
|
233
233
|
declare const orderCompletedEcommerce: SegmentStepExample;
|
|
234
234
|
/**
|
|
235
|
-
* Consent context forwarding
|
|
235
|
+
* Consent context forwarding - when the event has consent state,
|
|
236
236
|
* the destination automatically stamps every track/identify/group/page
|
|
237
237
|
* call with context.consent.categoryPreferences. settings.consent
|
|
238
238
|
* remaps walkerOS keys to Segment category names.
|