@walkeros/web-destination-segment 4.1.0-next-1778668930820 → 4.1.0
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/CHANGELOG.md +153 -0
- package/README.md +27 -342
- 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.js +14 -52
- package/dist/examples/index.mjs +14 -52
- 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 +17 -17
- package/package.json +6 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# @walkeros/web-destination-segment
|
|
2
|
+
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e155ff8]
|
|
8
|
+
- Updated dependencies [e800974]
|
|
9
|
+
- Updated dependencies [e155ff8]
|
|
10
|
+
- Updated dependencies [1a8f2d7]
|
|
11
|
+
- Updated dependencies [1a8f2d7]
|
|
12
|
+
- Updated dependencies [b276173]
|
|
13
|
+
- Updated dependencies [dd9f5ad]
|
|
14
|
+
- Updated dependencies [c60ef35]
|
|
15
|
+
- Updated dependencies [adeebea]
|
|
16
|
+
- Updated dependencies [13aaeaa]
|
|
17
|
+
- Updated dependencies [e800974]
|
|
18
|
+
- Updated dependencies [adeebea]
|
|
19
|
+
- Updated dependencies [e800974]
|
|
20
|
+
- Updated dependencies [e800974]
|
|
21
|
+
- Updated dependencies [058f7ed]
|
|
22
|
+
- Updated dependencies [28a8ac2]
|
|
23
|
+
- Updated dependencies [fd6076e]
|
|
24
|
+
- @walkeros/core@4.1.0
|
|
25
|
+
- @walkeros/web-core@4.1.0
|
|
26
|
+
|
|
27
|
+
## 4.0.2
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- @walkeros/web-core@4.0.2
|
|
32
|
+
|
|
33
|
+
## 4.0.1
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- @walkeros/web-core@4.0.1
|
|
38
|
+
|
|
39
|
+
## 4.0.0
|
|
40
|
+
|
|
41
|
+
### Major Changes
|
|
42
|
+
|
|
43
|
+
- 93ea9c4: Event model v4: breaking changes to the `Event`, `Source`, and
|
|
44
|
+
`Entity` shapes.
|
|
45
|
+
- `event.id` is now a W3C span_id (16 lowercase hex chars), generated by the
|
|
46
|
+
collector. Reference: W3C Trace Context (W3C Recommendation, January 2020).
|
|
47
|
+
- `event.version`, `event.group`, `event.count` are removed.
|
|
48
|
+
- `source.type` is now the source kind (e.g. `browser`, `gtag`, `mcp`, `cli`).
|
|
49
|
+
New `source.platform` holds the runtime (`web` | `server` | `app` | ...).
|
|
50
|
+
- `source.id` and `source.previous_id` are removed.
|
|
51
|
+
- Browser source now sets `source.url` and `source.referrer`.
|
|
52
|
+
- MCP source sets `source.tool` per emission. CLI source sets
|
|
53
|
+
`source.command`.
|
|
54
|
+
- `Entity.nested` and `Entity.context` are now optional. Root `event.nested`
|
|
55
|
+
and `event.context` remain required.
|
|
56
|
+
- Each source self-registers via TypeScript module augmentation of `SourceMap`
|
|
57
|
+
in `@walkeros/core`.
|
|
58
|
+
- App-side coordination (`/workspaces/developer/app`) is a follow-up plan, not
|
|
59
|
+
part of this release. Telemetry from v4 CLI/MCP will not validate against
|
|
60
|
+
the existing app schema until that follow-up ships.
|
|
61
|
+
- `Mapping.Rule.skip` is renamed to `Mapping.Rule.silent`. Customer flow.json
|
|
62
|
+
configs using `skip: true` in mapping rules must rename to `silent: true`.
|
|
63
|
+
Hard cut: no legacy alias, the field is gone.
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- Updated dependencies [93ea9c4]
|
|
68
|
+
- @walkeros/web-core@4.0.0
|
|
69
|
+
|
|
70
|
+
## 3.4.2
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- @walkeros/web-core@3.4.2
|
|
75
|
+
|
|
76
|
+
## 3.4.1
|
|
77
|
+
|
|
78
|
+
### Patch Changes
|
|
79
|
+
|
|
80
|
+
- Updated dependencies [caea905]
|
|
81
|
+
- @walkeros/web-core@3.4.1
|
|
82
|
+
|
|
83
|
+
## 3.4.0
|
|
84
|
+
|
|
85
|
+
### Minor Changes
|
|
86
|
+
|
|
87
|
+
- 724f97e: Migrate every step example in every walkerOS package to the
|
|
88
|
+
standardized `[callable, ...args][]` shape introduced in `@walkeros/core`.
|
|
89
|
+
Every step example's `out` is now an array of effect tuples whose first
|
|
90
|
+
element is the callable's public SDK name (`'gtag'`, `'analytics.track'`,
|
|
91
|
+
`'fbq'`, `'dataLayer.push'`, `'sendServer'`, `'fetch'`, `'trackClient.track'`,
|
|
92
|
+
`'amplitude.track'`, `'fs.writeFile'`, `'producer.send'`, `'client.xadd'`,
|
|
93
|
+
`'client.send'`, `'dataset.table.insert'`, etc.). Source examples use `'elb'`
|
|
94
|
+
as the callable; transformer examples use the reserved `'return'` keyword;
|
|
95
|
+
store examples use store-operation callables (`'get'`, `'set'`). Tests capture
|
|
96
|
+
real calls on each component's spy and assert against `example.out` directly —
|
|
97
|
+
the hardcoded `PACKAGE_CALLS` registry in the app is no longer consulted
|
|
98
|
+
(emptied; plan #3 removes it structurally).
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- @walkeros/web-core@3.4.0
|
|
103
|
+
|
|
104
|
+
## 3.3.1
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- @walkeros/web-core@3.3.1
|
|
109
|
+
|
|
110
|
+
## 3.3.0
|
|
111
|
+
|
|
112
|
+
### Minor Changes
|
|
113
|
+
|
|
114
|
+
- 08c365a: Add Segment CDP web destination (`@walkeros/web-destination-segment`)
|
|
115
|
+
— forwards walkerOS events to Segment via the official
|
|
116
|
+
`@segment/analytics-next` (Analytics.js 2.0) package. Implements the full
|
|
117
|
+
Segment Spec surface with automatic walkerOS→Segment consent context
|
|
118
|
+
forwarding and deferred-load consent handling.
|
|
119
|
+
- Default event forwarding: every walkerOS event becomes
|
|
120
|
+
`analytics.track(name, properties)`
|
|
121
|
+
- Custom event properties: `settings.include` flattens walkerOS event sections
|
|
122
|
+
with prefix (`data_*`, `globals_*`, etc.) or use `mapping.data` for full
|
|
123
|
+
Segment-Spec-shaped properties
|
|
124
|
+
- Identity: destination-level + per-event `settings.identify` resolving to
|
|
125
|
+
`{ userId, traits, anonymousId }`. Runtime state diffing skips redundant
|
|
126
|
+
`identify()` calls.
|
|
127
|
+
- Groups: `settings.group` and per-event `mapping.settings.group` with
|
|
128
|
+
reserved Segment group trait names
|
|
129
|
+
- Page views: first-class `mapping.settings.page` →
|
|
130
|
+
`analytics.page(category, name, properties)` (explicit configuration, no
|
|
131
|
+
auto-detection)
|
|
132
|
+
- Reset: `settings.reset: true` calls `analytics.reset()` on logout
|
|
133
|
+
- Consent context forwarding: walkerOS consent state is automatically stamped
|
|
134
|
+
as `context.consent.categoryPreferences` on every track, identify, group,
|
|
135
|
+
and page call when `settings.consent` is configured, with optional key
|
|
136
|
+
remapping (e.g. walkerOS `marketing` → Segment `Advertising`)
|
|
137
|
+
- Deferred-load consent pattern: when `config.consent` is declared,
|
|
138
|
+
`AnalyticsBrowser.load()` is held until `on('consent')` fires with all
|
|
139
|
+
required keys granted
|
|
140
|
+
- Ecommerce: walkerOS `mapping.name` + `mapping.data` produce Segment Spec
|
|
141
|
+
event names (e.g. `Order Completed`) with a `products` array property — a
|
|
142
|
+
single `track()` call per order, not a loop
|
|
143
|
+
- SDK resolution follows the `env?.analytics ?? realSegment` pattern (mirrors
|
|
144
|
+
`@walkeros/web-destination-clarity`)
|
|
145
|
+
- Plugins, source middleware, and destination middleware are explicitly out of
|
|
146
|
+
scope for v1 (JavaScript functions cannot be serialized in JSON flow configs
|
|
147
|
+
— register them programmatically on the returned `AnalyticsBrowser` instance
|
|
148
|
+
if needed)
|
|
149
|
+
- `alias()` and `screen()` are intentionally deferred (legacy / mobile-only)
|
|
150
|
+
|
|
151
|
+
### Patch Changes
|
|
152
|
+
|
|
153
|
+
- @walkeros/web-core@3.3.0
|
package/README.md
CHANGED
|
@@ -4,361 +4,46 @@
|
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# @walkeros/web-destination-segment
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
•
|
|
11
|
-
[NPM Package](https://www.npmjs.com/package/@walkeros/web-destination-segment)
|
|
12
|
-
• [Documentation](https://www.walkeros.io/docs/destinations/web/segment)
|
|
13
|
-
|
|
14
|
-
This package forwards walkerOS events to [Segment](https://segment.com/) - the
|
|
15
|
-
customer data platform that routes your event data to 400+ downstream
|
|
16
|
-
destinations. Built on the official
|
|
17
|
-
[`@segment/analytics-next`](https://www.npmjs.com/package/@segment/analytics-next)
|
|
18
|
-
(Analytics.js 2.0) SDK.
|
|
19
|
-
|
|
20
|
-
walkerOS follows a **source → collector → destination** architecture. This
|
|
21
|
-
Segment destination receives processed events from the walkerOS collector and
|
|
22
|
-
forwards them via the full Segment Spec surface: `track`, `identify`, `group`,
|
|
23
|
-
`page`, and `reset`.
|
|
9
|
+
Segment CDP, routing events to 400+ downstream destinations.
|
|
24
10
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- **Custom event properties** - flatten walkerOS sections with
|
|
30
|
-
`settings.include` (`data_*`, `globals_*`, etc.) or produce fully-shaped
|
|
31
|
-
Segment Spec properties via `mapping.data`
|
|
32
|
-
- **Identity** - destination-level or per-event `settings.identify` resolving to
|
|
33
|
-
`{ userId, traits, anonymousId }`, with runtime state diffing so redundant
|
|
34
|
-
`identify()` calls are skipped
|
|
35
|
-
- **Groups** - `settings.group` with Segment-reserved group traits (`name`,
|
|
36
|
-
`industry`, `employees`, `plan`, ...)
|
|
37
|
-
- **Page views** - first-class `analytics.page(category, name, properties)` via
|
|
38
|
-
explicit `mapping.settings.page` configuration
|
|
39
|
-
- **Reset on logout** - `settings.reset: true` calls `analytics.reset()` so the
|
|
40
|
-
current user identity is cleared
|
|
41
|
-
- **Consent context forwarding** - walkerOS consent state is automatically
|
|
42
|
-
stamped as `context.consent.categoryPreferences` on every call, with optional
|
|
43
|
-
`settings.consent` key remapping
|
|
44
|
-
- **Deferred-load consent pattern** - when `config.consent` is declared,
|
|
45
|
-
`AnalyticsBrowser.load()` is held until the first grant
|
|
46
|
-
- **Ecommerce via the Segment Spec** - walkerOS `mapping.name` + `mapping.data`
|
|
47
|
-
produce PascalCase event names (`Order Completed`) with a `products` array, a
|
|
48
|
-
single `track()` call per order (no loop)
|
|
11
|
+
[Documentation](https://www.walkeros.io/docs/destinations/web/segment) •
|
|
12
|
+
[NPM Package](https://www.npmjs.com/package/@walkeros/web-destination-segment)
|
|
13
|
+
•
|
|
14
|
+
[Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/web/destinations/segment)
|
|
49
15
|
|
|
50
16
|
## Installation
|
|
51
17
|
|
|
52
|
-
```
|
|
18
|
+
```bash
|
|
53
19
|
npm install @walkeros/web-destination-segment
|
|
54
20
|
```
|
|
55
21
|
|
|
56
|
-
## Quick
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
import { startFlow } from '@walkeros/collector';
|
|
60
|
-
import { destinationSegment } from '@walkeros/web-destination-segment';
|
|
22
|
+
## Quick start
|
|
61
23
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"version": 4,
|
|
27
|
+
"flows": {
|
|
28
|
+
"default": {
|
|
29
|
+
"config": {
|
|
30
|
+
"platform": "web"
|
|
70
31
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
The `Settings` type extends Segment's `InitOptions`, so every passthrough option
|
|
81
|
-
(cookie, storage, integrations, plan, retryQueue, ...) works alongside the
|
|
82
|
-
walkerOS-specific fields listed below.
|
|
83
|
-
|
|
84
|
-
| Name | Type | Description | Required |
|
|
85
|
-
| -------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
86
|
-
| `apiKey` | `string` | Your Segment source write key - maps to `writeKey` in `AnalyticsBrowser.load()` | Yes |
|
|
87
|
-
| `identify` | `Mapping.Value` | Destination-level identity mapping resolving to `{ userId, traits, anonymousId }` | No |
|
|
88
|
-
| `group` | `Mapping.Value` | Destination-level group mapping resolving to `{ groupId, traits }` | No |
|
|
89
|
-
| `include` | `string[]` | walkerOS event sections to flatten into Segment `properties` (`data`, `globals`, `context`, `user`, `event`, `all`) | No |
|
|
90
|
-
| `consent` | `Record<string, string>` | Mapping from walkerOS consent keys → Segment `categoryPreferences` keys (e.g. `{ marketing: 'Advertising' }`) | No |
|
|
91
|
-
| `initialPageview` | `boolean` | Default `false` - walkerOS sources handle page tracking, so the SDK's auto pageview is disabled | No |
|
|
92
|
-
| `disableClientPersistence` | `boolean` | Disable all cookie / localStorage writes | No |
|
|
93
|
-
| `integrations` | `object` | Enable/disable downstream Segment destinations. Example: `{ All: true, Mixpanel: false }` | No |
|
|
94
|
-
|
|
95
|
-
### Mapping (`rule.settings`)
|
|
96
|
-
|
|
97
|
-
| Name | Type | Description |
|
|
98
|
-
| ---------- | ----------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
99
|
-
| `identify` | `Mapping.Value` | Per-event identity override; resolves to `{ userId, traits, anonymousId }` |
|
|
100
|
-
| `group` | `Mapping.Value` | Per-event group assignment; resolves to `{ groupId, traits }` |
|
|
101
|
-
| `page` | `Mapping.Value \| true` | Page call config. `true` → empty `analytics.page()`. Object resolves to `{ category?, name?, properties? }` |
|
|
102
|
-
| `reset` | `Mapping.Value \| true` | Logout trigger. Truthy → `analytics.reset()` |
|
|
103
|
-
| `include` | `string[]` | Override destination-level `include` for this rule |
|
|
104
|
-
|
|
105
|
-
Use `mapping.silent: true` to suppress the default `analytics.track()` call when
|
|
106
|
-
a rule runs identity / group / page side effects only.
|
|
107
|
-
|
|
108
|
-
## Event Properties
|
|
109
|
-
|
|
110
|
-
Two ways to shape Segment track properties:
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
// 1. Flatten walkerOS sections via settings.include
|
|
114
|
-
config: {
|
|
115
|
-
settings: {
|
|
116
|
-
apiKey: 'WRITE_KEY',
|
|
117
|
-
include: ['data', 'globals'], // → data_*, globals_* props on every event
|
|
118
|
-
},
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// 2. Build Segment-Spec-shaped properties via mapping.data
|
|
122
|
-
mapping: {
|
|
123
|
-
order: {
|
|
124
|
-
complete: {
|
|
125
|
-
name: 'Order Completed',
|
|
126
|
-
data: {
|
|
127
|
-
map: {
|
|
128
|
-
order_id: 'data.id',
|
|
129
|
-
currency: { key: 'data.currency', value: 'EUR' },
|
|
130
|
-
shipping: 'data.shipping',
|
|
131
|
-
tax: 'data.taxes',
|
|
132
|
-
total: 'data.total',
|
|
133
|
-
products: {
|
|
134
|
-
loop: [
|
|
135
|
-
'nested',
|
|
136
|
-
{
|
|
137
|
-
condition: (v) => typeof v?.data?.price === 'number',
|
|
138
|
-
map: {
|
|
139
|
-
product_id: 'data.id',
|
|
140
|
-
name: 'data.name',
|
|
141
|
-
price: 'data.price',
|
|
142
|
-
quantity: { key: 'data.quantity', value: 1 },
|
|
143
|
-
currency: { key: 'data.currency', value: 'EUR' },
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
The Segment Ecommerce Spec uses a **single**
|
|
156
|
-
`track('Order Completed', { products: [...] })` call - not a loop of N revenue
|
|
157
|
-
calls. walkerOS `mapping.data` with a nested `loop` over `nested` builds the
|
|
158
|
-
products array inline.
|
|
159
|
-
|
|
160
|
-
## Identity
|
|
161
|
-
|
|
162
|
-
Destination-level identity fires on every push (with state diffing to skip
|
|
163
|
-
redundant calls):
|
|
164
|
-
|
|
165
|
-
```typescript
|
|
166
|
-
config: {
|
|
167
|
-
settings: {
|
|
168
|
-
apiKey: 'WRITE_KEY',
|
|
169
|
-
identify: {
|
|
170
|
-
map: {
|
|
171
|
-
userId: 'user.id',
|
|
172
|
-
traits: {
|
|
173
|
-
map: {
|
|
174
|
-
email: 'user.email',
|
|
175
|
-
name: 'user.name',
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
},
|
|
32
|
+
"destinations": {
|
|
33
|
+
"segment": {
|
|
34
|
+
"package": "@walkeros/web-destination-segment",
|
|
35
|
+
"config": {}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
181
40
|
}
|
|
182
41
|
```
|
|
183
42
|
|
|
184
|
-
|
|
185
|
-
side effect runs (not a default `track()`):
|
|
186
|
-
|
|
187
|
-
```typescript
|
|
188
|
-
mapping: {
|
|
189
|
-
user: {
|
|
190
|
-
login: {
|
|
191
|
-
silent: true,
|
|
192
|
-
settings: {
|
|
193
|
-
identify: {
|
|
194
|
-
map: {
|
|
195
|
-
userId: 'data.user_id',
|
|
196
|
-
traits: {
|
|
197
|
-
map: {
|
|
198
|
-
email: 'data.email',
|
|
199
|
-
plan: 'data.plan',
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Reserved Traits (Segment Spec)
|
|
211
|
-
|
|
212
|
-
Use these trait names so downstream destinations recognize them: `email`,
|
|
213
|
-
`name`, `firstName`, `lastName`, `phone`, `avatar`, `birthday`, `plan`,
|
|
214
|
-
`company`, `createdAt`, `title`, `username`, `gender`, `age`.
|
|
215
|
-
|
|
216
|
-
## Groups
|
|
217
|
-
|
|
218
|
-
```typescript
|
|
219
|
-
mapping: {
|
|
220
|
-
company: {
|
|
221
|
-
update: {
|
|
222
|
-
silent: true,
|
|
223
|
-
settings: {
|
|
224
|
-
group: {
|
|
225
|
-
map: {
|
|
226
|
-
groupId: 'data.company_id',
|
|
227
|
-
traits: {
|
|
228
|
-
map: {
|
|
229
|
-
name: 'data.company_name',
|
|
230
|
-
industry: 'data.industry',
|
|
231
|
-
employees: 'data.employees',
|
|
232
|
-
plan: 'data.plan',
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
}
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
Reserved Segment group traits: `name`, `industry`, `employees`, `plan`,
|
|
244
|
-
`createdAt`, `description`, `email`, `website`.
|
|
245
|
-
|
|
246
|
-
## Page Views
|
|
247
|
-
|
|
248
|
-
Segment's `page()` is first-class - walkerOS `page view` events should map to
|
|
249
|
-
`analytics.page()`, not `analytics.track('page view')`. Configure explicitly via
|
|
250
|
-
`mapping.settings.page`:
|
|
251
|
-
|
|
252
|
-
```typescript
|
|
253
|
-
mapping: {
|
|
254
|
-
page: {
|
|
255
|
-
view: {
|
|
256
|
-
silent: true,
|
|
257
|
-
settings: {
|
|
258
|
-
page: {
|
|
259
|
-
map: {
|
|
260
|
-
category: 'data.category',
|
|
261
|
-
name: 'data.title',
|
|
262
|
-
properties: {
|
|
263
|
-
map: {
|
|
264
|
-
section: 'data.section',
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
},
|
|
268
|
-
},
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
}
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
Or the minimal form (`true`) that fires an empty `analytics.page()` and relies
|
|
276
|
-
on the SDK's automatic url/path/referrer/title collection:
|
|
277
|
-
|
|
278
|
-
```typescript
|
|
279
|
-
mapping: {
|
|
280
|
-
page: {
|
|
281
|
-
view: {
|
|
282
|
-
silent: true,
|
|
283
|
-
settings: {
|
|
284
|
-
page: true,
|
|
285
|
-
},
|
|
286
|
-
},
|
|
287
|
-
},
|
|
288
|
-
}
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
## Consent
|
|
292
|
-
|
|
293
|
-
The destination supports two complementary consent mechanisms:
|
|
294
|
-
|
|
295
|
-
**Automatic context forwarding.** When `settings.consent` is configured, the
|
|
296
|
-
destination stamps every `track`, `identify`, `group`, and `page` call with
|
|
297
|
-
`context.consent.categoryPreferences`:
|
|
298
|
-
|
|
299
|
-
```typescript
|
|
300
|
-
config: {
|
|
301
|
-
settings: {
|
|
302
|
-
apiKey: 'WRITE_KEY',
|
|
303
|
-
consent: {
|
|
304
|
-
analytics: 'Analytics',
|
|
305
|
-
marketing: 'Advertising',
|
|
306
|
-
},
|
|
307
|
-
},
|
|
308
|
-
}
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
When the walker emits an event with
|
|
312
|
-
`consent: { analytics: true, marketing: true }`, the destination calls
|
|
313
|
-
`analytics.track(name, props, { context: { consent: { categoryPreferences: { Analytics: true, Advertising: true } } } })`.
|
|
314
|
-
|
|
315
|
-
**Deferred-load consent pattern.** When `config.consent` is declared,
|
|
316
|
-
`AnalyticsBrowser.load()` is held until the first `walker consent` command that
|
|
317
|
-
grants all required keys. Once granted, the SDK loads and all queued events
|
|
318
|
-
flush:
|
|
319
|
-
|
|
320
|
-
```typescript
|
|
321
|
-
destinations: {
|
|
322
|
-
segment: {
|
|
323
|
-
code: destinationSegment,
|
|
324
|
-
config: {
|
|
325
|
-
consent: { analytics: true },
|
|
326
|
-
settings: { apiKey: 'WRITE_KEY' },
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
}
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
This is the primary consent mechanism for Segment, since Segment's SDK has no
|
|
333
|
-
`optOut()` method - the only way to enforce consent is to avoid loading the SDK
|
|
334
|
-
in the first place.
|
|
335
|
-
|
|
336
|
-
## Reset (Logout)
|
|
337
|
-
|
|
338
|
-
```typescript
|
|
339
|
-
mapping: {
|
|
340
|
-
user: {
|
|
341
|
-
logout: {
|
|
342
|
-
silent: true,
|
|
343
|
-
settings: {
|
|
344
|
-
reset: true,
|
|
345
|
-
},
|
|
346
|
-
},
|
|
347
|
-
},
|
|
348
|
-
}
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
`analytics.reset()` clears the stored `userId`, `anonymousId`, and traits, then
|
|
352
|
-
generates a fresh anonymous ID.
|
|
353
|
-
|
|
354
|
-
## Scope Notes
|
|
43
|
+
## Documentation
|
|
355
44
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
Segment Profiles); `screen()` is mobile-only.
|
|
359
|
-
- **Plugins, source middleware, and destination middleware** cannot be
|
|
360
|
-
serialized in JSON flow configs. Register them programmatically on the
|
|
361
|
-
returned `AnalyticsBrowser` instance if needed.
|
|
45
|
+
Full configuration, mapping, and examples live in the docs:
|
|
46
|
+
**https://www.walkeros.io/docs/destinations/web/segment**
|
|
362
47
|
|
|
363
48
|
## Contribute
|
|
364
49
|
|
|
@@ -369,4 +54,4 @@ Feel free to contribute by submitting an
|
|
|
369
54
|
|
|
370
55
|
## License
|
|
371
56
|
|
|
372
|
-
|
|
57
|
+
MIT
|