make-mp-data 3.0.4 → 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.
- package/README.md +46 -0
- package/dungeons/array-of-object-lookup-schema.json +327 -0
- package/dungeons/array-of-object-lookup.js +28 -8
- package/dungeons/capstone/capstone-ic3.js +291 -0
- package/dungeons/capstone/capstone-ic4.js +598 -0
- package/dungeons/capstone/capstone-ic5.js +668 -0
- package/dungeons/capstone/generate-product-lookup.js +309 -0
- package/dungeons/ecommerce-schema.json +462 -0
- package/dungeons/{copilot.js → ecommerce.js} +77 -15
- package/dungeons/education-schema.json +2409 -0
- package/dungeons/education.js +206 -442
- package/dungeons/fintech-schema.json +14034 -0
- package/dungeons/fintech.js +110 -389
- package/dungeons/foobar-schema.json +403 -0
- package/dungeons/foobar.js +27 -4
- package/dungeons/food-delivery-schema.json +192 -0
- package/dungeons/food-delivery.js +602 -0
- package/dungeons/food-schema.json +1152 -0
- package/dungeons/food.js +150 -383
- package/dungeons/gaming-schema.json +1270 -0
- package/dungeons/gaming.js +143 -3
- package/dungeons/insurance-application-schema.json +204 -0
- package/dungeons/insurance-application.js +605 -0
- package/dungeons/media-schema.json +906 -0
- package/dungeons/media.js +221 -391
- package/dungeons/retention-cadence-schema.json +78 -0
- package/dungeons/retention-cadence.js +35 -1
- package/dungeons/rpg-schema.json +4526 -0
- package/dungeons/rpg.js +130 -388
- package/dungeons/sanity-schema.json +255 -0
- package/dungeons/sanity.js +21 -10
- package/dungeons/sass-schema.json +1291 -0
- package/dungeons/sass.js +210 -337
- package/dungeons/scd-schema.json +919 -0
- package/dungeons/scd.js +38 -10
- package/dungeons/simple-schema.json +608 -0
- package/dungeons/simple.js +48 -11
- package/dungeons/simplest-schema.json +1418 -0
- package/dungeons/simplest.js +392 -0
- package/dungeons/social-schema.json +1118 -0
- package/dungeons/social.js +124 -365
- package/dungeons/text-generation-schema.json +3096 -0
- package/dungeons/text-generation.js +71 -0
- package/index.js +6 -3
- package/lib/core/config-validator.js +18 -0
- package/lib/core/storage.js +5 -5
- package/lib/generators/events.js +4 -4
- package/lib/orchestrators/mixpanel-sender.js +12 -7
- package/lib/orchestrators/user-loop.js +14 -6
- package/lib/templates/soup-presets.js +188 -0
- package/lib/utils/utils.js +52 -6
- package/package.json +1 -1
- package/types.d.ts +20 -3
- package/dungeons/adspend.js +0 -117
- package/dungeons/anon.js +0 -128
- package/dungeons/benchmark-heavy.js +0 -240
- package/dungeons/benchmark-light.js +0 -126
- package/dungeons/big.js +0 -226
- package/dungeons/business.js +0 -391
- package/dungeons/complex.js +0 -428
- package/dungeons/experiments.js +0 -137
- package/dungeons/funnels.js +0 -309
- package/dungeons/mil.js +0 -323
- package/dungeons/mirror.js +0 -160
- package/dungeons/soup-test.js +0 -52
- package/dungeons/streaming.js +0 -372
- package/dungeons/strict-event-test.js +0 -30
- package/dungeons/student-teacher.js +0 -438
- package/dungeons/too-big-events.js +0 -203
- package/dungeons/user-agent.js +0 -209
package/dungeons/mirror.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
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
|
-
import Chance from 'chance';
|
|
12
|
-
const chance = new Chance();
|
|
13
|
-
import dayjs from "dayjs";
|
|
14
|
-
import utc from "dayjs/plugin/utc.js";
|
|
15
|
-
dayjs.extend(utc);
|
|
16
|
-
import { uid, comma } from 'ak-tools';
|
|
17
|
-
import { weighNumRange, date, integer } from "../lib/utils/utils.js";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/** @type {import('../types').Dungeon} */
|
|
21
|
-
const config = {
|
|
22
|
-
token: "",
|
|
23
|
-
seed: "mirror me",
|
|
24
|
-
numDays: 30, //how many days worth of data
|
|
25
|
-
numEvents: 10000, //how many events
|
|
26
|
-
numUsers: 1000, //how many users
|
|
27
|
-
format: 'json', //csv or json
|
|
28
|
-
region: "US",
|
|
29
|
-
hasAnonIds: true, //if true, anonymousIds are created for each user
|
|
30
|
-
hasSessionIds: false, //if true, hasSessionIds are created for each user
|
|
31
|
-
|
|
32
|
-
events: [
|
|
33
|
-
{
|
|
34
|
-
event: "foo",
|
|
35
|
-
weight: 10,
|
|
36
|
-
properties: {}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
event: "bar",
|
|
40
|
-
weight: 9,
|
|
41
|
-
properties: {}
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
event: "baz",
|
|
45
|
-
weight: 8,
|
|
46
|
-
properties: {}
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
event: "qux",
|
|
50
|
-
weight: 7,
|
|
51
|
-
properties: {}
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
event: "garply",
|
|
55
|
-
weight: 6,
|
|
56
|
-
properties: {}
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
event: "durtle",
|
|
60
|
-
weight: 5,
|
|
61
|
-
properties: {}
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
event: "linny",
|
|
65
|
-
weight: 4,
|
|
66
|
-
properties: {}
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
event: "fonk",
|
|
70
|
-
weight: 3,
|
|
71
|
-
properties: {}
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
event: "crumn",
|
|
75
|
-
weight: 2,
|
|
76
|
-
properties: {}
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
event: "yak",
|
|
80
|
-
weight: 1,
|
|
81
|
-
properties: {}
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
superProps: {
|
|
85
|
-
color: ["red", "orange", "yellow", "green", "blue", "indigo", "violet"],
|
|
86
|
-
deleteMe: ["hello", "world", "i", "should", "be", "deleted"],
|
|
87
|
-
updateMe: weighNumRange(1, 10)
|
|
88
|
-
},
|
|
89
|
-
userProps: {
|
|
90
|
-
title: chance.profession.bind(chance),
|
|
91
|
-
luckyNumber: weighNumRange(42, 420),
|
|
92
|
-
spiritAnimal: ["duck", "dog", "otter", "penguin", "cat", "elephant", "lion", "cheetah", "giraffe", "zebra", "rhino", "hippo", "whale", "dolphin", "shark", "octopus", "squid", "jellyfish", "starfish", "seahorse", "crab", "lobster", "shrimp", "clam", "snail", "slug", "butterfly", "moth", "bee", "wasp", "ant", "beetle", "ladybug", "caterpillar", "centipede", "millipede", "scorpion", "spider", "tarantula", "tick", "mite", "mosquito", "fly", "dragonfly", "damselfly", "grasshopper", "cricket", "locust", "mantis", "cockroach", "termite", "praying mantis", "walking stick", "stick bug", "leaf insect", "lacewing", "aphid", "cicada", "thrips", "psyllid", "scale insect", "whitefly", "mealybug", "planthopper", "leafhopper", "treehopper", "flea", "louse", "bedbug", "flea beetle", "weevil", "longhorn beetle", "leaf beetle", "tiger beetle", "ground beetle", "lady beetle", "firefly", "click beetle", "rove beetle", "scarab beetle", "dung beetle", "stag beetle", "rhinoceros beetle", "hercules beetle", "goliath beetle", "jewel beetle", "tortoise beetle"]
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
scdProps: {},
|
|
96
|
-
mirrorProps: {
|
|
97
|
-
"newlyCreated": {
|
|
98
|
-
events: "*",
|
|
99
|
-
strategy: "create",
|
|
100
|
-
values: ["fickle", "buckle", "tickle", "mackle"]
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
"deleteMe": {
|
|
104
|
-
events: "*",
|
|
105
|
-
strategy: "delete",
|
|
106
|
-
values: ["ignored"]
|
|
107
|
-
},
|
|
108
|
-
"fillMe": {
|
|
109
|
-
events: "*",
|
|
110
|
-
strategy: "fill",
|
|
111
|
-
values: ["deal", "with", "it"]
|
|
112
|
-
},
|
|
113
|
-
"updateMe": {
|
|
114
|
-
events: "*",
|
|
115
|
-
strategy: "update",
|
|
116
|
-
values: weighNumRange(11, 20)
|
|
117
|
-
} },
|
|
118
|
-
groupKeys: [],
|
|
119
|
-
groupProps: {},
|
|
120
|
-
lookupTables: [],
|
|
121
|
-
hook: function (record, type, meta) {
|
|
122
|
-
// --- user hook: segment users by spirit animal ---
|
|
123
|
-
if (type === "user") {
|
|
124
|
-
const aquatic = ["whale", "dolphin", "shark", "octopus", "squid", "jellyfish", "seahorse", "crab", "lobster", "shrimp"];
|
|
125
|
-
record.segment = aquatic.includes(record.spiritAnimal) ? "aquatic" : "terrestrial";
|
|
126
|
-
return record;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// --- event hook: color-based property boost ---
|
|
130
|
-
if (type === "event") {
|
|
131
|
-
// warm-colored events get a higher updateMe value
|
|
132
|
-
const warmColors = ["red", "orange", "yellow"];
|
|
133
|
-
if (warmColors.includes(record.color)) {
|
|
134
|
-
record.updateMe = (record.updateMe || 5) + 10;
|
|
135
|
-
}
|
|
136
|
-
return record;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// --- everything hook: inject a "milestone" event for users with 8+ events ---
|
|
140
|
-
if (type === "everything") {
|
|
141
|
-
if (record.length >= 8) {
|
|
142
|
-
const lastEvent = record[record.length - 1];
|
|
143
|
-
record.push({
|
|
144
|
-
event: "milestone_reached",
|
|
145
|
-
time: lastEvent.time,
|
|
146
|
-
user_id: lastEvent.user_id,
|
|
147
|
-
color: lastEvent.color,
|
|
148
|
-
milestone: record.length
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return record;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return record;
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
export default config;
|
package/dungeons/soup-test.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bare dungeon for testing TimeSoup time distribution.
|
|
3
|
-
* No hooks, no funnels, no ad spend — pure event generation
|
|
4
|
-
* so TimeSoup's distribution is the only thing shaping the data.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/** @type {import('../types').Dungeon} */
|
|
8
|
-
const config = {
|
|
9
|
-
token: "",
|
|
10
|
-
seed: "soup-test",
|
|
11
|
-
numDays: 100,
|
|
12
|
-
numEvents: 50_000,
|
|
13
|
-
numUsers: 500,
|
|
14
|
-
format: "json",
|
|
15
|
-
writeToDisk: true,
|
|
16
|
-
concurrency: 1,
|
|
17
|
-
hasAdSpend: false,
|
|
18
|
-
hasCampaigns: false,
|
|
19
|
-
hasLocation: false,
|
|
20
|
-
hasAvatar: false,
|
|
21
|
-
hasBrowser: false,
|
|
22
|
-
hasAnonIds: false,
|
|
23
|
-
hasSessionIds: false,
|
|
24
|
-
hasAndroidDevices: true,
|
|
25
|
-
hasIOSDevices: true,
|
|
26
|
-
hasDesktopDevices: true,
|
|
27
|
-
isAnonymous: false,
|
|
28
|
-
alsoInferFunnels: false,
|
|
29
|
-
verbose: true,
|
|
30
|
-
batchSize: 2_500_000,
|
|
31
|
-
name: "soup-test",
|
|
32
|
-
|
|
33
|
-
// Uses default soup params — change these to test different distributions
|
|
34
|
-
// soup: { peaks: 5, deviation: 2, mean: 0 },
|
|
35
|
-
|
|
36
|
-
events: [
|
|
37
|
-
{ event: "page_view", weight: 5, isFirstEvent: true, properties: {} },
|
|
38
|
-
{ event: "click", weight: 3, properties: {} },
|
|
39
|
-
{ event: "purchase", weight: 1, properties: {} },
|
|
40
|
-
],
|
|
41
|
-
|
|
42
|
-
superProps: {},
|
|
43
|
-
userProps: {},
|
|
44
|
-
funnels: [],
|
|
45
|
-
scdProps: {},
|
|
46
|
-
mirrorProps: {},
|
|
47
|
-
groupKeys: [],
|
|
48
|
-
groupProps: {},
|
|
49
|
-
lookupTables: [],
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default config;
|
package/dungeons/streaming.js
DELETED
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const SEED = "my-seed";
|
|
3
|
-
import dayjs from 'dayjs';
|
|
4
|
-
import utc from 'dayjs/plugin/utc.js';
|
|
5
|
-
dayjs.extend(utc);
|
|
6
|
-
import 'dotenv/config';
|
|
7
|
-
import * as u from "../lib/utils/utils.js";
|
|
8
|
-
import * as v from 'ak-tools';
|
|
9
|
-
const chance = u.initChance(SEED);
|
|
10
|
-
const num_users = 10_000;
|
|
11
|
-
const days = 125;
|
|
12
|
-
|
|
13
|
-
/** @typedef {import("../types.js").Dungeon} Config */
|
|
14
|
-
|
|
15
|
-
function genIds(numIds = 1000) {
|
|
16
|
-
const ids = [];
|
|
17
|
-
for (let i = 0; i < numIds; i++) {
|
|
18
|
-
ids.push(v.uid());
|
|
19
|
-
}
|
|
20
|
-
return ids;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const videoIds = genIds();
|
|
24
|
-
const channelIds = genIds(100);
|
|
25
|
-
|
|
26
|
-
/** @type {Config} */
|
|
27
|
-
const config = {
|
|
28
|
-
// token: "",
|
|
29
|
-
seed: `LFG!`, //,
|
|
30
|
-
numDays: days,
|
|
31
|
-
numEvents: num_users * 63,
|
|
32
|
-
numUsers: num_users,
|
|
33
|
-
hasAnonIds: false,
|
|
34
|
-
hasSessionIds: false,
|
|
35
|
-
format: "csv",
|
|
36
|
-
alsoInferFunnels: false,
|
|
37
|
-
hasLocation: false,
|
|
38
|
-
hasAndroidDevices: true,
|
|
39
|
-
hasIOSDevices: true,
|
|
40
|
-
hasDesktopDevices: true,
|
|
41
|
-
hasBrowser: false,
|
|
42
|
-
hasCampaigns: false,
|
|
43
|
-
isAnonymous: false,
|
|
44
|
-
hasAdSpend: false,
|
|
45
|
-
|
|
46
|
-
hasAvatar: false,
|
|
47
|
-
|
|
48
|
-
batchSize: 2_500_000,
|
|
49
|
-
concurrency: 1,
|
|
50
|
-
writeToDisk: false,
|
|
51
|
-
|
|
52
|
-
funnels: [],
|
|
53
|
-
|
|
54
|
-
events: [
|
|
55
|
-
{
|
|
56
|
-
event: "watch video",
|
|
57
|
-
weight: 55,
|
|
58
|
-
properties: {
|
|
59
|
-
video_id: u.pickAWinner(videoIds),
|
|
60
|
-
"watch percent": u.pickAWinner([
|
|
61
|
-
25,
|
|
62
|
-
50,
|
|
63
|
-
75,
|
|
64
|
-
100,
|
|
65
|
-
]),
|
|
66
|
-
"watch time": u.weighNumRange(1, 65, .89, 100),
|
|
67
|
-
|
|
68
|
-
"category": [
|
|
69
|
-
"comedy",
|
|
70
|
-
"educational",
|
|
71
|
-
"music",
|
|
72
|
-
"sports",
|
|
73
|
-
"news",
|
|
74
|
-
"gaming",
|
|
75
|
-
"travel",
|
|
76
|
-
],
|
|
77
|
-
quality: [
|
|
78
|
-
"240p",
|
|
79
|
-
"360p",
|
|
80
|
-
"480p",
|
|
81
|
-
"720p",
|
|
82
|
-
"1080p",
|
|
83
|
-
"4k",
|
|
84
|
-
],
|
|
85
|
-
autoplay: [
|
|
86
|
-
true,
|
|
87
|
-
false,
|
|
88
|
-
],
|
|
89
|
-
fullscreen: [
|
|
90
|
-
true,
|
|
91
|
-
false,
|
|
92
|
-
],
|
|
93
|
-
"ads?": [
|
|
94
|
-
true, true,
|
|
95
|
-
false,
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
event: "like",
|
|
101
|
-
weight: 10,
|
|
102
|
-
properties: {
|
|
103
|
-
video_id: u.pickAWinner(videoIds),
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
event: "comment",
|
|
108
|
-
weight: 5,
|
|
109
|
-
properties: {
|
|
110
|
-
video_id: u.pickAWinner(videoIds),
|
|
111
|
-
comment_length: [
|
|
112
|
-
"short",
|
|
113
|
-
"medium",
|
|
114
|
-
"long",
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
event: "share",
|
|
120
|
-
weight: 3,
|
|
121
|
-
properties: {
|
|
122
|
-
video_id: u.pickAWinner(videoIds),
|
|
123
|
-
"share network": [
|
|
124
|
-
"facebook",
|
|
125
|
-
"twitter",
|
|
126
|
-
"reddit",
|
|
127
|
-
"email",
|
|
128
|
-
"whatsapp",
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
event: "search",
|
|
134
|
-
weight: 25,
|
|
135
|
-
properties: {
|
|
136
|
-
search_term: [
|
|
137
|
-
"cats",
|
|
138
|
-
"dogs",
|
|
139
|
-
"tutorial",
|
|
140
|
-
"news",
|
|
141
|
-
"music",
|
|
142
|
-
],
|
|
143
|
-
"results count": u.pickAWinner([
|
|
144
|
-
0,
|
|
145
|
-
1,
|
|
146
|
-
2,
|
|
147
|
-
3,
|
|
148
|
-
4,
|
|
149
|
-
5,
|
|
150
|
-
6, 7, 8, 9, 10
|
|
151
|
-
], 5),
|
|
152
|
-
"search category": [
|
|
153
|
-
"all",
|
|
154
|
-
"channels",
|
|
155
|
-
"playlists",
|
|
156
|
-
],
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
event: "subscribe",
|
|
161
|
-
weight: 7,
|
|
162
|
-
properties: {
|
|
163
|
-
channel_id: u.pickAWinner(genIds()),
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
event: "unsubscribe",
|
|
168
|
-
weight: 2,
|
|
169
|
-
properties: {
|
|
170
|
-
channel_id: u.pickAWinner(genIds()),
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
event: "create playlist",
|
|
175
|
-
weight: 4,
|
|
176
|
-
properties: {
|
|
177
|
-
"play list name": [
|
|
178
|
-
"favorites",
|
|
179
|
-
"watch later",
|
|
180
|
-
"my music",
|
|
181
|
-
"funny videos",
|
|
182
|
-
"educational",
|
|
183
|
-
],
|
|
184
|
-
privacy: [
|
|
185
|
-
"public",
|
|
186
|
-
"private",
|
|
187
|
-
"unlisted",
|
|
188
|
-
],
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
event: "account signup",
|
|
193
|
-
weight: 1,
|
|
194
|
-
isFirstEvent: true,
|
|
195
|
-
properties: {
|
|
196
|
-
"sign up method": [
|
|
197
|
-
"email",
|
|
198
|
-
"google",
|
|
199
|
-
"facebook",
|
|
200
|
-
],
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
event: "account login",
|
|
205
|
-
weight: 9,
|
|
206
|
-
properties: {
|
|
207
|
-
"log in method": [
|
|
208
|
-
"email",
|
|
209
|
-
"google",
|
|
210
|
-
"facebook",
|
|
211
|
-
],
|
|
212
|
-
success: [
|
|
213
|
-
true,
|
|
214
|
-
false,
|
|
215
|
-
],
|
|
216
|
-
error_message: [
|
|
217
|
-
"incorrect password",
|
|
218
|
-
"user not found",
|
|
219
|
-
"account locked",
|
|
220
|
-
],
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
event: "$experiment_started",
|
|
225
|
-
weight: 5,
|
|
226
|
-
isSessionStartEvent: true,
|
|
227
|
-
properties: {
|
|
228
|
-
"$experiment_type": "ak_ad_hoc",
|
|
229
|
-
"Experiment name": "show results on empty search",
|
|
230
|
-
"Variant name": ["feature enabled", "feature disabled"],
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
],
|
|
234
|
-
superProps: {
|
|
235
|
-
platform: [
|
|
236
|
-
"web",
|
|
237
|
-
"ios",
|
|
238
|
-
"android",
|
|
239
|
-
],
|
|
240
|
-
network_type: [
|
|
241
|
-
"wifi",
|
|
242
|
-
"cellular",
|
|
243
|
-
],
|
|
244
|
-
},
|
|
245
|
-
userProps: {
|
|
246
|
-
subscription_status: [
|
|
247
|
-
"free",
|
|
248
|
-
"free",
|
|
249
|
-
"premium",
|
|
250
|
-
],
|
|
251
|
-
age_range: [
|
|
252
|
-
"13-17",
|
|
253
|
-
"18-24",
|
|
254
|
-
"25-34",
|
|
255
|
-
"35-44",
|
|
256
|
-
"45-54",
|
|
257
|
-
"55+",
|
|
258
|
-
],
|
|
259
|
-
preferred_genre: [
|
|
260
|
-
"comedy",
|
|
261
|
-
"action",
|
|
262
|
-
"drama",
|
|
263
|
-
"sci-fi",
|
|
264
|
-
"horror",
|
|
265
|
-
],
|
|
266
|
-
upload_count: [
|
|
267
|
-
0,
|
|
268
|
-
1,
|
|
269
|
-
5,
|
|
270
|
-
10,
|
|
271
|
-
20,
|
|
272
|
-
],
|
|
273
|
-
following_count: [
|
|
274
|
-
0,
|
|
275
|
-
10,
|
|
276
|
-
50,
|
|
277
|
-
100,
|
|
278
|
-
500,
|
|
279
|
-
],
|
|
280
|
-
dark_mode_enabled: [
|
|
281
|
-
true,
|
|
282
|
-
false,
|
|
283
|
-
],
|
|
284
|
-
},
|
|
285
|
-
|
|
286
|
-
scdProps: {},
|
|
287
|
-
mirrorProps: {},
|
|
288
|
-
groupKeys: [],
|
|
289
|
-
groupProps: {},
|
|
290
|
-
lookupTables: [],
|
|
291
|
-
hook: function (record, type, meta) {
|
|
292
|
-
const NOW = dayjs();
|
|
293
|
-
const TIME_WHEN_SEARCH_GOT_BAD = NOW.subtract(21, 'days');
|
|
294
|
-
const TIME_WE_EXPERIMENTED = NOW.subtract(14, 'days');
|
|
295
|
-
|
|
296
|
-
if (type === "event") {
|
|
297
|
-
const EVENT_TIME = dayjs(record.time);
|
|
298
|
-
//when search got bad, people started searching less
|
|
299
|
-
//and got fewer results
|
|
300
|
-
if (EVENT_TIME.isAfter(TIME_WHEN_SEARCH_GOT_BAD)) {
|
|
301
|
-
if (chance.bool({ likelihood: 50 })) {
|
|
302
|
-
if (record.event === "search") {
|
|
303
|
-
record["results count"] = 0;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
if (chance.bool({ likelihood: 18 })) {
|
|
308
|
-
record._drop = true;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
if (EVENT_TIME.isBefore(TIME_WE_EXPERIMENTED)) {
|
|
313
|
-
if (record.event === "$experiment_started") {
|
|
314
|
-
record._drop = true;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (type === "everything") {
|
|
322
|
-
// Filter out events tagged for dropping by the event hook
|
|
323
|
-
record = record.filter(e => !e._drop);
|
|
324
|
-
|
|
325
|
-
const hadFeatureEnabled = record.some(event =>
|
|
326
|
-
event.event === "$experiment_started" &&
|
|
327
|
-
event["Variant name"] === "feature enabled"
|
|
328
|
-
);
|
|
329
|
-
|
|
330
|
-
const hadFeatureDisabled = record.some(event =>
|
|
331
|
-
event.event === "$experiment_started" &&
|
|
332
|
-
event["Variant name"] === "feature disabled"
|
|
333
|
-
);
|
|
334
|
-
|
|
335
|
-
record.forEach((event, idx) => {
|
|
336
|
-
const EVENT_TIME = dayjs(event.time);
|
|
337
|
-
|
|
338
|
-
if (EVENT_TIME.isAfter(TIME_WE_EXPERIMENTED)) {
|
|
339
|
-
if (hadFeatureEnabled) {
|
|
340
|
-
// Users with feature enabled variant have a higher likelihood of subscribing.
|
|
341
|
-
// Add an extra subscribe event 50% of the time immediately after watching a video.
|
|
342
|
-
if (event.event === "watch video" && chance.bool({ likelihood: 75 })) {
|
|
343
|
-
// watch time goes up
|
|
344
|
-
event["watch time"] = v.round(event["watch time"] * 1.7);
|
|
345
|
-
const subscribeEvent = {
|
|
346
|
-
event: "subscribe",
|
|
347
|
-
time: dayjs(event.time).add(1, 'minute').toISOString(),
|
|
348
|
-
user_id: event.user_id,
|
|
349
|
-
};
|
|
350
|
-
record.splice(idx + 1, 0, subscribeEvent);
|
|
351
|
-
}
|
|
352
|
-
} else if (hadFeatureDisabled) {
|
|
353
|
-
// Users with feature disabled variant have lower likelihood of subscribing.
|
|
354
|
-
// Drop subscribe events 50% of the time.
|
|
355
|
-
if (event.event === "subscribe" && chance.bool({ likelihood: 75 })) {
|
|
356
|
-
record.splice(idx, 1);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// watch time goes down
|
|
360
|
-
if (event.event === "watch video") {
|
|
361
|
-
event["watch time"] = v.round(event["watch time"] * 0.5);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
return record;
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
export default config;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: "strict-event-count-test",
|
|
3
|
-
seed: "test-123",
|
|
4
|
-
|
|
5
|
-
// We want exactly 1000 events
|
|
6
|
-
numEvents: 1000,
|
|
7
|
-
|
|
8
|
-
// Even though we specify 500 users, we should stop early when we hit 1000 events
|
|
9
|
-
numUsers: 500,
|
|
10
|
-
|
|
11
|
-
numDays: 7,
|
|
12
|
-
|
|
13
|
-
// Enable strict event count - this will bail out at exactly numEvents
|
|
14
|
-
strictEventCount: true,
|
|
15
|
-
|
|
16
|
-
verbose: true,
|
|
17
|
-
writeToDisk: false,
|
|
18
|
-
format: 'json',
|
|
19
|
-
|
|
20
|
-
events: [
|
|
21
|
-
{ event: "page_view", weight: 5 },
|
|
22
|
-
{ event: "click", weight: 3 },
|
|
23
|
-
{ event: "purchase", weight: 1 }
|
|
24
|
-
],
|
|
25
|
-
|
|
26
|
-
userProps: {
|
|
27
|
-
plan: ["free", "pro", "enterprise"],
|
|
28
|
-
region: ["US", "EU", "APAC"]
|
|
29
|
-
}
|
|
30
|
-
};
|