make-mp-data 3.0.3 → 3.0.5

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.
Files changed (70) hide show
  1. package/README.md +46 -0
  2. package/dungeons/array-of-object-lookup-schema.json +327 -0
  3. package/dungeons/array-of-object-lookup.js +29 -9
  4. package/dungeons/capstone/capstone-ic3.js +291 -0
  5. package/dungeons/capstone/capstone-ic4.js +598 -0
  6. package/dungeons/capstone/capstone-ic5.js +668 -0
  7. package/dungeons/capstone/generate-product-lookup.js +309 -0
  8. package/dungeons/ecommerce-schema.json +462 -0
  9. package/dungeons/{copilot.js → ecommerce.js} +79 -17
  10. package/dungeons/education-schema.json +2409 -0
  11. package/dungeons/education.js +226 -462
  12. package/dungeons/fintech-schema.json +14034 -0
  13. package/dungeons/fintech.js +134 -413
  14. package/dungeons/foobar-schema.json +403 -0
  15. package/dungeons/foobar.js +27 -4
  16. package/dungeons/food-delivery-schema.json +192 -0
  17. package/dungeons/food-delivery.js +602 -0
  18. package/dungeons/food-schema.json +1152 -0
  19. package/dungeons/food.js +173 -406
  20. package/dungeons/gaming-schema.json +1270 -0
  21. package/dungeons/gaming.js +182 -42
  22. package/dungeons/insurance-application-schema.json +204 -0
  23. package/dungeons/insurance-application.js +605 -0
  24. package/dungeons/media-schema.json +906 -0
  25. package/dungeons/media.js +250 -420
  26. package/dungeons/retention-cadence-schema.json +78 -0
  27. package/dungeons/retention-cadence.js +35 -1
  28. package/dungeons/rpg-schema.json +4526 -0
  29. package/dungeons/rpg.js +171 -429
  30. package/dungeons/sanity-schema.json +255 -0
  31. package/dungeons/sanity.js +21 -10
  32. package/dungeons/sass-schema.json +1291 -0
  33. package/dungeons/sass.js +241 -368
  34. package/dungeons/scd-schema.json +919 -0
  35. package/dungeons/scd.js +41 -13
  36. package/dungeons/simple-schema.json +608 -0
  37. package/dungeons/simple.js +52 -15
  38. package/dungeons/simplest-schema.json +1418 -0
  39. package/dungeons/simplest.js +392 -0
  40. package/dungeons/social-schema.json +1118 -0
  41. package/dungeons/social.js +150 -391
  42. package/dungeons/text-generation-schema.json +3096 -0
  43. package/dungeons/text-generation.js +71 -0
  44. package/index.js +8 -6
  45. package/lib/core/config-validator.js +28 -8
  46. package/lib/core/storage.js +5 -5
  47. package/lib/generators/events.js +4 -4
  48. package/lib/orchestrators/mixpanel-sender.js +16 -13
  49. package/lib/orchestrators/user-loop.js +14 -6
  50. package/lib/templates/soup-presets.js +188 -0
  51. package/lib/utils/utils.js +52 -6
  52. package/package.json +1 -1
  53. package/types.d.ts +20 -3
  54. package/dungeons/adspend.js +0 -130
  55. package/dungeons/anon.js +0 -128
  56. package/dungeons/benchmark-heavy.js +0 -240
  57. package/dungeons/benchmark-light.js +0 -140
  58. package/dungeons/big.js +0 -226
  59. package/dungeons/business.js +0 -391
  60. package/dungeons/complex.js +0 -428
  61. package/dungeons/experiments.js +0 -137
  62. package/dungeons/funnels.js +0 -309
  63. package/dungeons/mil.js +0 -323
  64. package/dungeons/mirror.js +0 -161
  65. package/dungeons/soup-test.js +0 -52
  66. package/dungeons/streaming.js +0 -372
  67. package/dungeons/strict-event-test.js +0 -30
  68. package/dungeons/student-teacher.js +0 -438
  69. package/dungeons/too-big-events.js +0 -203
  70. package/dungeons/user-agent.js +0 -209
package/dungeons/scd.js CHANGED
@@ -1,13 +1,3 @@
1
- /**
2
- * This is the default configuration file for the data generator in SIMPLE mode
3
- * notice how the config object is structured, and see it's type definition in ./types.d.ts
4
- * feel free to modify this file to customize the data you generate
5
- * see helper functions in utils.js for more ways to generate data
6
- */
7
-
8
-
9
-
10
-
11
1
  import Chance from 'chance';
12
2
  const chance = new Chance();
13
3
  import dayjs from "dayjs";
@@ -20,6 +10,44 @@ const itemCategories = ["Books", "Movies", "Music", "Games", "Electronics", "Com
20
10
 
21
11
  const videoCategories = ["funny", "educational", "inspirational", "music", "news", "sports", "cooking", "DIY", "travel", "gaming"];
22
12
 
13
+ /**
14
+ * ═══════════════════════════════════════════════════════════════
15
+ * DATASET OVERVIEW
16
+ * ═══════════════════════════════════════════════════════════════
17
+ *
18
+ * SCD Test — dungeon focused on Slowly Changing Dimensions.
19
+ * - 500 users over 30 days, ~50K events (CSV format)
20
+ * - E-commerce events: checkout, add to cart, page view, watch video, view/save item
21
+ * - User SCDs: role (weekly), NPS (daily)
22
+ * - Group SCDs: MRR (monthly), AccountHealthScore (weekly), plan (monthly)
23
+ * - 1,000 company groups with industry, segment, CSM assignments
24
+ *
25
+ * ═══════════════════════════════════════════════════════════════
26
+ * ANALYTICS HOOKS (3 patterns)
27
+ * ═══════════════════════════════════════════════════════════════
28
+ *
29
+ * 1. SPEND TIERS (user hook)
30
+ * Users with luckyNumber > 250 = "high_spender", else "budget".
31
+ *
32
+ * 2. COUPON DISCOUNTS + WEEKEND VIEWING (event hook)
33
+ * Checkouts with coupons get discounted amounts. Weekend video
34
+ * watchers get 1.5x watch time with is_weekend: true.
35
+ *
36
+ * Mixpanel Report:
37
+ * - Insights: "checkout", AVG(amount), breakdown by discount_applied
38
+ * Expected: discount_applied=true shows lower amounts
39
+ * - Insights: "watch video", AVG(watchTimeSec), breakdown by is_weekend
40
+ * Expected: weekend watch times ~1.5x higher
41
+ *
42
+ * 3. CART ABANDONMENT (everything hook)
43
+ * Users who add to cart but never checkout get a synthetic
44
+ * "cart_abandoned" event 30 min after last add-to-cart.
45
+ *
46
+ * Mixpanel Report:
47
+ * - Insights: "cart_abandoned" total events
48
+ * Expected: visible volume of abandoned cart events
49
+ */
50
+
23
51
  /** @type {import('../types').Dungeon} */
24
52
  const config = {
25
53
  token: "",
@@ -47,7 +75,7 @@ const config = {
47
75
  weight: 2,
48
76
  properties: {
49
77
  amount: weighNumRange(5, 500, .25),
50
- currency: pickAWinner(["USD", "CAD", "EUR", "BTC", "ETH", "JPY"], 0),
78
+ currency: ["USD", "CAD", "EUR", "BTC", "ETH", "JPY"],
51
79
  coupon: weighChoices(["none", "none", "none", "none", "10%OFF", "20%OFF", "10%OFF", "20%OFF", "30%OFF", "40%OFF", "50%OFF"]),
52
80
  numItems: weighNumRange(1, 10),
53
81
 
@@ -172,7 +200,7 @@ const config = {
172
200
  company_id: {
173
201
  name: () => { return chance.name(); },
174
202
  email: () => { return `CSM: ${chance.pickone(["AK", "Neha", "Rajiv", "Deepak", "Justin", "Hans", "Katie", "Somya", "Tony", "Kaan"])}`; },
175
- industry: pickAWinner([
203
+ industry: [
176
204
  "technology",
177
205
  "education",
178
206
  "finance",
@@ -189,7 +217,7 @@ const config = {
189
217
  "utilities",
190
218
  "agriculture",
191
219
  "other",
192
- ]),
220
+ ],
193
221
  segment: ["SMB", "SMB", "SMB", "Mid Market", "Mid Market", "Enterprise"],
194
222
  "# active users": chance.integer({ min: 2, max: 20 })
195
223
  }
@@ -0,0 +1,608 @@
1
+ {
2
+ "schema": {
3
+ "token": "",
4
+ "seed": "simple is best",
5
+ "numDays": 100,
6
+ "numEvents": 500000,
7
+ "numUsers": 5000,
8
+ "format": "json",
9
+ "region": "US",
10
+ "hasAnonIds": true,
11
+ "hasSessionIds": true,
12
+ "hasAdSpend": false,
13
+ "hasLocation": true,
14
+ "hasAndroidDevices": true,
15
+ "hasIOSDevices": true,
16
+ "hasDesktopDevices": true,
17
+ "hasBrowser": true,
18
+ "hasCampaigns": true,
19
+ "isAnonymous": false,
20
+ "alsoInferFunnels": true,
21
+ "concurrency": 1,
22
+ "batchSize": 2500000,
23
+ "events": [
24
+ {
25
+ "event": "ad impression",
26
+ "weight": 15,
27
+ "properties": {
28
+ "partner": [
29
+ "google",
30
+ "facebook",
31
+ "twitter",
32
+ "linkedin",
33
+ "bing",
34
+ "taboola",
35
+ "outbrain",
36
+ "quora",
37
+ "pinterest"
38
+ ]
39
+ }
40
+ },
41
+ {
42
+ "event": "ad click",
43
+ "weight": 10,
44
+ "properties": {
45
+ "partner": [
46
+ "google",
47
+ "facebook",
48
+ "twitter",
49
+ "linkedin",
50
+ "bing",
51
+ "taboola",
52
+ "outbrain",
53
+ "quora",
54
+ "pinterest"
55
+ ]
56
+ }
57
+ },
58
+ {
59
+ "event": "checkout",
60
+ "weight": 2,
61
+ "properties": {
62
+ "amount": [
63
+ 110,
64
+ 153,
65
+ 209,
66
+ 398,
67
+ 119,
68
+ 131,
69
+ 160,
70
+ 180,
71
+ 393,
72
+ 362,
73
+ 112,
74
+ 298,
75
+ 349,
76
+ 136,
77
+ 370,
78
+ 131,
79
+ 142,
80
+ 127,
81
+ 151,
82
+ 385,
83
+ 339,
84
+ 362,
85
+ 111,
86
+ 148,
87
+ 336,
88
+ 158,
89
+ 188,
90
+ 159,
91
+ 119,
92
+ 340,
93
+ 369,
94
+ 127,
95
+ 125,
96
+ 379,
97
+ 166,
98
+ 129,
99
+ 390,
100
+ 126,
101
+ 155,
102
+ 124,
103
+ 345,
104
+ 196,
105
+ 159,
106
+ 131,
107
+ 253,
108
+ 149,
109
+ 155,
110
+ 161,
111
+ 149,
112
+ 333
113
+ ],
114
+ "currency": [
115
+ "USD",
116
+ "CAD",
117
+ "EUR",
118
+ "BTC",
119
+ "ETH",
120
+ "JPY"
121
+ ],
122
+ "coupon": {
123
+ "functionName": "arrow",
124
+ "body": "function generateWeightedArray() {\n\t\tconst weightedArray = [];\n\n\t\t// Add each value to the array the number of times specified by its weight\n\t\tweightedItems.forEach(({ value, weight }) => {\n\t\t\tif (!weight) weight = 1;\n\t\t\tfor (let i = 0; i < weight; i++) {\n\t\t\t\tweightedArray.push(value);\n\t\t\t}\n\t\t});\n\n\t\treturn weightedArray;\n\t}"
125
+ },
126
+ "numItems": [
127
+ 5,
128
+ 5,
129
+ 4,
130
+ 3,
131
+ 5,
132
+ 5,
133
+ 6,
134
+ 3,
135
+ 5,
136
+ 4,
137
+ 9,
138
+ 3,
139
+ 8,
140
+ 8,
141
+ 7,
142
+ 3,
143
+ 8,
144
+ 4,
145
+ 6,
146
+ 9,
147
+ 7,
148
+ 5,
149
+ 8,
150
+ 4,
151
+ 4,
152
+ 5,
153
+ 5,
154
+ 3,
155
+ 5,
156
+ 5,
157
+ 4,
158
+ 4,
159
+ 3,
160
+ 6,
161
+ 1,
162
+ 1,
163
+ 5,
164
+ 5,
165
+ 6,
166
+ 5,
167
+ 6,
168
+ 7,
169
+ 4,
170
+ 4,
171
+ 2,
172
+ 3,
173
+ 2,
174
+ 5,
175
+ 8,
176
+ 3
177
+ ]
178
+ }
179
+ },
180
+ {
181
+ "event": "add to cart",
182
+ "weight": 4,
183
+ "properties": {
184
+ "amount": [
185
+ 131,
186
+ 112,
187
+ 138,
188
+ 145,
189
+ 160,
190
+ 371,
191
+ 146,
192
+ 163,
193
+ 386,
194
+ 160,
195
+ 128,
196
+ 141,
197
+ 137,
198
+ 116,
199
+ 139,
200
+ 383,
201
+ 186,
202
+ 201,
203
+ 349,
204
+ 136,
205
+ 125,
206
+ 136,
207
+ 363,
208
+ 129,
209
+ 151,
210
+ 130,
211
+ 148,
212
+ 158,
213
+ 375,
214
+ 383,
215
+ 137,
216
+ 117,
217
+ 326,
218
+ 337,
219
+ 191,
220
+ 127,
221
+ 127,
222
+ 167,
223
+ 129,
224
+ 253,
225
+ 371,
226
+ 169,
227
+ 123,
228
+ 392,
229
+ 171,
230
+ 123,
231
+ 346,
232
+ 362,
233
+ 223,
234
+ 360
235
+ ],
236
+ "rating": [
237
+ 2,
238
+ 2,
239
+ 2,
240
+ 3,
241
+ 3,
242
+ 3,
243
+ 2,
244
+ 1,
245
+ 2,
246
+ 5,
247
+ 2,
248
+ 2,
249
+ 2,
250
+ 2,
251
+ 2,
252
+ 2,
253
+ 3,
254
+ 2,
255
+ 4,
256
+ 3,
257
+ 2,
258
+ 2,
259
+ 3,
260
+ 3,
261
+ 2,
262
+ 4,
263
+ 3,
264
+ 4,
265
+ 2,
266
+ 2,
267
+ 3,
268
+ 5,
269
+ 5,
270
+ 2,
271
+ 2,
272
+ 2,
273
+ 2,
274
+ 4,
275
+ 2,
276
+ 2,
277
+ 3,
278
+ 4,
279
+ 3,
280
+ 1,
281
+ 2,
282
+ 3,
283
+ 3,
284
+ 2,
285
+ 5,
286
+ 4
287
+ ],
288
+ "reviews": [
289
+ 9,
290
+ 27,
291
+ 20,
292
+ 16,
293
+ 16,
294
+ 4,
295
+ 23,
296
+ 9,
297
+ 17,
298
+ 22,
299
+ 15,
300
+ 8,
301
+ 12,
302
+ 13,
303
+ 9,
304
+ 15,
305
+ 18,
306
+ 10,
307
+ 14,
308
+ 16,
309
+ 10,
310
+ 9,
311
+ 6,
312
+ 9,
313
+ 15,
314
+ 18,
315
+ 28,
316
+ 14,
317
+ 6,
318
+ 20,
319
+ 23,
320
+ 26,
321
+ 9,
322
+ 20,
323
+ 3,
324
+ 14,
325
+ 26,
326
+ 13,
327
+ 19,
328
+ 14,
329
+ 10,
330
+ 18,
331
+ 20,
332
+ 29,
333
+ 8,
334
+ 8,
335
+ 12,
336
+ 8,
337
+ 8,
338
+ 19
339
+ ],
340
+ "isFeaturedItem": [
341
+ true,
342
+ false,
343
+ false
344
+ ],
345
+ "itemCategory": {
346
+ "functionName": "arrow",
347
+ "body": "function () {\n\t\tconst weighted = [];\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tconst rand = chance.d10(); // Random number between 1 and 10\n\n\t\t\t// 35% chance to favor the most chosen index\n\t\t\tif (chance.bool({ likelihood: 35 })) {\n\t\t\t\t// 50% chance to slightly alter the index\n\t\t\t\tif (chance.bool({ likelihood: 50 })) {\n\t\t\t\t\tweighted.push(items[mostChosenIndex]);\n\t\t\t\t} else {\n\t\t\t\t\tconst addOrSubtract = chance.bool({ likelihood: 50 }) ? -rand : rand;\n\t\t\t\t\tlet newIndex = mostChosenIndex + addOrSubtract;\n\n\t\t\t\t\t// Ensure newIndex is within bounds\n\t\t\t\t\tif (newIndex < 0) newIndex = 0;\n\t\t\t\t\tif (newIndex >= items.length) newIndex = items.length - 1;\n\t\t\t\t\tweighted.push(items[newIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 25% chance to favor the second most chosen index\n\t\t\telse if (chance.bool({ likelihood: 25 })) {\n\t\t\t\tweighted.push(items[secondMostChosenIndex]);\n\t\t\t}\n\t\t\t// 15% chance to favor the third most chosen index\n\t\t\telse if (chance.bool({ likelihood: 15 })) {\n\t\t\t\tweighted.push(items[thirdMostChosenIndex]);\n\t\t\t}\n\t\t\t// Otherwise, pick a random item from the list\n\t\t\telse {\n\t\t\t\tweighted.push(chance.pickone(items));\n\t\t\t}\n\t\t}\n\t\treturn weighted;\n\t}"
348
+ },
349
+ "dateItemListed": {
350
+ "functionName": "integer",
351
+ "args": []
352
+ }
353
+ }
354
+ },
355
+ {
356
+ "event": "page view",
357
+ "weight": 10,
358
+ "properties": {
359
+ "page": {
360
+ "functionName": "arrow",
361
+ "body": "function () {\n\t\tconst weighted = [];\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tconst rand = chance.d10(); // Random number between 1 and 10\n\n\t\t\t// 35% chance to favor the most chosen index\n\t\t\tif (chance.bool({ likelihood: 35 })) {\n\t\t\t\t// 50% chance to slightly alter the index\n\t\t\t\tif (chance.bool({ likelihood: 50 })) {\n\t\t\t\t\tweighted.push(items[mostChosenIndex]);\n\t\t\t\t} else {\n\t\t\t\t\tconst addOrSubtract = chance.bool({ likelihood: 50 }) ? -rand : rand;\n\t\t\t\t\tlet newIndex = mostChosenIndex + addOrSubtract;\n\n\t\t\t\t\t// Ensure newIndex is within bounds\n\t\t\t\t\tif (newIndex < 0) newIndex = 0;\n\t\t\t\t\tif (newIndex >= items.length) newIndex = items.length - 1;\n\t\t\t\t\tweighted.push(items[newIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 25% chance to favor the second most chosen index\n\t\t\telse if (chance.bool({ likelihood: 25 })) {\n\t\t\t\tweighted.push(items[secondMostChosenIndex]);\n\t\t\t}\n\t\t\t// 15% chance to favor the third most chosen index\n\t\t\telse if (chance.bool({ likelihood: 15 })) {\n\t\t\t\tweighted.push(items[thirdMostChosenIndex]);\n\t\t\t}\n\t\t\t// Otherwise, pick a random item from the list\n\t\t\telse {\n\t\t\t\tweighted.push(chance.pickone(items));\n\t\t\t}\n\t\t}\n\t\treturn weighted;\n\t}"
362
+ },
363
+ "utm_source": {
364
+ "functionName": "arrow",
365
+ "body": "function () {\n\t\tconst weighted = [];\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tconst rand = chance.d10(); // Random number between 1 and 10\n\n\t\t\t// 35% chance to favor the most chosen index\n\t\t\tif (chance.bool({ likelihood: 35 })) {\n\t\t\t\t// 50% chance to slightly alter the index\n\t\t\t\tif (chance.bool({ likelihood: 50 })) {\n\t\t\t\t\tweighted.push(items[mostChosenIndex]);\n\t\t\t\t} else {\n\t\t\t\t\tconst addOrSubtract = chance.bool({ likelihood: 50 }) ? -rand : rand;\n\t\t\t\t\tlet newIndex = mostChosenIndex + addOrSubtract;\n\n\t\t\t\t\t// Ensure newIndex is within bounds\n\t\t\t\t\tif (newIndex < 0) newIndex = 0;\n\t\t\t\t\tif (newIndex >= items.length) newIndex = items.length - 1;\n\t\t\t\t\tweighted.push(items[newIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 25% chance to favor the second most chosen index\n\t\t\telse if (chance.bool({ likelihood: 25 })) {\n\t\t\t\tweighted.push(items[secondMostChosenIndex]);\n\t\t\t}\n\t\t\t// 15% chance to favor the third most chosen index\n\t\t\telse if (chance.bool({ likelihood: 15 })) {\n\t\t\t\tweighted.push(items[thirdMostChosenIndex]);\n\t\t\t}\n\t\t\t// Otherwise, pick a random item from the list\n\t\t\telse {\n\t\t\t\tweighted.push(chance.pickone(items));\n\t\t\t}\n\t\t}\n\t\treturn weighted;\n\t}"
366
+ }
367
+ }
368
+ },
369
+ {
370
+ "event": "watch video",
371
+ "weight": 8,
372
+ "properties": {
373
+ "videoCategory": {
374
+ "functionName": "arrow",
375
+ "body": "function () {\n\t\tconst weighted = [];\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tconst rand = chance.d10(); // Random number between 1 and 10\n\n\t\t\t// 35% chance to favor the most chosen index\n\t\t\tif (chance.bool({ likelihood: 35 })) {\n\t\t\t\t// 50% chance to slightly alter the index\n\t\t\t\tif (chance.bool({ likelihood: 50 })) {\n\t\t\t\t\tweighted.push(items[mostChosenIndex]);\n\t\t\t\t} else {\n\t\t\t\t\tconst addOrSubtract = chance.bool({ likelihood: 50 }) ? -rand : rand;\n\t\t\t\t\tlet newIndex = mostChosenIndex + addOrSubtract;\n\n\t\t\t\t\t// Ensure newIndex is within bounds\n\t\t\t\t\tif (newIndex < 0) newIndex = 0;\n\t\t\t\t\tif (newIndex >= items.length) newIndex = items.length - 1;\n\t\t\t\t\tweighted.push(items[newIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 25% chance to favor the second most chosen index\n\t\t\telse if (chance.bool({ likelihood: 25 })) {\n\t\t\t\tweighted.push(items[secondMostChosenIndex]);\n\t\t\t}\n\t\t\t// 15% chance to favor the third most chosen index\n\t\t\telse if (chance.bool({ likelihood: 15 })) {\n\t\t\t\tweighted.push(items[thirdMostChosenIndex]);\n\t\t\t}\n\t\t\t// Otherwise, pick a random item from the list\n\t\t\telse {\n\t\t\t\tweighted.push(chance.pickone(items));\n\t\t\t}\n\t\t}\n\t\treturn weighted;\n\t}"
376
+ },
377
+ "isFeaturedItem": [
378
+ true,
379
+ false,
380
+ false
381
+ ],
382
+ "watchTimeSec": [
383
+ 433,
384
+ 466,
385
+ 143,
386
+ 178,
387
+ 159,
388
+ 449,
389
+ 170,
390
+ 145,
391
+ 170,
392
+ 168,
393
+ 159,
394
+ 161,
395
+ 173,
396
+ 240,
397
+ 131,
398
+ 424,
399
+ 180,
400
+ 431,
401
+ 197,
402
+ 305,
403
+ 156,
404
+ 183,
405
+ 466,
406
+ 149,
407
+ 453,
408
+ 440,
409
+ 207,
410
+ 161,
411
+ 158,
412
+ 159,
413
+ 437,
414
+ 159,
415
+ 156,
416
+ 180,
417
+ 384,
418
+ 404,
419
+ 149,
420
+ 458,
421
+ 136,
422
+ 168,
423
+ 453,
424
+ 415,
425
+ 148,
426
+ 187,
427
+ 155,
428
+ 305,
429
+ 161,
430
+ 175,
431
+ 161,
432
+ 195
433
+ ],
434
+ "quality": [
435
+ "2160p",
436
+ "1440p",
437
+ "1080p",
438
+ "720p",
439
+ "480p",
440
+ "360p",
441
+ "240p"
442
+ ],
443
+ "format": [
444
+ "mp4",
445
+ "avi",
446
+ "mov",
447
+ "mpg"
448
+ ],
449
+ "uploader_id": {
450
+ "functionName": "arrow",
451
+ "body": "function () { [native code] }"
452
+ }
453
+ }
454
+ },
455
+ {
456
+ "event": "view item",
457
+ "weight": 8,
458
+ "properties": {
459
+ "isFeaturedItem": [
460
+ true,
461
+ false,
462
+ false
463
+ ],
464
+ "itemCategory": {
465
+ "functionName": "arrow",
466
+ "body": "function () {\n\t\tconst weighted = [];\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tconst rand = chance.d10(); // Random number between 1 and 10\n\n\t\t\t// 35% chance to favor the most chosen index\n\t\t\tif (chance.bool({ likelihood: 35 })) {\n\t\t\t\t// 50% chance to slightly alter the index\n\t\t\t\tif (chance.bool({ likelihood: 50 })) {\n\t\t\t\t\tweighted.push(items[mostChosenIndex]);\n\t\t\t\t} else {\n\t\t\t\t\tconst addOrSubtract = chance.bool({ likelihood: 50 }) ? -rand : rand;\n\t\t\t\t\tlet newIndex = mostChosenIndex + addOrSubtract;\n\n\t\t\t\t\t// Ensure newIndex is within bounds\n\t\t\t\t\tif (newIndex < 0) newIndex = 0;\n\t\t\t\t\tif (newIndex >= items.length) newIndex = items.length - 1;\n\t\t\t\t\tweighted.push(items[newIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 25% chance to favor the second most chosen index\n\t\t\telse if (chance.bool({ likelihood: 25 })) {\n\t\t\t\tweighted.push(items[secondMostChosenIndex]);\n\t\t\t}\n\t\t\t// 15% chance to favor the third most chosen index\n\t\t\telse if (chance.bool({ likelihood: 15 })) {\n\t\t\t\tweighted.push(items[thirdMostChosenIndex]);\n\t\t\t}\n\t\t\t// Otherwise, pick a random item from the list\n\t\t\telse {\n\t\t\t\tweighted.push(chance.pickone(items));\n\t\t\t}\n\t\t}\n\t\treturn weighted;\n\t}"
467
+ },
468
+ "dateItemListed": {
469
+ "functionName": "integer",
470
+ "args": []
471
+ }
472
+ }
473
+ },
474
+ {
475
+ "event": "save item",
476
+ "weight": 5,
477
+ "properties": {
478
+ "isFeaturedItem": [
479
+ true,
480
+ false,
481
+ false
482
+ ],
483
+ "itemCategory": {
484
+ "functionName": "arrow",
485
+ "body": "function () {\n\t\tconst weighted = [];\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tconst rand = chance.d10(); // Random number between 1 and 10\n\n\t\t\t// 35% chance to favor the most chosen index\n\t\t\tif (chance.bool({ likelihood: 35 })) {\n\t\t\t\t// 50% chance to slightly alter the index\n\t\t\t\tif (chance.bool({ likelihood: 50 })) {\n\t\t\t\t\tweighted.push(items[mostChosenIndex]);\n\t\t\t\t} else {\n\t\t\t\t\tconst addOrSubtract = chance.bool({ likelihood: 50 }) ? -rand : rand;\n\t\t\t\t\tlet newIndex = mostChosenIndex + addOrSubtract;\n\n\t\t\t\t\t// Ensure newIndex is within bounds\n\t\t\t\t\tif (newIndex < 0) newIndex = 0;\n\t\t\t\t\tif (newIndex >= items.length) newIndex = items.length - 1;\n\t\t\t\t\tweighted.push(items[newIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 25% chance to favor the second most chosen index\n\t\t\telse if (chance.bool({ likelihood: 25 })) {\n\t\t\t\tweighted.push(items[secondMostChosenIndex]);\n\t\t\t}\n\t\t\t// 15% chance to favor the third most chosen index\n\t\t\telse if (chance.bool({ likelihood: 15 })) {\n\t\t\t\tweighted.push(items[thirdMostChosenIndex]);\n\t\t\t}\n\t\t\t// Otherwise, pick a random item from the list\n\t\t\telse {\n\t\t\t\tweighted.push(chance.pickone(items));\n\t\t\t}\n\t\t}\n\t\treturn weighted;\n\t}"
486
+ },
487
+ "dateItemListed": {
488
+ "functionName": "integer",
489
+ "args": []
490
+ }
491
+ }
492
+ },
493
+ {
494
+ "event": "sign up",
495
+ "weight": 1,
496
+ "isFirstEvent": true,
497
+ "properties": {
498
+ "signupMethod": [
499
+ "email",
500
+ "google",
501
+ "facebook",
502
+ "twitter",
503
+ "linkedin",
504
+ "github"
505
+ ],
506
+ "referral": {
507
+ "functionName": "arrow",
508
+ "body": "function generateWeightedArray() {\n\t\tconst weightedArray = [];\n\n\t\t// Add each value to the array the number of times specified by its weight\n\t\tweightedItems.forEach(({ value, weight }) => {\n\t\t\tif (!weight) weight = 1;\n\t\t\tfor (let i = 0; i < weight; i++) {\n\t\t\t\tweightedArray.push(value);\n\t\t\t}\n\t\t});\n\n\t\treturn weightedArray;\n\t}"
509
+ }
510
+ }
511
+ }
512
+ ],
513
+ "funnels": [
514
+ {
515
+ "sequence": [
516
+ "page view",
517
+ "view item",
518
+ "save item",
519
+ "page view",
520
+ "sign up"
521
+ ],
522
+ "conversionRate": 50,
523
+ "order": "first-and-last-fixed",
524
+ "weight": 1,
525
+ "isFirstFunnel": true,
526
+ "timeToConvert": 2,
527
+ "experiment": true,
528
+ "name": "Signup Flow"
529
+ }
530
+ ],
531
+ "superProps": {
532
+ "theme": {
533
+ "functionName": "arrow",
534
+ "body": "function () {\n\t\tconst weighted = [];\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tconst rand = chance.d10(); // Random number between 1 and 10\n\n\t\t\t// 35% chance to favor the most chosen index\n\t\t\tif (chance.bool({ likelihood: 35 })) {\n\t\t\t\t// 50% chance to slightly alter the index\n\t\t\t\tif (chance.bool({ likelihood: 50 })) {\n\t\t\t\t\tweighted.push(items[mostChosenIndex]);\n\t\t\t\t} else {\n\t\t\t\t\tconst addOrSubtract = chance.bool({ likelihood: 50 }) ? -rand : rand;\n\t\t\t\t\tlet newIndex = mostChosenIndex + addOrSubtract;\n\n\t\t\t\t\t// Ensure newIndex is within bounds\n\t\t\t\t\tif (newIndex < 0) newIndex = 0;\n\t\t\t\t\tif (newIndex >= items.length) newIndex = items.length - 1;\n\t\t\t\t\tweighted.push(items[newIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 25% chance to favor the second most chosen index\n\t\t\telse if (chance.bool({ likelihood: 25 })) {\n\t\t\t\tweighted.push(items[secondMostChosenIndex]);\n\t\t\t}\n\t\t\t// 15% chance to favor the third most chosen index\n\t\t\telse if (chance.bool({ likelihood: 15 })) {\n\t\t\t\tweighted.push(items[thirdMostChosenIndex]);\n\t\t\t}\n\t\t\t// Otherwise, pick a random item from the list\n\t\t\telse {\n\t\t\t\tweighted.push(chance.pickone(items));\n\t\t\t}\n\t\t}\n\t\treturn weighted;\n\t}"
535
+ }
536
+ },
537
+ "userProps": {
538
+ "title": {
539
+ "functionName": "arrow",
540
+ "body": "function () { [native code] }"
541
+ },
542
+ "luckyNumber": [
543
+ 311,
544
+ 314,
545
+ 126,
546
+ 120,
547
+ 140,
548
+ 337,
549
+ 148,
550
+ 138,
551
+ 160,
552
+ 138,
553
+ 127,
554
+ 151,
555
+ 132,
556
+ 296,
557
+ 135,
558
+ 140,
559
+ 152,
560
+ 165,
561
+ 147,
562
+ 314,
563
+ 305,
564
+ 127,
565
+ 122,
566
+ 144,
567
+ 335,
568
+ 314,
569
+ 148,
570
+ 154,
571
+ 311,
572
+ 158,
573
+ 144,
574
+ 309,
575
+ 152,
576
+ 311,
577
+ 136,
578
+ 145,
579
+ 231,
580
+ 162,
581
+ 145,
582
+ 331,
583
+ 331,
584
+ 136,
585
+ 162,
586
+ 144,
587
+ 138,
588
+ 142,
589
+ 117,
590
+ 319,
591
+ 141,
592
+ 140
593
+ ],
594
+ "spiritAnimal": {
595
+ "functionName": "arrow",
596
+ "body": "function () {\n\t\tconst weighted = [];\n\t\tfor (let i = 0; i < 10; i++) {\n\t\t\tconst rand = chance.d10(); // Random number between 1 and 10\n\n\t\t\t// 35% chance to favor the most chosen index\n\t\t\tif (chance.bool({ likelihood: 35 })) {\n\t\t\t\t// 50% chance to slightly alter the index\n\t\t\t\tif (chance.bool({ likelihood: 50 })) {\n\t\t\t\t\tweighted.push(items[mostChosenIndex]);\n\t\t\t\t} else {\n\t\t\t\t\tconst addOrSubtract = chance.bool({ likelihood: 50 }) ? -rand : rand;\n\t\t\t\t\tlet newIndex = mostChosenIndex + addOrSubtract;\n\n\t\t\t\t\t// Ensure newIndex is within bounds\n\t\t\t\t\tif (newIndex < 0) newIndex = 0;\n\t\t\t\t\tif (newIndex >= items.length) newIndex = items.length - 1;\n\t\t\t\t\tweighted.push(items[newIndex]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 25% chance to favor the second most chosen index\n\t\t\telse if (chance.bool({ likelihood: 25 })) {\n\t\t\t\tweighted.push(items[secondMostChosenIndex]);\n\t\t\t}\n\t\t\t// 15% chance to favor the third most chosen index\n\t\t\telse if (chance.bool({ likelihood: 15 })) {\n\t\t\t\tweighted.push(items[thirdMostChosenIndex]);\n\t\t\t}\n\t\t\t// Otherwise, pick a random item from the list\n\t\t\telse {\n\t\t\t\tweighted.push(chance.pickone(items));\n\t\t\t}\n\t\t}\n\t\treturn weighted;\n\t}"
597
+ }
598
+ },
599
+ "scdProps": {},
600
+ "mirrorProps": {},
601
+ "groupKeys": [],
602
+ "groupProps": {},
603
+ "lookupTables": []
604
+ },
605
+ "hooks": "function (record, type, meta) {\n\n\t\tconst NOW = dayjs();\n\t\t// const DATE_HOMEGROWN_LAUNCH = NOW.subtract(25, 'day');\n\t\t// const DATE_HOMEGROWN_IMPROVEMENT = NOW.subtract(10, 'day');\n\t\tconst OVER_THINGS_GET_BETTER = NOW.subtract(15, 'day');\n\n\t\tif (type === \"event\") {\n\t\t\tconst EVENT_TIME = dayjs(record.time);\n\n\t\t\tif (EVENT_TIME.isAfter(OVER_THINGS_GET_BETTER)) {\n\t\t\t\t// checkouts are bigger\n\t\t\t\tif (record.event === \"checkout\") {\n\t\t\t\t\trecord.amount = Math.round(record.amount * 1.5);\n\t\t\t\t}\n\n\t\t\t\t// videos are longer\n\t\t\t\tif (record.event === \"watch video\") {\n\t\t\t\t\trecord.watchTimeSec = Math.round(record.watchTimeSec * 1.5);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (EVENT_TIME.isBefore(OVER_THINGS_GET_BETTER)) {\n\t\t\t\t// tag 33% for removal (filtered in \"everything\" hook)\n\t\t\t\tif (chance.bool({ likelihood: 33 })) record._drop = true;\n\t\t\t}\n\t\t}\n\n\t\tif (type === \"everything\") {\n\n\t\t\t//custom themes purchase more:\n\t\t\tconst numCustomMode = record.filter(a => a.theme === 'custom').length;\n\t\t\tconst numLightMode = record.filter(a => a.theme === 'light').length;\n\t\t\tconst numDarkMode = record.filter(a => a.theme === 'dark').length;\n\t\t\tif (numCustomMode > numLightMode || numCustomMode > numDarkMode) {\n\t\t\t\t//triple their checkout events\n\t\t\t\tconst checkoutEvents = record.filter(a => a.event === 'checkout');\n\t\t\t\tconst newCheckouts = checkoutEvents.map(a => {\n\t\t\t\t\tconst randomInt = integer(-48, 48);\n\t\t\t\t\tconst newCheckout = {\n\t\t\t\t\t\t...a,\n\t\t\t\t\t\ttime: dayjs(a.time).add(randomInt, 'hour').toISOString(),\n\t\t\t\t\t\tevent: \"checkout\",\n\t\t\t\t\t\tamount: a.amount * 2,\n\t\t\t\t\t\tcoupon: \"50%OFF\"\n\t\t\t\t\t};\n\t\t\t\t\treturn newCheckout;\n\t\t\t\t});\n\t\t\t\trecord.push(...newCheckouts);\n\t\t\t}\n\n\t\t\t//users who watch low quality videos churn more:\n\t\t\tconst loQuality = [\"480p\", \"360p\", \"240p\"];\n\t\t\tconst lowQualityWatches = record.filter(a => a.event === 'watch video' && loQuality.includes(a.quality));\n\t\t\tconst highQualityWatches = record.filter(a => a.event === 'watch video' && !loQuality.includes(a.quality));\n\t\t\tif (lowQualityWatches.length > highQualityWatches.length) {\n\t\t\t\tif (flip()) {\n\t\t\t\t\t// find midpoint of records\n\t\t\t\t\tconst midpoint = Math.floor(record.length / 2);\n\t\t\t\t\trecord = record.slice(0, midpoint);\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Filter out events tagged for removal in the event hook\n\t\t\trecord = record.filter(e => !e._drop);\n\t\t}\n\n\t\treturn record;\n\t}",
606
+ "timestamp": "2026-04-10T01:39:07.585Z",
607
+ "version": "4.0"
608
+ }