@walkeros/web-destination-posthog 3.4.2 → 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 +33 -32
- package/dist/dev.d.mts +10 -10
- package/dist/dev.d.ts +10 -10
- 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 +10 -10
- package/dist/examples/index.d.ts +10 -10
- package/dist/examples/index.js +31 -26
- package/dist/examples/index.mjs +31 -26
- 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 +37 -149
- 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-posthog)
|
|
12
12
|
• [Documentation](https://www.walkeros.io/docs/destinations/web/posthog)
|
|
13
13
|
|
|
14
|
-
This package forwards walkerOS events to [PostHog](https://posthog.com/)
|
|
14
|
+
This package forwards walkerOS events to [PostHog](https://posthog.com/) -
|
|
15
15
|
product analytics, session replay, feature flags, surveys, and heatmaps. Built
|
|
16
16
|
on the official [`posthog-js`](https://www.npmjs.com/package/posthog-js) SDK.
|
|
17
17
|
|
|
@@ -19,28 +19,28 @@ walkerOS follows a **source → collector → destination** architecture. This
|
|
|
19
19
|
PostHog destination receives processed events from the walkerOS collector and
|
|
20
20
|
forwards them as PostHog captures, identifies, group assignments, and consent
|
|
21
21
|
updates. All built-in PostHog features (session replay, feature flags, surveys,
|
|
22
|
-
heatmaps, exception capture) are available through SDK init passthrough
|
|
22
|
+
heatmaps, exception capture) are available through SDK init passthrough - no
|
|
23
23
|
destination-specific plugins required.
|
|
24
24
|
|
|
25
25
|
## Features
|
|
26
26
|
|
|
27
|
-
- **Default event forwarding**
|
|
27
|
+
- **Default event forwarding** - every walkerOS event becomes
|
|
28
28
|
`posthog.capture(event.name, properties)` with no additional config
|
|
29
|
-
- **Custom event properties**
|
|
29
|
+
- **Custom event properties** - flatten walkerOS event sections via
|
|
30
30
|
`settings.include` (prefixed as `data_*`, `globals_*`, etc.)
|
|
31
|
-
- **Identity**
|
|
31
|
+
- **Identity** - destination-level and per-event identity mapping resolving to
|
|
32
32
|
`{ distinctId?, $set?, $set_once? }`. With `distinctId`: `posthog.identify()`.
|
|
33
33
|
Without `distinctId`: `posthog.setPersonProperties()` for pure person-property
|
|
34
34
|
updates. Runtime state diffing skips redundant identify calls when the
|
|
35
35
|
resolved values have not changed.
|
|
36
|
-
- **Groups**
|
|
36
|
+
- **Groups** - B2B-style group analytics via `settings.group`; resolves to
|
|
37
37
|
`{ type, key, properties? }` and calls `posthog.group(...)`
|
|
38
|
-
- **Logout**
|
|
38
|
+
- **Logout** - `reset: true` triggers `posthog.reset()` to clear the distinct ID
|
|
39
39
|
and regenerate an anonymous one
|
|
40
|
-
- **Consent**
|
|
40
|
+
- **Consent** - declares required consent keys via `config.consent`; a
|
|
41
41
|
`walker consent` event with all required keys granted calls
|
|
42
42
|
`posthog.opt_in_capturing()`, otherwise `posthog.opt_out_capturing()`
|
|
43
|
-
- **Built-in PostHog features as config passthrough**
|
|
43
|
+
- **Built-in PostHog features as config passthrough** - session replay
|
|
44
44
|
(`session_recording`), feature flags (`bootstrap`, `advanced_disable_flags`),
|
|
45
45
|
surveys (`disable_surveys`), heatmaps (`capture_heatmaps`), exception capture
|
|
46
46
|
(`capture_exceptions`), cookieless mode (`cookieless_mode`). All
|
|
@@ -89,17 +89,17 @@ All other [`PostHogConfig`](https://posthog.com/docs/libraries/js#config) fields
|
|
|
89
89
|
(e.g. `session_recording`, `capture_heatmaps`, `bootstrap`, `cookieless_mode`)
|
|
90
90
|
pass through unchanged. walkerOS sets three defaults that differ from PostHog's
|
|
91
91
|
built-ins: `autocapture: false`, `capture_pageview: false`,
|
|
92
|
-
`capture_pageleave: false`
|
|
92
|
+
`capture_pageleave: false` - because walkerOS sources handle event capture.
|
|
93
93
|
Override them explicitly in `settings` if you want PostHog's autocapture on.
|
|
94
94
|
|
|
95
95
|
### Mapping (`rule.settings`)
|
|
96
96
|
|
|
97
|
-
| Name | Type | Description
|
|
98
|
-
| ---------- | -------------------------- |
|
|
99
|
-
| `identify` | `Mapping.Value` | Per-event identity. Resolves to `{ distinctId?, $set?, $set_once? }`
|
|
100
|
-
| `include` | `string[]` | Override destination-level `include` for this rule
|
|
101
|
-
| `group` | `Mapping.Value` | Per-event group assignment. Resolves to `{ type, key, properties? }`
|
|
102
|
-
| `reset` | `Mapping.Value \| boolean` | Logout trigger. Truthy value → `posthog.reset()`. Typically paired with `
|
|
97
|
+
| Name | Type | Description |
|
|
98
|
+
| ---------- | -------------------------- | --------------------------------------------------------------------------------------- |
|
|
99
|
+
| `identify` | `Mapping.Value` | Per-event identity. Resolves to `{ distinctId?, $set?, $set_once? }` |
|
|
100
|
+
| `include` | `string[]` | Override destination-level `include` for this rule |
|
|
101
|
+
| `group` | `Mapping.Value` | Per-event group assignment. Resolves to `{ type, key, properties? }` |
|
|
102
|
+
| `reset` | `Mapping.Value \| boolean` | Logout trigger. Truthy value → `posthog.reset()`. Typically paired with `silent: true`. |
|
|
103
103
|
|
|
104
104
|
## Custom Event Properties
|
|
105
105
|
|
|
@@ -126,7 +126,7 @@ mapping: {
|
|
|
126
126
|
}
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
PostHog has no dedicated revenue API
|
|
129
|
+
PostHog has no dedicated revenue API - revenue events are regular `capture()`
|
|
130
130
|
calls with the revenue properties in the payload. Use `include: ['data']` on an
|
|
131
131
|
`order complete` rule to forward `data_total`, `data_currency` (e.g. `"EUR"`),
|
|
132
132
|
`data_shipping`, etc.
|
|
@@ -147,7 +147,7 @@ settings: {
|
|
|
147
147
|
}
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
Per-event identify supports the full PostHog vocabulary
|
|
150
|
+
Per-event identify supports the full PostHog vocabulary - `distinctId`, `$set`
|
|
151
151
|
(person properties), `$set_once` (set-if-unset person properties). The
|
|
152
152
|
destination calls `posthog.identify(distinctId, $set, $set_once)`:
|
|
153
153
|
|
|
@@ -155,7 +155,7 @@ destination calls `posthog.identify(distinctId, $set, $set_once)`:
|
|
|
155
155
|
mapping: {
|
|
156
156
|
user: {
|
|
157
157
|
login: {
|
|
158
|
-
|
|
158
|
+
silent: true, // side-effect only, no capture() for user login
|
|
159
159
|
settings: {
|
|
160
160
|
identify: {
|
|
161
161
|
map: {
|
|
@@ -179,7 +179,7 @@ mapping: {
|
|
|
179
179
|
|
|
180
180
|
**Person properties without identity change.** When the resolved identify object
|
|
181
181
|
has no `distinctId`, the destination calls
|
|
182
|
-
`posthog.setPersonProperties($set, $set_once)` instead
|
|
182
|
+
`posthog.setPersonProperties($set, $set_once)` instead - useful for profile
|
|
183
183
|
updates that should not create a new identity:
|
|
184
184
|
|
|
185
185
|
```typescript
|
|
@@ -202,13 +202,14 @@ mapping: {
|
|
|
202
202
|
|
|
203
203
|
PostHog's group analytics (Scale/Enterprise) aggregates events by company, team,
|
|
204
204
|
or any custom group type. Configure a group mapping at destination or rule level
|
|
205
|
-
|
|
205
|
+
|
|
206
|
+
- the destination calls `posthog.group(type, key, properties?)`:
|
|
206
207
|
|
|
207
208
|
```typescript
|
|
208
209
|
mapping: {
|
|
209
210
|
company: {
|
|
210
211
|
update: {
|
|
211
|
-
|
|
212
|
+
silent: true,
|
|
212
213
|
settings: {
|
|
213
214
|
group: {
|
|
214
215
|
map: {
|
|
@@ -231,14 +232,14 @@ mapping: {
|
|
|
231
232
|
## Logout
|
|
232
233
|
|
|
233
234
|
`reset: true` (or any truthy mapping value) calls `posthog.reset()`, clearing
|
|
234
|
-
the distinct ID and generating a new anonymous one. Pair with `
|
|
235
|
+
the distinct ID and generating a new anonymous one. Pair with `silent: true` so
|
|
235
236
|
the rule runs as a pure side effect:
|
|
236
237
|
|
|
237
238
|
```typescript
|
|
238
239
|
mapping: {
|
|
239
240
|
user: {
|
|
240
241
|
logout: {
|
|
241
|
-
|
|
242
|
+
silent: true,
|
|
242
243
|
settings: { reset: true },
|
|
243
244
|
},
|
|
244
245
|
},
|
|
@@ -272,19 +273,19 @@ destination in the first place.
|
|
|
272
273
|
|
|
273
274
|
## Built-in Features (Config Passthrough)
|
|
274
275
|
|
|
275
|
-
All these PostHog features work via standard `posthog-js` init options
|
|
276
|
+
All these PostHog features work via standard `posthog-js` init options - no
|
|
276
277
|
destination wiring required:
|
|
277
278
|
|
|
278
|
-
- **Session replay**
|
|
279
|
+
- **Session replay** -
|
|
279
280
|
`settings.session_recording: { maskAllInputs: true, ... }`
|
|
280
|
-
- **Feature flags**
|
|
281
|
+
- **Feature flags** - `settings.bootstrap: { featureFlags: {...} }` for SSR,
|
|
281
282
|
`settings.advanced_disable_flags: true` to disable entirely. Access flags
|
|
282
283
|
directly via the `posthog` singleton.
|
|
283
|
-
- **Surveys**
|
|
284
|
-
- **Heatmaps**
|
|
285
|
-
- **Exception capture**
|
|
286
|
-
- **Cookieless mode**
|
|
287
|
-
- **Person profiles**
|
|
284
|
+
- **Surveys** - automatic via the SDK; `settings.disable_surveys: true` opts out
|
|
285
|
+
- **Heatmaps** - `settings.capture_heatmaps: true`
|
|
286
|
+
- **Exception capture** - `settings.capture_exceptions: true`
|
|
287
|
+
- **Cookieless mode** - `settings.cookieless_mode: 'always' | 'on_reject'`
|
|
288
|
+
- **Person profiles** - `settings.person_profiles: 'identified_only'` (PostHog
|
|
288
289
|
default, privacy-friendly) or `'always'`
|
|
289
290
|
|
|
290
291
|
For programmatic access to flags, surveys, or exception reporting, import the
|
package/dist/dev.d.mts
CHANGED
|
@@ -153,13 +153,13 @@ type PostHogStepExample = Flow.StepExample & {
|
|
|
153
153
|
configInclude?: string[];
|
|
154
154
|
};
|
|
155
155
|
/**
|
|
156
|
-
* Default event forwarding
|
|
156
|
+
* Default event forwarding - every walkerOS event becomes
|
|
157
157
|
* posthog.capture(event.name, properties). With no mapping and no
|
|
158
158
|
* destination-level include, properties is `{}`.
|
|
159
159
|
*/
|
|
160
160
|
declare const defaultEventForwarding: PostHogStepExample;
|
|
161
161
|
/**
|
|
162
|
-
* Wildcard ignore
|
|
162
|
+
* Wildcard ignore - walkerOS's standard way to drop events. The rule
|
|
163
163
|
* matches but does nothing. The destination fires zero SDK calls.
|
|
164
164
|
*/
|
|
165
165
|
declare const wildcardIgnored: PostHogStepExample;
|
|
@@ -187,7 +187,7 @@ declare const destinationLevelIdentify: PostHogStepExample;
|
|
|
187
187
|
/**
|
|
188
188
|
* Per-event identify with the full PostHog identity vocabulary.
|
|
189
189
|
* This is the "user login" pattern: set a new distinctId and enrich
|
|
190
|
-
* person properties. `
|
|
190
|
+
* person properties. `silent: true` suppresses the default posthog.capture()
|
|
191
191
|
* call because we're running identity side effects only.
|
|
192
192
|
*
|
|
193
193
|
* PostHog identify signature:
|
|
@@ -195,18 +195,18 @@ declare const destinationLevelIdentify: PostHogStepExample;
|
|
|
195
195
|
*/
|
|
196
196
|
declare const userLoginIdentify: PostHogStepExample;
|
|
197
197
|
/**
|
|
198
|
-
* Person-properties-only update
|
|
198
|
+
* Person-properties-only update - when the resolved identify object has
|
|
199
199
|
* NO `distinctId` key, the destination calls setPersonProperties($set, $set_once)
|
|
200
200
|
* instead of identify(). This is the "profile update" pattern: enrich
|
|
201
201
|
* user properties without changing identity.
|
|
202
202
|
*
|
|
203
|
-
* `
|
|
203
|
+
* `silent` defaults to false here - we intentionally ALSO capture a
|
|
204
204
|
* "profile update" event so it shows up in PostHog's event stream.
|
|
205
205
|
*/
|
|
206
206
|
declare const profileUpdateSetPersonProperties: PostHogStepExample;
|
|
207
207
|
/**
|
|
208
|
-
* User logout
|
|
209
|
-
* distinct ID and generates a new anonymous one. `
|
|
208
|
+
* User logout - reset: true fires posthog.reset(), which clears the
|
|
209
|
+
* distinct ID and generates a new anonymous one. `silent: true` because
|
|
210
210
|
* we're only running the reset side effect, no default capture().
|
|
211
211
|
*/
|
|
212
212
|
declare const userLogoutReset: PostHogStepExample;
|
|
@@ -214,12 +214,12 @@ declare const userLogoutReset: PostHogStepExample;
|
|
|
214
214
|
* Group assignment + group properties. PostHog's group analytics (paid)
|
|
215
215
|
* aggregates events by company / team / project. The destination resolves
|
|
216
216
|
* `settings.group` to { type, key, properties? } and calls
|
|
217
|
-
* posthog.group(type, key, properties). `
|
|
218
|
-
* pure side-effect rule
|
|
217
|
+
* posthog.group(type, key, properties). `silent: true` keeps this a
|
|
218
|
+
* pure side-effect rule - no "company update" capture().
|
|
219
219
|
*/
|
|
220
220
|
declare const groupAssignmentWithProperties: PostHogStepExample;
|
|
221
221
|
/**
|
|
222
|
-
* Order complete
|
|
222
|
+
* Order complete - PostHog has no dedicated revenue API. Revenue tracking
|
|
223
223
|
* is just a capture() call with the revenue properties in data. This
|
|
224
224
|
* example pairs `include: ["data", "globals"]` with a destination-level
|
|
225
225
|
* capture. The order total, shipping, currency, etc. all become
|
package/dist/dev.d.ts
CHANGED
|
@@ -153,13 +153,13 @@ type PostHogStepExample = Flow.StepExample & {
|
|
|
153
153
|
configInclude?: string[];
|
|
154
154
|
};
|
|
155
155
|
/**
|
|
156
|
-
* Default event forwarding
|
|
156
|
+
* Default event forwarding - every walkerOS event becomes
|
|
157
157
|
* posthog.capture(event.name, properties). With no mapping and no
|
|
158
158
|
* destination-level include, properties is `{}`.
|
|
159
159
|
*/
|
|
160
160
|
declare const defaultEventForwarding: PostHogStepExample;
|
|
161
161
|
/**
|
|
162
|
-
* Wildcard ignore
|
|
162
|
+
* Wildcard ignore - walkerOS's standard way to drop events. The rule
|
|
163
163
|
* matches but does nothing. The destination fires zero SDK calls.
|
|
164
164
|
*/
|
|
165
165
|
declare const wildcardIgnored: PostHogStepExample;
|
|
@@ -187,7 +187,7 @@ declare const destinationLevelIdentify: PostHogStepExample;
|
|
|
187
187
|
/**
|
|
188
188
|
* Per-event identify with the full PostHog identity vocabulary.
|
|
189
189
|
* This is the "user login" pattern: set a new distinctId and enrich
|
|
190
|
-
* person properties. `
|
|
190
|
+
* person properties. `silent: true` suppresses the default posthog.capture()
|
|
191
191
|
* call because we're running identity side effects only.
|
|
192
192
|
*
|
|
193
193
|
* PostHog identify signature:
|
|
@@ -195,18 +195,18 @@ declare const destinationLevelIdentify: PostHogStepExample;
|
|
|
195
195
|
*/
|
|
196
196
|
declare const userLoginIdentify: PostHogStepExample;
|
|
197
197
|
/**
|
|
198
|
-
* Person-properties-only update
|
|
198
|
+
* Person-properties-only update - when the resolved identify object has
|
|
199
199
|
* NO `distinctId` key, the destination calls setPersonProperties($set, $set_once)
|
|
200
200
|
* instead of identify(). This is the "profile update" pattern: enrich
|
|
201
201
|
* user properties without changing identity.
|
|
202
202
|
*
|
|
203
|
-
* `
|
|
203
|
+
* `silent` defaults to false here - we intentionally ALSO capture a
|
|
204
204
|
* "profile update" event so it shows up in PostHog's event stream.
|
|
205
205
|
*/
|
|
206
206
|
declare const profileUpdateSetPersonProperties: PostHogStepExample;
|
|
207
207
|
/**
|
|
208
|
-
* User logout
|
|
209
|
-
* distinct ID and generates a new anonymous one. `
|
|
208
|
+
* User logout - reset: true fires posthog.reset(), which clears the
|
|
209
|
+
* distinct ID and generates a new anonymous one. `silent: true` because
|
|
210
210
|
* we're only running the reset side effect, no default capture().
|
|
211
211
|
*/
|
|
212
212
|
declare const userLogoutReset: PostHogStepExample;
|
|
@@ -214,12 +214,12 @@ declare const userLogoutReset: PostHogStepExample;
|
|
|
214
214
|
* Group assignment + group properties. PostHog's group analytics (paid)
|
|
215
215
|
* aggregates events by company / team / project. The destination resolves
|
|
216
216
|
* `settings.group` to { type, key, properties? } and calls
|
|
217
|
-
* posthog.group(type, key, properties). `
|
|
218
|
-
* pure side-effect rule
|
|
217
|
+
* posthog.group(type, key, properties). `silent: true` keeps this a
|
|
218
|
+
* pure side-effect rule - no "company update" capture().
|
|
219
219
|
*/
|
|
220
220
|
declare const groupAssignmentWithProperties: PostHogStepExample;
|
|
221
221
|
/**
|
|
222
|
-
* Order complete
|
|
222
|
+
* Order complete - PostHog has no dedicated revenue API. Revenue tracking
|
|
223
223
|
* is just a capture() call with the revenue properties in data. This
|
|
224
224
|
* example pairs `include: ["data", "globals"]` with a destination-level
|
|
225
225
|
* capture. The order total, shipping, currency, etc. all become
|