picked 0.0.111-next.2 → 0.0.111-next.4
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/dist/.tsbuildinfo +1 -1
- package/docs/explanation/app-authentication.md +178 -0
- package/docs/explanation/apps.md +169 -0
- package/docs/explanation/conditions-and-the-logic-engine.md +12 -2
- package/docs/explanation/feature-flag-allocation.md +5 -3
- package/docs/how-to/apps/add-a-page-to-the-dashboard.md +257 -0
- package/docs/how-to/apps/add-a-workflow-tool.md +199 -0
- package/docs/how-to/apps/add-an-mcp-server-to-an-app.md +210 -0
- package/docs/how-to/apps/connect-a-third-party-service-with-oauth.md +307 -0
- package/docs/how-to/apps/create-an-app-in-the-dashboard.md +162 -0
- package/docs/how-to/apps/deploy-an-app.md +201 -0
- package/docs/how-to/apps/develop-an-app-locally.md +152 -0
- package/docs/how-to/apps/host-an-app-on-vercel.md +226 -0
- package/docs/how-to/apps/install-an-app.md +116 -0
- package/docs/how-to/apps/link-to-an-installation-from-your-site.md +134 -0
- package/docs/how-to/apps/read-project-data-from-an-app.md +225 -0
- package/docs/how-to/apps/rotate-an-app-key.md +130 -0
- package/docs/how-to/apps/run-code-when-a-workspace-publishes.md +148 -0
- package/docs/how-to/apps/store-data-for-an-installation.md +230 -0
- package/docs/how-to/apps/test-an-app.md +359 -0
- package/docs/how-to/apps/upgrade-or-uninstall-an-app.md +97 -0
- package/docs/how-to/apps/use-an-app-tool-in-a-workflow.md +112 -0
- package/docs/index.md +6 -3
- package/docs/reference/apps/app-kit.md +811 -0
- package/docs/reference/apps/environment.md +116 -0
- package/docs/reference/apps/manifest.md +311 -0
- package/docs/reference/apps/protocol.md +497 -0
- package/docs/reference/dashboard/apps.md +504 -0
- package/docs/reference/dashboard/external-apis.md +5 -0
- package/docs/reference/dashboard/features.mdx +5 -5
- package/docs/reference/dashboard/labels.md +25 -8
- package/docs/reference/dashboard/lead-search.md +6 -6
- package/docs/reference/dashboard/reports.mdx +13 -5
- package/docs/reference/dashboard/workflow-tools.md +14 -0
- package/docs/reference/glossary.md +153 -140
- package/docs/reference/management-api/authentication.md +36 -27
- package/docs/reference/management-api/authorization-and-scopes.md +73 -21
- package/docs/reference/management-api/schema/api-key.md +10 -10
- package/docs/reference/management-api/schema/app.md +726 -0
- package/docs/reference/management-api/schema/auth.md +7 -7
- package/docs/reference/management-api/schema/common.md +54 -35
- package/docs/reference/management-api/schema/feature.md +1 -1
- package/docs/reference/management-api/schema/feedback.md +1 -1
- package/docs/reference/management-api/schema/index.md +35 -20
- package/docs/reference/management-api/schema/label.md +31 -8
- package/docs/reference/management-api/schema/organization.md +66 -66
- package/docs/reference/management-api/schema/project.md +5 -5
- package/docs/reference/management-api/schema/report.md +1 -1
- package/docs/reference/management-api/schema/shopify.md +19 -19
- package/docs/reference/management-api/schema/tenant-branding.md +16 -0
- package/docs/reference/management-api/schema/workflow.md +6 -1
- package/docs/reference/management-api/schema/workspace.md +2 -2
- package/docs/reference/sdk/analytics-events.md +42 -36
- package/docs/reference/sdk/conditions.md +3 -3
- package/docs/reference/sdk/fields.md +5 -4
- package/docs/reference/sdk/index.md +4 -4
- package/docs/reference/sdk/plugins/create-experience.md +11 -9
- package/docs/reference/sdk/plugins/hotjar.md +2 -2
- package/docs/reference/sdk/plugins/sentry.md +2 -2
- package/docs/reference/sdk/plugins/shopify.md +2 -2
- package/docs/reference/sdk/predicates.md +5 -5
- package/docs/reference/sdk/ssr/index.md +4 -3
- package/docs/reference/sdk/ssr/rendering-and-hydration.md +30 -0
- package/docs/reference/sdk/type-generation.md +24 -19
- package/docs/reference/tools/admin-api-client.md +15 -0
- package/docs/reference/tools/cli.md +192 -41
- package/docs/reference/tools/mcp.md +30 -9
- package/docs/tutorials/first-app.md +308 -0
- package/package.json +4 -4
- package/docs/explanation/how-pickedql-works.md +0 -76
- package/docs/how-to/analytics/index.md +0 -324
- package/docs/reference/management-api/schema/analytics.md +0 -75
- package/docs/reference/pickedql/data-sources.md +0 -174
- package/docs/reference/pickedql/dimensions.md +0 -103
- package/docs/reference/pickedql/filtering.md +0 -64
- package/docs/reference/pickedql/index.md +0 -18
- package/docs/reference/pickedql/schema.md +0 -172
- package/docs/reference/pickedql/virtual-functions.md +0 -248
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "picked",
|
|
3
3
|
"description": "The Picked SDK front door: the client, the picked.config helpers, and the picked CLI in one install",
|
|
4
|
-
"version": "0.0.111-next.
|
|
4
|
+
"version": "0.0.111-next.4",
|
|
5
5
|
"bin": {
|
|
6
6
|
"picked": "dist/esm/bin.js"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@picked/cli": "0.0.111-next.
|
|
10
|
-
"@picked/config": "0.0.111-next.
|
|
9
|
+
"@picked/cli": "0.0.111-next.4",
|
|
10
|
+
"@picked/config": "0.0.111-next.4"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@picked/client": "workspace:*",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"main": "./dist/cjs/index.js",
|
|
65
65
|
"module": "./dist/esm/index.js",
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@picked/client": "0.0.111-next.
|
|
67
|
+
"@picked/client": "0.0.111-next.4"
|
|
68
68
|
},
|
|
69
69
|
"private": false,
|
|
70
70
|
"publishConfig": {
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
type: explanation
|
|
3
|
-
layout: docs
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# About PickedQL
|
|
7
|
-
|
|
8
|
-
PickedQL is SQL over your Picked analytics data, but it is not only SQL. It expands what
|
|
9
|
-
you write before it runs. Why add a layer at all, and not give you the tables?
|
|
10
|
-
|
|
11
|
-
## The problem it answers
|
|
12
|
-
|
|
13
|
-
An A/B test question is short to ask, and the SQL behind it is not. Take one question:
|
|
14
|
-
"How many users are in the control group?" It needs four things. It needs a filter on the
|
|
15
|
-
variant, a count of distinct users, a join to each dimension in the group, and a tenant
|
|
16
|
-
filter.
|
|
17
|
-
|
|
18
|
-
Write that by hand for every question, and most of each query is the same text again.
|
|
19
|
-
|
|
20
|
-
PickedQL lets you write the short version:
|
|
21
|
-
|
|
22
|
-
```sql
|
|
23
|
-
SELECT control_users(), variant_users()
|
|
24
|
-
FROM metrics
|
|
25
|
-
WHERE project_id = 'your-project-id'
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## What it expands
|
|
29
|
-
|
|
30
|
-
**Virtual tables.** A name such as `metrics` maps to the real tables below it. You name
|
|
31
|
-
the thing that you ask about, and not the storage.
|
|
32
|
-
|
|
33
|
-
**Virtual functions.** `control_users()` expands to a full aggregate expression. The
|
|
34
|
-
definition lives in one place, so every report that counts control users counts them the
|
|
35
|
-
same way.
|
|
36
|
-
|
|
37
|
-
**Automatic joins.** Point at a dimension column such as `device_category` or
|
|
38
|
-
`country_code` and PickedQL adds the `LEFT JOIN` for you. This gives you the most: a
|
|
39
|
-
dimension that you did not join is the most common reason for a wrong answer that looks
|
|
40
|
-
correct.
|
|
41
|
-
|
|
42
|
-
**SQL passthrough.** Standard SQL still works next to a virtual function, and that
|
|
43
|
-
includes `CASE WHEN`, window functions, and subqueries. The layer adds; it does not
|
|
44
|
-
restrict.
|
|
45
|
-
|
|
46
|
-
## Why every query must carry a tenant filter
|
|
47
|
-
|
|
48
|
-
Every query must carry a tenant filter in its `WHERE` clause. That filter is `project_id`
|
|
49
|
-
for most tables. The `projects` table uses `id` instead, because there the row ID *is* the
|
|
50
|
-
project ID.
|
|
51
|
-
|
|
52
|
-
PickedQL reads that filter and checks your permission for that project. The filter is
|
|
53
|
-
therefore not a convention that you can forget. Without one, the query does not run.
|
|
54
|
-
The isolation is a property of the language, and not of each author.
|
|
55
|
-
|
|
56
|
-
## Which table to reach for
|
|
57
|
-
|
|
58
|
-
| Table | Use it for |
|
|
59
|
-
| --- | --- |
|
|
60
|
-
| `metrics` | A dashboard. The data is aggregated first, so it is much faster than raw events. |
|
|
61
|
-
| `events` | Anything deeper. Raw events let you build any breakdown or funnel. |
|
|
62
|
-
| `experience_journey` | A sankey or a funnel chart. One line of SQL returns `source, target, users`. |
|
|
63
|
-
|
|
64
|
-
Note what `experience_journey` does for you. It builds the eight common table expressions
|
|
65
|
-
that a path analysis needs. Those remove the duplicates, rank the top paths, and call
|
|
66
|
-
`lagInFrame`. You pass your parameters in the `WHERE` clause.
|
|
67
|
-
|
|
68
|
-
Some reference columns are free on `events`. `step_title`, `experience_title`, and
|
|
69
|
-
`project_name` come from reference tables that PickedQL joins for you.
|
|
70
|
-
|
|
71
|
-
## Related
|
|
72
|
-
|
|
73
|
-
- [PickedQL](/reference/pickedql) — the language surface.
|
|
74
|
-
- [Data sources](/reference/pickedql/data-sources) — every table.
|
|
75
|
-
- [Virtual functions](/reference/pickedql/virtual-functions) — every function.
|
|
76
|
-
- [How to run an analytics query](/how-to/analytics) — worked examples.
|
|
@@ -1,324 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
type: how-to
|
|
3
|
-
layout: docs
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# How to run an analytics query
|
|
7
|
-
|
|
8
|
-
This guide gives you a query for each common analytics question. Copy one, put your own
|
|
9
|
-
project ID in the `WHERE` clause, and run it.
|
|
10
|
-
|
|
11
|
-
Every query must carry a tenant filter. See
|
|
12
|
-
[About PickedQL](/explanation/how-pickedql-works) for why, and
|
|
13
|
-
[Data sources](/reference/pickedql/data-sources) for every table.
|
|
14
|
-
|
|
15
|
-
## Daily A/B test trend
|
|
16
|
-
|
|
17
|
-
```sql
|
|
18
|
-
SELECT
|
|
19
|
-
project_local_date,
|
|
20
|
-
control_users() AS control,
|
|
21
|
-
variant_users() AS variant
|
|
22
|
-
FROM metrics
|
|
23
|
-
WHERE project_id = '{{ your project ID }}'
|
|
24
|
-
AND project_local_date >= '2026-04-01'
|
|
25
|
-
GROUP BY project_local_date
|
|
26
|
-
ORDER BY project_local_date
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Result:**
|
|
30
|
-
|
|
31
|
-
| project_local_date | control | variant |
|
|
32
|
-
| ----------------- | ------- | ------- |
|
|
33
|
-
| 2026-04-11 | 4361 | 101 |
|
|
34
|
-
| 2026-04-12 | 4178 | 126 |
|
|
35
|
-
| 2026-04-13 | 5008 | 176 |
|
|
36
|
-
|
|
37
|
-
## Conversion rate uplift by date
|
|
38
|
-
|
|
39
|
-
```sql
|
|
40
|
-
SELECT
|
|
41
|
-
project_local_date,
|
|
42
|
-
control_conversion_rate() AS control_conversion_rate,
|
|
43
|
-
variant_conversion_rate() AS variant_conversion_rate,
|
|
44
|
-
conversion_rate_uplift() AS conversion_rate_uplift_pct
|
|
45
|
-
FROM metrics
|
|
46
|
-
WHERE project_id = '{{ your project ID }}'
|
|
47
|
-
AND project_local_date >= '2026-04-01'
|
|
48
|
-
GROUP BY project_local_date
|
|
49
|
-
ORDER BY project_local_date
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Result:**
|
|
53
|
-
|
|
54
|
-
| project_local_date | control_conversion_rate | variant_conversion_rate | conversion_rate_uplift_pct |
|
|
55
|
-
| ----------------- | ----------------------- | ----------------------- | -------------------------- |
|
|
56
|
-
| 2026-04-01 | 0.0322 | 0.0349 | 0.0349 |
|
|
57
|
-
| 2026-04-02 | 0.0398 | 0.0416 | 0.0416 |
|
|
58
|
-
| 2026-04-03 | 0.0462 | 0 | -0.0001 |
|
|
59
|
-
|
|
60
|
-
## Custom conversion rate definition
|
|
61
|
-
|
|
62
|
-
Override the default conversion, which counts a `purchase` event, with your own
|
|
63
|
-
numerator and denominator. Use this when a form submission, a lead capture, or
|
|
64
|
-
another event of your own defines a conversion.
|
|
65
|
-
|
|
66
|
-
```sql
|
|
67
|
-
-- Lead capture conversion: form submissions / lead-capture step entries
|
|
68
|
-
SELECT
|
|
69
|
-
project_local_date,
|
|
70
|
-
control_conversion_rate(
|
|
71
|
-
numerator='event_type=form_submit_success',
|
|
72
|
-
denominator='step_id=lead-capture-step'
|
|
73
|
-
) AS control_lead_cr,
|
|
74
|
-
variant_conversion_rate(
|
|
75
|
-
numerator='event_type=form_submit_success',
|
|
76
|
-
denominator='step_id=lead-capture-step'
|
|
77
|
-
) AS variant_lead_cr
|
|
78
|
-
FROM events
|
|
79
|
-
WHERE project_id = '{{ your project ID }}'
|
|
80
|
-
AND client_local_date >= '2026-04-01'
|
|
81
|
-
GROUP BY project_local_date
|
|
82
|
-
ORDER BY project_local_date
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
You can also combine multiple events with `OR` and group with parentheses:
|
|
86
|
-
|
|
87
|
-
```sql
|
|
88
|
-
-- A `checkout_complete` event or an `order_create` event counts as a conversion.
|
|
89
|
-
SELECT
|
|
90
|
-
control_conversion_rate(
|
|
91
|
-
'event_type=checkout_complete OR event_type=order_create'
|
|
92
|
-
) AS control_cr,
|
|
93
|
-
variant_conversion_rate(
|
|
94
|
-
'event_type=checkout_complete OR event_type=order_create'
|
|
95
|
-
) AS variant_cr
|
|
96
|
-
FROM events
|
|
97
|
-
WHERE project_id = '{{ your project ID }}'
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Your own segment with `control_users` and `variant_users`
|
|
101
|
-
|
|
102
|
-
On `events`, four functions take an optional filter string: `control_users`,
|
|
103
|
-
`variant_users`, `control_sessions`, and `variant_sessions`. The filter counts only a
|
|
104
|
-
user or a session that matches your expression. It applies together with the
|
|
105
|
-
`variant_type` filter that PickedQL adds.
|
|
106
|
-
|
|
107
|
-
```sql
|
|
108
|
-
-- The control users who fired an `app_initialize` event, by step.
|
|
109
|
-
SELECT
|
|
110
|
-
step_id,
|
|
111
|
-
control_users('event_type=app_initialize') AS control_initialized,
|
|
112
|
-
variant_users('event_type=app_initialize') AS variant_initialized
|
|
113
|
-
FROM events
|
|
114
|
-
WHERE project_id = '{{ your project ID }}'
|
|
115
|
-
AND client_local_date >= '2026-04-01'
|
|
116
|
-
GROUP BY step_id
|
|
117
|
-
ORDER BY control_initialized DESC
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
The named form (`filter=`) is also supported:
|
|
121
|
-
|
|
122
|
-
```sql
|
|
123
|
-
SELECT control_users(filter='event_type=form_submit AND step_id=lead-capture') FROM events
|
|
124
|
-
WHERE project_id = '{{ your project ID }}'
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Conversion rate from nested virtual functions
|
|
128
|
-
|
|
129
|
-
The numerator and the denominator can come from different segments. An example is the
|
|
130
|
-
control users who fired an event of your own, divided by **all** users and not by the
|
|
131
|
-
control users alone. For that, pass a virtual function call directly as an argument
|
|
132
|
-
of the conversion rate:
|
|
133
|
-
|
|
134
|
-
```sql
|
|
135
|
-
-- The control users who fired `app_initialize`, over all users of every variant.
|
|
136
|
-
SELECT
|
|
137
|
-
control_conversion_rate(
|
|
138
|
-
control_users('event_type=app_initialize'),
|
|
139
|
-
all_users()
|
|
140
|
-
) AS control_initialize_rate
|
|
141
|
-
FROM events
|
|
142
|
-
WHERE project_id = '{{ your project ID }}'
|
|
143
|
-
AND client_local_date >= '2026-04-01'
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## A/B test by device
|
|
147
|
-
|
|
148
|
-
```sql
|
|
149
|
-
SELECT
|
|
150
|
-
device_category,
|
|
151
|
-
control_users() AS control,
|
|
152
|
-
variant_users() AS variant
|
|
153
|
-
FROM metrics
|
|
154
|
-
WHERE project_id = '{{ your project ID }}'
|
|
155
|
-
GROUP BY device_category
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
**Result:**
|
|
159
|
-
|
|
160
|
-
| device_category | control | variant |
|
|
161
|
-
| --------------- | ------- | ------- |
|
|
162
|
-
| Phone | 193430 | 1723 |
|
|
163
|
-
| Desktop | 23423 | 309 |
|
|
164
|
-
| Tablet | 13294 | 65 |
|
|
165
|
-
|
|
166
|
-
## Daily A/B test trend by device
|
|
167
|
-
|
|
168
|
-
Combine date and device dimensions to spot device-specific trends:
|
|
169
|
-
|
|
170
|
-
```sql
|
|
171
|
-
SELECT
|
|
172
|
-
project_local_date,
|
|
173
|
-
device_category,
|
|
174
|
-
control_users() AS control,
|
|
175
|
-
variant_users() AS variant
|
|
176
|
-
FROM metrics
|
|
177
|
-
WHERE project_id = '{{ your project ID }}'
|
|
178
|
-
AND project_local_date >= '2026-04-01'
|
|
179
|
-
GROUP BY project_local_date, device_category
|
|
180
|
-
ORDER BY project_local_date, device_category
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
**Result:**
|
|
184
|
-
|
|
185
|
-
| project_local_date | device_category | control | variant |
|
|
186
|
-
| ----------------- | --------------- | ------- | ------- |
|
|
187
|
-
| 2026-04-13 | Tablet | 175 | 2 |
|
|
188
|
-
| 2026-04-14 | Desktop | 37 | 1 |
|
|
189
|
-
| 2026-04-14 | Phone | 244 | 1 |
|
|
190
|
-
|
|
191
|
-
## Purchase by UTM source
|
|
192
|
-
|
|
193
|
-
```sql
|
|
194
|
-
SELECT
|
|
195
|
-
utm_source,
|
|
196
|
-
all_users() AS users,
|
|
197
|
-
all_purchase_users() AS purchasers
|
|
198
|
-
FROM metrics
|
|
199
|
-
WHERE project_id = '{{ your project ID }}'
|
|
200
|
-
GROUP BY utm_source
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
**Result:**
|
|
204
|
-
|
|
205
|
-
| utm_source | users | purchasers |
|
|
206
|
-
| ---------- | ------ | ---------- |
|
|
207
|
-
| `meta` | 12031 | 101 |
|
|
208
|
-
| `fb` | 3656 | 31 |
|
|
209
|
-
| `an` | 100366 | 299 |
|
|
210
|
-
|
|
211
|
-
## Step funnel for variant users
|
|
212
|
-
|
|
213
|
-
Count unique variant users per step to understand the conversion funnel:
|
|
214
|
-
|
|
215
|
-
```sql
|
|
216
|
-
SELECT
|
|
217
|
-
step_id,
|
|
218
|
-
variant_users() AS variant
|
|
219
|
-
FROM metrics
|
|
220
|
-
WHERE project_id = '{{ your project ID }}'
|
|
221
|
-
AND project_local_date >= '2026-04-01'
|
|
222
|
-
GROUP BY step_id
|
|
223
|
-
ORDER BY variant DESC
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
**Result:**
|
|
227
|
-
|
|
228
|
-
| step_id | variant |
|
|
229
|
-
| ------------------------------ | ------- |
|
|
230
|
-
| `who-are-you-protecting-step` | 1093 |
|
|
231
|
-
| `about-yourself-step` | 533 |
|
|
232
|
-
| `date-of-birth-step` | 435 |
|
|
233
|
-
| `employment-status-step` | 408 |
|
|
234
|
-
| `nicotine-usage-step` | 407 |
|
|
235
|
-
| `coverage-motivation-step` | 405 |
|
|
236
|
-
| `lead-capture-step` | 398 |
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
## Sankey — overall user journey
|
|
240
|
-
|
|
241
|
-
A forward window from the starting step. A user who never reaches `targeting_step`
|
|
242
|
-
still gives edges, up to `num_nodes_after_start`.
|
|
243
|
-
|
|
244
|
-
```sql
|
|
245
|
-
SELECT source, target, users FROM experience_journey
|
|
246
|
-
WHERE project_id = '{{ your project ID }}'
|
|
247
|
-
AND starting_step = '{{ starting step ID }}'
|
|
248
|
-
AND targeting_step = '{{ target step ID }}'
|
|
249
|
-
AND num_nodes_after_start = 10
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
**Result:**
|
|
253
|
-
|
|
254
|
-
| source | target | users |
|
|
255
|
-
| ------------------------- | ------------------------- | ----- |
|
|
256
|
-
| `001. step-start` | `002. step-questionnaire-1` | 182 |
|
|
257
|
-
| `002. step-questionnaire-1` | `003. step-quote` | 144 |
|
|
258
|
-
| `003. step-quote` | `004. step-target` | 121 |
|
|
259
|
-
|
|
260
|
-
## Sankey — the top paths to a target step
|
|
261
|
-
|
|
262
|
-
A backward window anchored at the target. It also ranks the paths and keeps the ones
|
|
263
|
-
with the most users.
|
|
264
|
-
|
|
265
|
-
```sql
|
|
266
|
-
SELECT source, target, users FROM experience_journey
|
|
267
|
-
WHERE project_id = '{{ your project ID }}'
|
|
268
|
-
AND experience_id = '{{ experience ID }}'
|
|
269
|
-
AND starting_step = '{{ starting step ID }}'
|
|
270
|
-
AND targeting_step = '{{ target step ID }}'
|
|
271
|
-
AND num_nodes_before_target = 5
|
|
272
|
-
AND top_n_path = 10
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
## Sankey — drop-off view
|
|
276
|
-
|
|
277
|
-
Starts at `starting_step` and emits every consecutive transition until `num_nodes_after_start` steps later (no target).
|
|
278
|
-
|
|
279
|
-
```sql
|
|
280
|
-
SELECT source, target, users FROM experience_journey
|
|
281
|
-
WHERE project_id = '{{ your project ID }}'
|
|
282
|
-
AND experience_id = '{{ experience ID }}'
|
|
283
|
-
AND starting_step = '{{ starting step ID }}'
|
|
284
|
-
AND num_nodes_after_start = 10
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
## List all control users for mobile (user-level)
|
|
288
|
-
|
|
289
|
-
Use `events` when you need data at the individual user level:
|
|
290
|
-
|
|
291
|
-
```sql
|
|
292
|
-
SELECT
|
|
293
|
-
device_category,
|
|
294
|
-
user_canonical_id
|
|
295
|
-
FROM events
|
|
296
|
-
WHERE project_id = '{{ your project ID }}'
|
|
297
|
-
AND device_category = 'Mobile'
|
|
298
|
-
AND variant_type = 'Control'
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
**Result:**
|
|
302
|
-
|
|
303
|
-
| device_category | user_canonical_id |
|
|
304
|
-
| --------------- | ------------------------------------ |
|
|
305
|
-
| Mobile | `019cc336-5a6a-7c32-b638-cdcc983b3e70` |
|
|
306
|
-
| Mobile | `019cc336-5a6a-7d8f-994c-69bc28e5f550` |
|
|
307
|
-
| Mobile | `019cc80f-503c-7181-b2c6-986b1f76d496` |
|
|
308
|
-
|
|
309
|
-
## API and MCP
|
|
310
|
-
|
|
311
|
-
You can also do this task with the [Management API](/reference/management-api/schema), the [MCP server](/reference/tools/mcp), or code that you send to [`picked_run`](/reference/tools/mcp-run).
|
|
312
|
-
|
|
313
|
-
| Task | GraphQL | MCP tool | Run |
|
|
314
|
-
| --- | --- | --- | --- |
|
|
315
|
-
| Run an analytics query | [`pickedqlQuery`](/reference/management-api/schema/analytics#pickedqlquery) | None | None |
|
|
316
|
-
|
|
317
|
-
## Related
|
|
318
|
-
|
|
319
|
-
- [About PickedQL](/explanation/how-pickedql-works) — what the layer expands for you.
|
|
320
|
-
- [Virtual functions](/reference/pickedql/virtual-functions) — every function.
|
|
321
|
-
- [Dimensions](/reference/pickedql/dimensions) — every dimension column.
|
|
322
|
-
- [Analytics events](/reference/sdk/analytics-events) — every `event_type` value that a
|
|
323
|
-
filter can use.
|
|
324
|
-
- [Reports](/reference/dashboard/reports) — the same data as an embedded dashboard.
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
type: reference
|
|
3
|
-
layout: docs
|
|
4
|
-
generated: true
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Analytics schema
|
|
8
|
-
|
|
9
|
-
See [Management API schema](/reference/management-api/schema) for every domain, the endpoint and authentication.
|
|
10
|
-
|
|
11
|
-
## Queries
|
|
12
|
-
|
|
13
|
-
### `pickedqlQuery`
|
|
14
|
-
|
|
15
|
-
Runs a PickedQL query against one project's analytics data. A statement that does not parse, or
|
|
16
|
-
queries a project's data without a `project_id` filter, fails with `VALIDATION_ERROR`.
|
|
17
|
-
Scope: `ORGANIZATION_REPORTS_READ`.
|
|
18
|
-
|
|
19
|
-
```graphql
|
|
20
|
-
pickedqlQuery(input: PickedqlQueryInput!): PickedqlQueryResult! @auth
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Types
|
|
24
|
-
|
|
25
|
-
### `PickedqlQueryInput`
|
|
26
|
-
|
|
27
|
-
```graphql
|
|
28
|
-
"""The input of `pickedqlQuery`."""
|
|
29
|
-
input PickedqlQueryInput {
|
|
30
|
-
"""
|
|
31
|
-
The PickedQL statement. A query of a project's data must filter on `project_id`.
|
|
32
|
-
"""
|
|
33
|
-
sql: String!
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### `PickedqlTableDataColumn`
|
|
38
|
-
|
|
39
|
-
```graphql
|
|
40
|
-
"""A column of a PickedQL result."""
|
|
41
|
-
type PickedqlTableDataColumn {
|
|
42
|
-
"""The column's name."""
|
|
43
|
-
name: String!
|
|
44
|
-
"""The column's data type, such as `String`, `UInt64` or `DateTime`."""
|
|
45
|
-
dataType: String!
|
|
46
|
-
"""The column's label."""
|
|
47
|
-
displayName: String!
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### `PickedqlTableData`
|
|
52
|
-
|
|
53
|
-
```graphql
|
|
54
|
-
"""The rows and columns a PickedQL query returned."""
|
|
55
|
-
type PickedqlTableData {
|
|
56
|
-
"""The columns, in order."""
|
|
57
|
-
columns: [PickedqlTableDataColumn!]!
|
|
58
|
-
"""
|
|
59
|
-
The rows. Each row holds one cell per column, as a string; null for a null cell.
|
|
60
|
-
"""
|
|
61
|
-
rowData: [[String]!]!
|
|
62
|
-
}
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### `PickedqlQueryResult`
|
|
66
|
-
|
|
67
|
-
```graphql
|
|
68
|
-
"""The result of a PickedQL query."""
|
|
69
|
-
type PickedqlQueryResult {
|
|
70
|
-
"""The rows and columns. Null when the query failed to run."""
|
|
71
|
-
tableData: PickedqlTableData
|
|
72
|
-
"""The errors that stopped the query from running. Empty when it ran."""
|
|
73
|
-
parseErrors: [String!]!
|
|
74
|
-
}
|
|
75
|
-
```
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
type: reference
|
|
3
|
-
layout: docs
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Data sources
|
|
7
|
-
|
|
8
|
-
PickedQL gives you four virtual tables. Each table is fast for one kind of work. It also gives you three reference tables, and those hold the options of your
|
|
9
|
-
Picked project.
|
|
10
|
-
|
|
11
|
-
## `metrics` — data that PickedQL aggregates each day
|
|
12
|
-
|
|
13
|
-
Use it for a dashboard and to study a trend. There is one row for each unique set of
|
|
14
|
-
dimensions on each day. The dimension columns are there directly, and they need no
|
|
15
|
-
join. Examples are `device_category`, `country_code`, and `utm_source`.
|
|
16
|
-
|
|
17
|
-
```sql
|
|
18
|
-
SELECT device_category, control_users(), variant_users()
|
|
19
|
-
FROM metrics
|
|
20
|
-
WHERE project_id = 'your-project-id'
|
|
21
|
-
GROUP BY device_category
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## `events` — one row for each event of each user
|
|
25
|
-
|
|
26
|
-
Use it for a deep study, for a funnel, and for a breakdown of your own. There is one
|
|
27
|
-
row for each event of each user. PickedQL joins a dimension column, such as
|
|
28
|
-
`device_category` or `country_code`, when you point at it.
|
|
29
|
-
|
|
30
|
-
```sql
|
|
31
|
-
SELECT user_canonical_id, device_category
|
|
32
|
-
FROM events
|
|
33
|
-
WHERE project_id = 'your-project-id'
|
|
34
|
-
AND variant_type = 'Control'
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## `features` — one row for each feature flag
|
|
38
|
-
|
|
39
|
-
Use it to count the users, the sessions, and the events for each feature flag and
|
|
40
|
-
bucket. It uses parameterized functions.
|
|
41
|
-
|
|
42
|
-
```sql
|
|
43
|
-
SELECT feature_users('homepage_test', 'control')
|
|
44
|
-
FROM features
|
|
45
|
-
WHERE project_id = 'your-project-id'
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## `experience_journey` — step transitions for a sankey chart
|
|
49
|
-
|
|
50
|
-
It returns one `source, target, users` row for each edge. You can put those rows
|
|
51
|
-
directly into a sankey chart or a funnel chart. It holds the eight common table
|
|
52
|
-
expressions that a card carried before. Those call `lagInFrame`, remove a duplicate
|
|
53
|
-
between two steps that follow each other, and rank the top paths.
|
|
54
|
-
|
|
55
|
-
Every filter goes in the **outer `WHERE`** clause. PickedQL reads each one as a
|
|
56
|
-
parameter and puts it into the query below. Only `project_id` is necessary. The rest
|
|
57
|
-
are optional, and each has a sensible default.
|
|
58
|
-
|
|
59
|
-
| Parameter, as a WHERE key | What it does |
|
|
60
|
-
|---|---|
|
|
61
|
-
| `project_id` | The tenant filter. It is necessary. |
|
|
62
|
-
| `experience_id` | Limits the rows to one `fact_events.experience_id`. |
|
|
63
|
-
| `starting_step` | Anchors each edge at the first time that a user reaches this `step_id`. With no value, it anchors at the first `step_enter` event of that user. |
|
|
64
|
-
| `targeting_step` | Trims the window of each user at the first time that the user reaches this `step_id`. A user who never reaches it still gives a journey, up to `num_nodes_after_start`. |
|
|
65
|
-
| `num_nodes_after_start` | The size of the forward window from the start step. |
|
|
66
|
-
| `num_nodes_before_target` | The size of the backward window from the target step. It needs `targeting_step`. |
|
|
67
|
-
| `top_n_path` | Keeps the paths with the most users, and drops the rest. |
|
|
68
|
-
| `user_cohort_event` | Limits the rows to a user with at least one `fact_events` row of this `event_type`, such as `'lead_capture'`. Use it for the paths of the users who reached a goal. |
|
|
69
|
-
| `client_local_date` | A filter on the date. It takes `=`, `<`, `<=`, `>`, `>=`, and `BETWEEN`. PickedQL puts it into the `fact_events` read below. |
|
|
70
|
-
| `event_timestamp` | A filter on the timestamp from the server. It takes the same operators as `client_local_date`. |
|
|
71
|
-
|
|
72
|
-
When you set both `num_nodes_after_start` and `num_nodes_before_target`, both tests
|
|
73
|
-
apply. The result is the intersection of the two.
|
|
74
|
-
|
|
75
|
-
```sql
|
|
76
|
-
-- The "overall user journey" sankey.
|
|
77
|
-
-- It uses a forward window. The target step is optional.
|
|
78
|
-
SELECT source, target, users FROM experience_journey
|
|
79
|
-
WHERE project_id = 'your-project-id'
|
|
80
|
-
AND starting_step = 'step-start'
|
|
81
|
-
AND targeting_step = 'step-target'
|
|
82
|
-
AND num_nodes_after_start = 10
|
|
83
|
-
AND client_local_date >= '2026-04-01' -- An optional range of dates.
|
|
84
|
-
AND client_local_date <= '2026-04-30'
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
```sql
|
|
88
|
-
-- The "paths to a target" sankey.
|
|
89
|
-
-- It uses a backward window and it ranks the top paths.
|
|
90
|
-
SELECT source, target, users FROM experience_journey
|
|
91
|
-
WHERE project_id = 'your-project-id'
|
|
92
|
-
AND experience_id = 'exp-123'
|
|
93
|
-
AND starting_step = 'step-start'
|
|
94
|
-
AND targeting_step = 'step-target'
|
|
95
|
-
AND num_nodes_before_target = 5
|
|
96
|
-
AND top_n_path = 10
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
```sql
|
|
100
|
-
-- The "drop-off" sankey. Leave the target step out.
|
|
101
|
-
SELECT source, target, users FROM experience_journey
|
|
102
|
-
WHERE project_id = 'your-project-id'
|
|
103
|
-
AND experience_id = 'exp-123'
|
|
104
|
-
AND starting_step = 'step-start'
|
|
105
|
-
AND num_nodes_after_start = 10
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
```sql
|
|
109
|
-
-- A cohort sankey. It holds the users who reached the goal only.
|
|
110
|
-
SELECT source, target, users FROM experience_journey
|
|
111
|
-
WHERE project_id = 'your-project-id'
|
|
112
|
-
AND starting_step = 'step-start'
|
|
113
|
-
AND targeting_step = 'step-target'
|
|
114
|
-
AND num_nodes_after_start = 10
|
|
115
|
-
AND user_cohort_event = 'lead_capture' -- Users with one or more of these events.
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
The columns that it returns:
|
|
119
|
-
|
|
120
|
-
| Column | Type | Description |
|
|
121
|
-
|---|---|---|
|
|
122
|
-
| `source` | String | The start of the edge, in the form `NN. <step title>`, such as `001. Welcome screen`. PickedQL joins `steps` to find the title. |
|
|
123
|
-
| `target` | String | The end of the edge, in the form `NN. <step title>`. |
|
|
124
|
-
| `users` | `UInt64` | The number of different `user_canonical_id` values that went along this edge. |
|
|
125
|
-
|
|
126
|
-
:::note
|
|
127
|
-
`experience_journey` returns data that PickedQL aggregates first. It does **not**
|
|
128
|
-
support a dimension filter such as `variant_type`, `device_category`, or
|
|
129
|
-
`country_code`. To use one of those, query
|
|
130
|
-
[`events`](#events--one-row-for-each-event-of-each-user) directly and build the
|
|
131
|
-
transitions yourself.
|
|
132
|
-
:::
|
|
133
|
-
|
|
134
|
-
## Reference tables — `steps`, `experiences`, `projects`
|
|
135
|
-
|
|
136
|
-
These reference tables hold the configuration of your Picked project. They have two uses:
|
|
137
|
-
|
|
138
|
-
- **PickedQL joins them onto `events`** when you point at one of their analyst
|
|
139
|
-
columns: `step_title`, `experience_title`, `project_name`, or `project_timezone`.
|
|
140
|
-
- **You can read them directly.** Each one then needs its own tenant filter, so that
|
|
141
|
-
you see only the rows of a project that you can reach.
|
|
142
|
-
|
|
143
|
-
| Source | The tenant filter that it needs |
|
|
144
|
-
|---|---|
|
|
145
|
-
| `steps` | `WHERE project_id = '<project_id>'` |
|
|
146
|
-
| `experiences` | `WHERE project_id = '<project_id>'` |
|
|
147
|
-
| `projects` | `WHERE id = '<project_id>'` |
|
|
148
|
-
|
|
149
|
-
```sql
|
|
150
|
-
-- A direct query that reads the experiences of a project.
|
|
151
|
-
SELECT id, title FROM experiences WHERE project_id = 'your-project-id'
|
|
152
|
-
|
|
153
|
-
-- A direct query that reads the metadata of one project.
|
|
154
|
-
SELECT id, name, timezone FROM projects WHERE id = 'your-project-id'
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
```sql
|
|
158
|
-
-- Pointed at from events. PickedQL adds each LEFT JOIN for you.
|
|
159
|
-
-- The reference tables need no separate tenant filter, because
|
|
160
|
-
-- the event table already limits the join.
|
|
161
|
-
SELECT experience_title, step_title, count(*)
|
|
162
|
-
FROM events
|
|
163
|
-
WHERE project_id = 'your-project-id'
|
|
164
|
-
GROUP BY experience_title, step_title
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
See [Schema, reference tables](/reference/pickedql/schema#steps-experiences-projects) for the full
|
|
168
|
-
column list and the join keys.
|
|
169
|
-
|
|
170
|
-
## Related
|
|
171
|
-
|
|
172
|
-
- [About PickedQL](/explanation/how-pickedql-works) — what the layer expands for you.
|
|
173
|
-
- [Schema](/reference/pickedql/schema)
|
|
174
|
-
- [Analytics queries](/how-to/analytics)
|