@walkeros/web-destination-posthog 3.4.2 → 4.0.0-next-1777882869103
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
|
@@ -96,13 +96,13 @@ type PostHogStepExample = Flow.StepExample & {
|
|
|
96
96
|
configInclude?: string[];
|
|
97
97
|
};
|
|
98
98
|
/**
|
|
99
|
-
* Default event forwarding
|
|
99
|
+
* Default event forwarding - every walkerOS event becomes
|
|
100
100
|
* posthog.capture(event.name, properties). With no mapping and no
|
|
101
101
|
* destination-level include, properties is `{}`.
|
|
102
102
|
*/
|
|
103
103
|
declare const defaultEventForwarding: PostHogStepExample;
|
|
104
104
|
/**
|
|
105
|
-
* Wildcard ignore
|
|
105
|
+
* Wildcard ignore - walkerOS's standard way to drop events. The rule
|
|
106
106
|
* matches but does nothing. The destination fires zero SDK calls.
|
|
107
107
|
*/
|
|
108
108
|
declare const wildcardIgnored: PostHogStepExample;
|
|
@@ -130,7 +130,7 @@ declare const destinationLevelIdentify: PostHogStepExample;
|
|
|
130
130
|
/**
|
|
131
131
|
* Per-event identify with the full PostHog identity vocabulary.
|
|
132
132
|
* This is the "user login" pattern: set a new distinctId and enrich
|
|
133
|
-
* person properties. `
|
|
133
|
+
* person properties. `silent: true` suppresses the default posthog.capture()
|
|
134
134
|
* call because we're running identity side effects only.
|
|
135
135
|
*
|
|
136
136
|
* PostHog identify signature:
|
|
@@ -138,18 +138,18 @@ declare const destinationLevelIdentify: PostHogStepExample;
|
|
|
138
138
|
*/
|
|
139
139
|
declare const userLoginIdentify: PostHogStepExample;
|
|
140
140
|
/**
|
|
141
|
-
* Person-properties-only update
|
|
141
|
+
* Person-properties-only update - when the resolved identify object has
|
|
142
142
|
* NO `distinctId` key, the destination calls setPersonProperties($set, $set_once)
|
|
143
143
|
* instead of identify(). This is the "profile update" pattern: enrich
|
|
144
144
|
* user properties without changing identity.
|
|
145
145
|
*
|
|
146
|
-
* `
|
|
146
|
+
* `silent` defaults to false here - we intentionally ALSO capture a
|
|
147
147
|
* "profile update" event so it shows up in PostHog's event stream.
|
|
148
148
|
*/
|
|
149
149
|
declare const profileUpdateSetPersonProperties: PostHogStepExample;
|
|
150
150
|
/**
|
|
151
|
-
* User logout
|
|
152
|
-
* distinct ID and generates a new anonymous one. `
|
|
151
|
+
* User logout - reset: true fires posthog.reset(), which clears the
|
|
152
|
+
* distinct ID and generates a new anonymous one. `silent: true` because
|
|
153
153
|
* we're only running the reset side effect, no default capture().
|
|
154
154
|
*/
|
|
155
155
|
declare const userLogoutReset: PostHogStepExample;
|
|
@@ -157,12 +157,12 @@ declare const userLogoutReset: PostHogStepExample;
|
|
|
157
157
|
* Group assignment + group properties. PostHog's group analytics (paid)
|
|
158
158
|
* aggregates events by company / team / project. The destination resolves
|
|
159
159
|
* `settings.group` to { type, key, properties? } and calls
|
|
160
|
-
* posthog.group(type, key, properties). `
|
|
161
|
-
* pure side-effect rule
|
|
160
|
+
* posthog.group(type, key, properties). `silent: true` keeps this a
|
|
161
|
+
* pure side-effect rule - no "company update" capture().
|
|
162
162
|
*/
|
|
163
163
|
declare const groupAssignmentWithProperties: PostHogStepExample;
|
|
164
164
|
/**
|
|
165
|
-
* Order complete
|
|
165
|
+
* Order complete - PostHog has no dedicated revenue API. Revenue tracking
|
|
166
166
|
* is just a capture() call with the revenue properties in data. This
|
|
167
167
|
* example pairs `include: ["data", "globals"]` with a destination-level
|
|
168
168
|
* capture. The order total, shipping, currency, etc. all become
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -96,13 +96,13 @@ type PostHogStepExample = Flow.StepExample & {
|
|
|
96
96
|
configInclude?: string[];
|
|
97
97
|
};
|
|
98
98
|
/**
|
|
99
|
-
* Default event forwarding
|
|
99
|
+
* Default event forwarding - every walkerOS event becomes
|
|
100
100
|
* posthog.capture(event.name, properties). With no mapping and no
|
|
101
101
|
* destination-level include, properties is `{}`.
|
|
102
102
|
*/
|
|
103
103
|
declare const defaultEventForwarding: PostHogStepExample;
|
|
104
104
|
/**
|
|
105
|
-
* Wildcard ignore
|
|
105
|
+
* Wildcard ignore - walkerOS's standard way to drop events. The rule
|
|
106
106
|
* matches but does nothing. The destination fires zero SDK calls.
|
|
107
107
|
*/
|
|
108
108
|
declare const wildcardIgnored: PostHogStepExample;
|
|
@@ -130,7 +130,7 @@ declare const destinationLevelIdentify: PostHogStepExample;
|
|
|
130
130
|
/**
|
|
131
131
|
* Per-event identify with the full PostHog identity vocabulary.
|
|
132
132
|
* This is the "user login" pattern: set a new distinctId and enrich
|
|
133
|
-
* person properties. `
|
|
133
|
+
* person properties. `silent: true` suppresses the default posthog.capture()
|
|
134
134
|
* call because we're running identity side effects only.
|
|
135
135
|
*
|
|
136
136
|
* PostHog identify signature:
|
|
@@ -138,18 +138,18 @@ declare const destinationLevelIdentify: PostHogStepExample;
|
|
|
138
138
|
*/
|
|
139
139
|
declare const userLoginIdentify: PostHogStepExample;
|
|
140
140
|
/**
|
|
141
|
-
* Person-properties-only update
|
|
141
|
+
* Person-properties-only update - when the resolved identify object has
|
|
142
142
|
* NO `distinctId` key, the destination calls setPersonProperties($set, $set_once)
|
|
143
143
|
* instead of identify(). This is the "profile update" pattern: enrich
|
|
144
144
|
* user properties without changing identity.
|
|
145
145
|
*
|
|
146
|
-
* `
|
|
146
|
+
* `silent` defaults to false here - we intentionally ALSO capture a
|
|
147
147
|
* "profile update" event so it shows up in PostHog's event stream.
|
|
148
148
|
*/
|
|
149
149
|
declare const profileUpdateSetPersonProperties: PostHogStepExample;
|
|
150
150
|
/**
|
|
151
|
-
* User logout
|
|
152
|
-
* distinct ID and generates a new anonymous one. `
|
|
151
|
+
* User logout - reset: true fires posthog.reset(), which clears the
|
|
152
|
+
* distinct ID and generates a new anonymous one. `silent: true` because
|
|
153
153
|
* we're only running the reset side effect, no default capture().
|
|
154
154
|
*/
|
|
155
155
|
declare const userLogoutReset: PostHogStepExample;
|
|
@@ -157,12 +157,12 @@ declare const userLogoutReset: PostHogStepExample;
|
|
|
157
157
|
* Group assignment + group properties. PostHog's group analytics (paid)
|
|
158
158
|
* aggregates events by company / team / project. The destination resolves
|
|
159
159
|
* `settings.group` to { type, key, properties? } and calls
|
|
160
|
-
* posthog.group(type, key, properties). `
|
|
161
|
-
* pure side-effect rule
|
|
160
|
+
* posthog.group(type, key, properties). `silent: true` keeps this a
|
|
161
|
+
* pure side-effect rule - no "company update" capture().
|
|
162
162
|
*/
|
|
163
163
|
declare const groupAssignmentWithProperties: PostHogStepExample;
|
|
164
164
|
/**
|
|
165
|
-
* Order complete
|
|
165
|
+
* Order complete - PostHog has no dedicated revenue API. Revenue tracking
|
|
166
166
|
* is just a capture() call with the revenue properties in data. This
|
|
167
167
|
* example pairs `include: ["data", "globals"]` with a destination-level
|
|
168
168
|
* capture. The order total, shipping, currency, etc. all become
|
package/dist/examples/index.js
CHANGED
|
@@ -80,51 +80,56 @@ __export(step_exports, {
|
|
|
80
80
|
|
|
81
81
|
// ../../../core/dist/index.mjs
|
|
82
82
|
var e = Object.defineProperty;
|
|
83
|
-
var
|
|
83
|
+
var a = {};
|
|
84
84
|
((t, n) => {
|
|
85
85
|
for (var o in n) e(t, o, { get: n[o], enumerable: true });
|
|
86
|
-
})(
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
function
|
|
90
|
-
n = { ...
|
|
86
|
+
})(a, { Level: () => c });
|
|
87
|
+
var c = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(c || {});
|
|
88
|
+
var X = { merge: true, shallow: true, extend: true };
|
|
89
|
+
function G(e2, t = {}, n = {}) {
|
|
90
|
+
n = { ...X, ...n };
|
|
91
91
|
const o = Object.entries(t).reduce((t2, [o2, r]) => {
|
|
92
92
|
const i = e2[o2];
|
|
93
93
|
return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
|
|
94
94
|
}, {});
|
|
95
95
|
return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function he() {
|
|
98
|
+
let e2 = "";
|
|
99
|
+
for (let t = 0; t < 16; t++) e2 += (16 * Math.random() | 0).toString(16);
|
|
100
|
+
return e2;
|
|
101
|
+
}
|
|
102
|
+
function ve(e2 = {}) {
|
|
98
103
|
var _a;
|
|
99
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n =
|
|
104
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = G({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" } }], consent: { functional: true }, id: e2.id || he(), trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, source: { type: "collector", schema: "4" } }, e2, { merge: false });
|
|
100
105
|
if (e2.name) {
|
|
101
|
-
const [t2,
|
|
102
|
-
t2 &&
|
|
106
|
+
const [t2, o] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
107
|
+
t2 && o && (n.entity = t2, n.action = o);
|
|
103
108
|
}
|
|
104
|
-
return
|
|
109
|
+
return n;
|
|
105
110
|
}
|
|
106
|
-
function
|
|
111
|
+
function we(e2 = "entity action", t = {}) {
|
|
107
112
|
const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
108
|
-
return
|
|
113
|
+
return ve({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
|
|
109
114
|
}
|
|
110
115
|
|
|
111
116
|
// src/examples/step.ts
|
|
112
117
|
var defaultEventForwarding = {
|
|
113
118
|
title: "Default capture",
|
|
114
119
|
description: "A walker event becomes a PostHog capture call with the event name and empty properties.",
|
|
115
|
-
in:
|
|
120
|
+
in: we("product view", { timestamp: 1700000100 }),
|
|
116
121
|
out: [["posthog.capture", "product view", {}]]
|
|
117
122
|
};
|
|
118
123
|
var wildcardIgnored = {
|
|
119
124
|
public: false,
|
|
120
|
-
in:
|
|
125
|
+
in: we("debug noise", { timestamp: 1700000101 }),
|
|
121
126
|
mapping: { ignore: true },
|
|
122
127
|
out: []
|
|
123
128
|
};
|
|
124
129
|
var destinationLevelInclude = {
|
|
125
130
|
title: "Include data",
|
|
126
131
|
description: "Destination-level include flattens the event data section into prefixed PostHog capture properties.",
|
|
127
|
-
in:
|
|
132
|
+
in: we("product view", { timestamp: 1700000102 }),
|
|
128
133
|
configInclude: ["data"],
|
|
129
134
|
out: [
|
|
130
135
|
[
|
|
@@ -143,7 +148,7 @@ var destinationLevelInclude = {
|
|
|
143
148
|
var ruleIncludeReplaces = {
|
|
144
149
|
title: "Rule include overrides",
|
|
145
150
|
description: "A per-rule include replaces the destination-level include so this event forwards only globals.",
|
|
146
|
-
in:
|
|
151
|
+
in: we("order complete", { timestamp: 1700000103 }),
|
|
147
152
|
configInclude: ["data"],
|
|
148
153
|
mapping: {
|
|
149
154
|
include: ["globals"]
|
|
@@ -161,7 +166,7 @@ var ruleIncludeReplaces = {
|
|
|
161
166
|
var destinationLevelIdentify = {
|
|
162
167
|
title: "Destination identify",
|
|
163
168
|
description: "Destination-level identify calls posthog.identify with the user id before firing the default capture.",
|
|
164
|
-
in:
|
|
169
|
+
in: we("page view", { timestamp: 1700000104 }),
|
|
165
170
|
settings: {
|
|
166
171
|
identify: {
|
|
167
172
|
map: {
|
|
@@ -177,7 +182,7 @@ var destinationLevelIdentify = {
|
|
|
177
182
|
var userLoginIdentify = {
|
|
178
183
|
title: "User login identify",
|
|
179
184
|
description: "A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.",
|
|
180
|
-
in:
|
|
185
|
+
in: we("user login", {
|
|
181
186
|
timestamp: 1700000105,
|
|
182
187
|
data: {
|
|
183
188
|
user_id: "new-user-123",
|
|
@@ -188,7 +193,7 @@ var userLoginIdentify = {
|
|
|
188
193
|
}
|
|
189
194
|
}),
|
|
190
195
|
mapping: {
|
|
191
|
-
|
|
196
|
+
silent: true,
|
|
192
197
|
settings: {
|
|
193
198
|
identify: {
|
|
194
199
|
map: {
|
|
@@ -229,7 +234,7 @@ var userLoginIdentify = {
|
|
|
229
234
|
var profileUpdateSetPersonProperties = {
|
|
230
235
|
title: "Set person properties",
|
|
231
236
|
description: "A profile update calls setPersonProperties to enrich the PostHog profile without changing identity.",
|
|
232
|
-
in:
|
|
237
|
+
in: we("profile update", {
|
|
233
238
|
timestamp: 1700000106,
|
|
234
239
|
data: {
|
|
235
240
|
name: "Jane Doe",
|
|
@@ -265,9 +270,9 @@ var profileUpdateSetPersonProperties = {
|
|
|
265
270
|
var userLogoutReset = {
|
|
266
271
|
title: "User logout reset",
|
|
267
272
|
description: "A user logout calls posthog.reset to clear the distinct id and generate a new anonymous one.",
|
|
268
|
-
in:
|
|
273
|
+
in: we("user logout", { timestamp: 1700000107 }),
|
|
269
274
|
mapping: {
|
|
270
|
-
|
|
275
|
+
silent: true,
|
|
271
276
|
settings: {
|
|
272
277
|
reset: true
|
|
273
278
|
}
|
|
@@ -277,7 +282,7 @@ var userLogoutReset = {
|
|
|
277
282
|
var groupAssignmentWithProperties = {
|
|
278
283
|
title: "Group assignment",
|
|
279
284
|
description: "A company update assigns the user to a PostHog group and sets group properties via posthog.group.",
|
|
280
|
-
in:
|
|
285
|
+
in: we("company update", {
|
|
281
286
|
timestamp: 1700000108,
|
|
282
287
|
data: {
|
|
283
288
|
company_id: "company_123",
|
|
@@ -287,7 +292,7 @@ var groupAssignmentWithProperties = {
|
|
|
287
292
|
}
|
|
288
293
|
}),
|
|
289
294
|
mapping: {
|
|
290
|
-
|
|
295
|
+
silent: true,
|
|
291
296
|
settings: {
|
|
292
297
|
group: {
|
|
293
298
|
map: {
|
|
@@ -320,7 +325,7 @@ var groupAssignmentWithProperties = {
|
|
|
320
325
|
var orderCompleteWithInclude = {
|
|
321
326
|
title: "Order complete",
|
|
322
327
|
description: "An order complete captures order data and globals as prefixed properties for revenue analysis in PostHog.",
|
|
323
|
-
in:
|
|
328
|
+
in: we("order complete", { timestamp: 1700000109 }),
|
|
324
329
|
mapping: {
|
|
325
330
|
include: ["data", "globals"]
|
|
326
331
|
},
|
package/dist/examples/index.mjs
CHANGED
|
@@ -59,51 +59,56 @@ __export(step_exports, {
|
|
|
59
59
|
|
|
60
60
|
// ../../../core/dist/index.mjs
|
|
61
61
|
var e = Object.defineProperty;
|
|
62
|
-
var
|
|
62
|
+
var a = {};
|
|
63
63
|
((t, n) => {
|
|
64
64
|
for (var o in n) e(t, o, { get: n[o], enumerable: true });
|
|
65
|
-
})(
|
|
66
|
-
var
|
|
67
|
-
var
|
|
68
|
-
function
|
|
69
|
-
n = { ...
|
|
65
|
+
})(a, { Level: () => c });
|
|
66
|
+
var c = ((e2) => (e2[e2.ERROR = 0] = "ERROR", e2[e2.WARN = 1] = "WARN", e2[e2.INFO = 2] = "INFO", e2[e2.DEBUG = 3] = "DEBUG", e2))(c || {});
|
|
67
|
+
var X = { merge: true, shallow: true, extend: true };
|
|
68
|
+
function G(e2, t = {}, n = {}) {
|
|
69
|
+
n = { ...X, ...n };
|
|
70
70
|
const o = Object.entries(t).reduce((t2, [o2, r]) => {
|
|
71
71
|
const i = e2[o2];
|
|
72
72
|
return n.merge && Array.isArray(i) && Array.isArray(r) ? t2[o2] = r.reduce((e3, t3) => e3.includes(t3) ? e3 : [...e3, t3], [...i]) : (n.extend || o2 in e2) && (t2[o2] = r), t2;
|
|
73
73
|
}, {});
|
|
74
74
|
return n.shallow ? { ...e2, ...o } : (Object.assign(e2, o), e2);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function he() {
|
|
77
|
+
let e2 = "";
|
|
78
|
+
for (let t = 0; t < 16; t++) e2 += (16 * Math.random() | 0).toString(16);
|
|
79
|
+
return e2;
|
|
80
|
+
}
|
|
81
|
+
function ve(e2 = {}) {
|
|
77
82
|
var _a;
|
|
78
|
-
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n =
|
|
83
|
+
const t = e2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = G({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" } }], consent: { functional: true }, id: e2.id || he(), trigger: "test", entity: "entity", action: "action", timestamp: t, timing: 3.14, source: { type: "collector", schema: "4" } }, e2, { merge: false });
|
|
79
84
|
if (e2.name) {
|
|
80
|
-
const [t2,
|
|
81
|
-
t2 &&
|
|
85
|
+
const [t2, o] = (_a = e2.name.split(" ")) != null ? _a : [];
|
|
86
|
+
t2 && o && (n.entity = t2, n.action = o);
|
|
82
87
|
}
|
|
83
|
-
return
|
|
88
|
+
return n;
|
|
84
89
|
}
|
|
85
|
-
function
|
|
90
|
+
function we(e2 = "entity action", t = {}) {
|
|
86
91
|
const n = t.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
87
|
-
return
|
|
92
|
+
return ve({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[e2], ...t, name: e2 });
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
// src/examples/step.ts
|
|
91
96
|
var defaultEventForwarding = {
|
|
92
97
|
title: "Default capture",
|
|
93
98
|
description: "A walker event becomes a PostHog capture call with the event name and empty properties.",
|
|
94
|
-
in:
|
|
99
|
+
in: we("product view", { timestamp: 1700000100 }),
|
|
95
100
|
out: [["posthog.capture", "product view", {}]]
|
|
96
101
|
};
|
|
97
102
|
var wildcardIgnored = {
|
|
98
103
|
public: false,
|
|
99
|
-
in:
|
|
104
|
+
in: we("debug noise", { timestamp: 1700000101 }),
|
|
100
105
|
mapping: { ignore: true },
|
|
101
106
|
out: []
|
|
102
107
|
};
|
|
103
108
|
var destinationLevelInclude = {
|
|
104
109
|
title: "Include data",
|
|
105
110
|
description: "Destination-level include flattens the event data section into prefixed PostHog capture properties.",
|
|
106
|
-
in:
|
|
111
|
+
in: we("product view", { timestamp: 1700000102 }),
|
|
107
112
|
configInclude: ["data"],
|
|
108
113
|
out: [
|
|
109
114
|
[
|
|
@@ -122,7 +127,7 @@ var destinationLevelInclude = {
|
|
|
122
127
|
var ruleIncludeReplaces = {
|
|
123
128
|
title: "Rule include overrides",
|
|
124
129
|
description: "A per-rule include replaces the destination-level include so this event forwards only globals.",
|
|
125
|
-
in:
|
|
130
|
+
in: we("order complete", { timestamp: 1700000103 }),
|
|
126
131
|
configInclude: ["data"],
|
|
127
132
|
mapping: {
|
|
128
133
|
include: ["globals"]
|
|
@@ -140,7 +145,7 @@ var ruleIncludeReplaces = {
|
|
|
140
145
|
var destinationLevelIdentify = {
|
|
141
146
|
title: "Destination identify",
|
|
142
147
|
description: "Destination-level identify calls posthog.identify with the user id before firing the default capture.",
|
|
143
|
-
in:
|
|
148
|
+
in: we("page view", { timestamp: 1700000104 }),
|
|
144
149
|
settings: {
|
|
145
150
|
identify: {
|
|
146
151
|
map: {
|
|
@@ -156,7 +161,7 @@ var destinationLevelIdentify = {
|
|
|
156
161
|
var userLoginIdentify = {
|
|
157
162
|
title: "User login identify",
|
|
158
163
|
description: "A user login fires PostHog identify with $set and $set_once person properties, skipping the capture.",
|
|
159
|
-
in:
|
|
164
|
+
in: we("user login", {
|
|
160
165
|
timestamp: 1700000105,
|
|
161
166
|
data: {
|
|
162
167
|
user_id: "new-user-123",
|
|
@@ -167,7 +172,7 @@ var userLoginIdentify = {
|
|
|
167
172
|
}
|
|
168
173
|
}),
|
|
169
174
|
mapping: {
|
|
170
|
-
|
|
175
|
+
silent: true,
|
|
171
176
|
settings: {
|
|
172
177
|
identify: {
|
|
173
178
|
map: {
|
|
@@ -208,7 +213,7 @@ var userLoginIdentify = {
|
|
|
208
213
|
var profileUpdateSetPersonProperties = {
|
|
209
214
|
title: "Set person properties",
|
|
210
215
|
description: "A profile update calls setPersonProperties to enrich the PostHog profile without changing identity.",
|
|
211
|
-
in:
|
|
216
|
+
in: we("profile update", {
|
|
212
217
|
timestamp: 1700000106,
|
|
213
218
|
data: {
|
|
214
219
|
name: "Jane Doe",
|
|
@@ -244,9 +249,9 @@ var profileUpdateSetPersonProperties = {
|
|
|
244
249
|
var userLogoutReset = {
|
|
245
250
|
title: "User logout reset",
|
|
246
251
|
description: "A user logout calls posthog.reset to clear the distinct id and generate a new anonymous one.",
|
|
247
|
-
in:
|
|
252
|
+
in: we("user logout", { timestamp: 1700000107 }),
|
|
248
253
|
mapping: {
|
|
249
|
-
|
|
254
|
+
silent: true,
|
|
250
255
|
settings: {
|
|
251
256
|
reset: true
|
|
252
257
|
}
|
|
@@ -256,7 +261,7 @@ var userLogoutReset = {
|
|
|
256
261
|
var groupAssignmentWithProperties = {
|
|
257
262
|
title: "Group assignment",
|
|
258
263
|
description: "A company update assigns the user to a PostHog group and sets group properties via posthog.group.",
|
|
259
|
-
in:
|
|
264
|
+
in: we("company update", {
|
|
260
265
|
timestamp: 1700000108,
|
|
261
266
|
data: {
|
|
262
267
|
company_id: "company_123",
|
|
@@ -266,7 +271,7 @@ var groupAssignmentWithProperties = {
|
|
|
266
271
|
}
|
|
267
272
|
}),
|
|
268
273
|
mapping: {
|
|
269
|
-
|
|
274
|
+
silent: true,
|
|
270
275
|
settings: {
|
|
271
276
|
group: {
|
|
272
277
|
map: {
|
|
@@ -299,7 +304,7 @@ var groupAssignmentWithProperties = {
|
|
|
299
304
|
var orderCompleteWithInclude = {
|
|
300
305
|
title: "Order complete",
|
|
301
306
|
description: "An order complete captures order data and globals as prefixed properties for revenue analysis in PostHog.",
|
|
302
|
-
in:
|
|
307
|
+
in: we("order complete", { timestamp: 1700000109 }),
|
|
303
308
|
mapping: {
|
|
304
309
|
include: ["data", "globals"]
|
|
305
310
|
},
|