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
|
@@ -60,13 +60,29 @@ type Branding {
|
|
|
60
60
|
type BrandingLogos {
|
|
61
61
|
"""The small logo in the dashboard header."""
|
|
62
62
|
header: String!
|
|
63
|
+
"""The intrinsic size of the header logo file."""
|
|
64
|
+
headerSize: BrandingLogoSize!
|
|
63
65
|
"""The larger logo on the sign-in and authorisation pages."""
|
|
64
66
|
auth: String!
|
|
67
|
+
"""The intrinsic size of the auth logo file."""
|
|
68
|
+
authSize: BrandingLogoSize!
|
|
65
69
|
"""The favicon. Null when the tenant has none."""
|
|
66
70
|
favicon: String
|
|
67
71
|
}
|
|
68
72
|
```
|
|
69
73
|
|
|
74
|
+
### `BrandingLogoSize`
|
|
75
|
+
|
|
76
|
+
```graphql
|
|
77
|
+
"""The intrinsic size of a logo file, in pixels."""
|
|
78
|
+
type BrandingLogoSize {
|
|
79
|
+
"""The width in pixels."""
|
|
80
|
+
width: Int!
|
|
81
|
+
"""The height in pixels."""
|
|
82
|
+
height: Int!
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
70
86
|
### `BrandingColors`
|
|
71
87
|
|
|
72
88
|
```graphql
|
|
@@ -24,7 +24,12 @@ workflow(id: ID!): Workflow @auth
|
|
|
24
24
|
Lists every tool a workflow node can run, with the arguments each takes.
|
|
25
25
|
|
|
26
26
|
```graphql
|
|
27
|
-
workflowTools
|
|
27
|
+
workflowTools(
|
|
28
|
+
"""
|
|
29
|
+
The project whose installed apps' tools to include, as `app.<slug>.<tool>`.
|
|
30
|
+
"""
|
|
31
|
+
projectId: ID
|
|
32
|
+
): [WorkflowToolDefinition!]! @auth
|
|
28
33
|
```
|
|
29
34
|
|
|
30
35
|
### `workflows`
|
|
@@ -693,7 +693,7 @@ type WorkspaceExportPayload {
|
|
|
693
693
|
```
|
|
694
694
|
|
|
695
695
|
Entities use snake_case keys and carry their source `id`, which is a handle inside the bundle
|
|
696
|
-
only.
|
|
696
|
+
only. Organization, project, workspace and user IDs, timestamps and deleted entities are left out.
|
|
697
697
|
A workflow carries its `trigger` and its `workflow_json` graph, without its scopes. Every asset
|
|
698
698
|
version the content entries reference is listed once in `assets`; a reference that pins no version
|
|
699
699
|
is pinned to the version the Delivery API serves for it. `source` records where the bundle came
|
|
@@ -775,7 +775,7 @@ input WorkspaceImportAssetMappingInput {
|
|
|
775
775
|
"""The input of `workspaceImport`."""
|
|
776
776
|
input WorkspaceImportInput {
|
|
777
777
|
"""
|
|
778
|
-
The ID of the project to create the workspace in. It can belong to another
|
|
778
|
+
The ID of the project to create the workspace in. It can belong to another organization than the bundle's source.
|
|
779
779
|
"""
|
|
780
780
|
projectId: ID!
|
|
781
781
|
"""The new workspace's name. Null for the bundle's `workspace.name`."""
|
|
@@ -10,7 +10,7 @@ event type, every interaction type, and every schema that the SDK sends.
|
|
|
10
10
|
|
|
11
11
|
Two terms carry the page:
|
|
12
12
|
|
|
13
|
-
- An **event type** is the name of the event. It is the `event_type` column in
|
|
13
|
+
- An **event type** is the name of the event. It is the `event_type` column of `fact_events` in Picked Analytics.
|
|
14
14
|
- A **context** is a block of data that the SDK attaches to an event. Picked makes a
|
|
15
15
|
column from each one. An example is the `product_list` context behind `dim_product`.
|
|
16
16
|
|
|
@@ -19,7 +19,7 @@ The SDK attaches a context in the second group only when it has the data at that
|
|
|
19
19
|
An event outside an experience has no `experience` context.
|
|
20
20
|
|
|
21
21
|
:::warning
|
|
22
|
-
A
|
|
22
|
+
A filter on a name that does not exist gives an empty result set and not an error.
|
|
23
23
|
Take each name from this page.
|
|
24
24
|
:::
|
|
25
25
|
|
|
@@ -87,7 +87,7 @@ group. "Shopify behaviour" below covers the Picked app for Shopify.
|
|
|
87
87
|
| `cart_add` | A product goes into the cart. | `app`, `feature_list`, `product_list`, `session` | `experience`, `step` |
|
|
88
88
|
| `cart_remove` | A product leaves the cart. | `app`, `feature_list`, `product_list`, `session` | `experience`, `step` |
|
|
89
89
|
| `checkout_start` | The visitor starts a checkout. | `app`, `feature_list`, `product_list`, `session` | `experience`, `step` |
|
|
90
|
-
| `checkout_complete` | The visitor completes a checkout.
|
|
90
|
+
| `checkout_complete` | The visitor completes a checkout. | `app`, `feature_list`, `order`, `product_list`, `session` | `experience`, `step` |
|
|
91
91
|
| `order_create` | An order becomes a record in the store. | `app`, `feature_list`, `order`, `product_list`, `session` | `experience`, `step` |
|
|
92
92
|
| `product_list_view` | The visitor sees a list of products, such as a collection. | `app`, `feature_list`, `product_list`, `session` | `experience`, `step` |
|
|
93
93
|
| `product_select` | The visitor chooses a product from a list. | `feature_list`, `product_list`, `session` | `experience`, `step` |
|
|
@@ -98,7 +98,9 @@ group. "Shopify behaviour" below covers the Picked app for Shopify.
|
|
|
98
98
|
| `waitlist_join` | The visitor joins a waitlist. | `app`, `feature_list`, `session` | `experience`, `product_list`, `step` |
|
|
99
99
|
|
|
100
100
|
`is_purchase` is 1 for `checkout_complete` and 0 for every other event. `is_cart_add` is 1
|
|
101
|
-
for `cart_add
|
|
101
|
+
for `cart_add` and 0 for every other event. Both are columns of `fact_events` in Picked
|
|
102
|
+
Analytics. That table has one row for each product item of an event, and one row for an event
|
|
103
|
+
with no product item. To count events, count the different `event_id` values.
|
|
102
104
|
|
|
103
105
|
#### Shopify behaviour
|
|
104
106
|
|
|
@@ -121,13 +123,13 @@ For a Shopify store, the `session` context also holds `shopify_client_id`,
|
|
|
121
123
|
`shopify_customer_id`, and `shopify_checkout_token`. The `order` context holds the Shopify
|
|
122
124
|
`checkout_token` and `cart_token`. The Shopify pixel sends no other event type of this page.
|
|
123
125
|
|
|
124
|
-
### Page and
|
|
126
|
+
### Page and visitor events
|
|
125
127
|
|
|
126
128
|
| Event type | When it fires | Always attached | Attached when available |
|
|
127
129
|
| --- | --- | --- | --- |
|
|
128
130
|
| `page_view` | The visitor opens a page. | `app`, `feature_list`, `session` | `experience`, `product_list`, `step` |
|
|
129
|
-
| `identify` | The
|
|
130
|
-
| `lead_capture` | The visitor gives contact details. | `feature_list`, `session` | `experience`, `step` |
|
|
131
|
+
| `identify` | The Picked app for Shopify connects the visitor ID to the Shopify client ID. | `app`, `session` | `experience`, `feature_list`, `step` |
|
|
132
|
+
| `lead_capture` | The visitor gives contact details. The template for Google Tag Manager or your own code sends it. The analytics plugin does not send it. | `feature_list`, `session` | `experience`, `step` |
|
|
131
133
|
| `lead_created` | The Picked API records the lead from a capture. | `app`, `session` | None. |
|
|
132
134
|
| `lead_updated` | The Picked API changes the responses of a lead from a later capture. | `app`, `session` | None. |
|
|
133
135
|
| `modal_open` | A modal opens. | `feature_list`, `modal`, `session` | `experience`, `step` |
|
|
@@ -154,9 +156,10 @@ An interaction event is a DOM event of the visitor. Its name is also an `event_t
|
|
|
154
156
|
so a query for a click reads `WHERE event_type = 'click'`.
|
|
155
157
|
|
|
156
158
|
:::warning
|
|
157
|
-
`interaction_type` in
|
|
158
|
-
|
|
159
|
-
on `interaction_type = 'click'`
|
|
159
|
+
`interaction_type` in Picked Analytics is a different column. It holds the label of the
|
|
160
|
+
`element` context, and it is empty when the event has no label. It never holds the
|
|
161
|
+
`event_type`. A filter on `interaction_type = 'click'` matches only an element with the label
|
|
162
|
+
`click`. To find a click, filter on `event_type`.
|
|
160
163
|
:::
|
|
161
164
|
|
|
162
165
|
### Element interactions
|
|
@@ -220,7 +223,7 @@ and keeps a property that the schema does not name. The field tables below do no
|
|
|
220
223
|
| `event` | The event itself. It is not a context: it holds the event type and the `event_meta` column. |
|
|
221
224
|
| `exception` | The reason for a failure or a validation error. |
|
|
222
225
|
| `experience` | The experience that the visitor is in. |
|
|
223
|
-
| `feature_list` | Each feature flag
|
|
226
|
+
| `feature_list` | Each feature flag that resolved for the visitor, with the bucket of the visitor. |
|
|
224
227
|
| `field_list` | The fields of the current step, with their options. |
|
|
225
228
|
| `form` | The form behind a form event. |
|
|
226
229
|
| `modal` | The modal behind a modal event. |
|
|
@@ -230,7 +233,7 @@ and keeps a property that the schema does not name. The field tables below do no
|
|
|
230
233
|
| `question_list` | The fields of a step, under the earlier name of `field_list`. The SDK attaches `field_list`. |
|
|
231
234
|
| `recommendation_list` | A list of recommended items. The SDK attaches it for no event. |
|
|
232
235
|
| `response_list` | The response of the visitor to each field. |
|
|
233
|
-
| `session` | The
|
|
236
|
+
| `session` | The visitor ID, and each other identifier that Picked has for the visitor. |
|
|
234
237
|
| `step` | The step of the flow that the visitor is on. |
|
|
235
238
|
|
|
236
239
|
### `app`
|
|
@@ -259,12 +262,13 @@ and keeps a property that the schema does not name. The field tables below do no
|
|
|
259
262
|
|
|
260
263
|
### `session`
|
|
261
264
|
|
|
262
|
-
The `session`
|
|
265
|
+
The `session` context describes the visitor, and not one visit. The schema has no required
|
|
266
|
+
field. A value is `null` until Picked has it.
|
|
263
267
|
|
|
264
268
|
| Field | Type | Required | Description |
|
|
265
269
|
| --- | --- | --- | --- |
|
|
266
|
-
| `id` | `string` or `null` | No | The
|
|
267
|
-
| `is_user` | `boolean` or `null` | No | True when
|
|
270
|
+
| `id` | `string` or `null` | No | The visitor ID. The SDK makes one ID for each browser, and keeps it in browser storage across visits. It is `Lead.userId` in the Management API. |
|
|
271
|
+
| `is_user` | `boolean` or `null` | No | The result of the client `condition`, which asks "Is this visitor eligible?". True when the visitor passes the condition, or when the client has no condition. False when the visitor fails it, and then the SDK starts no experience. The SDK keeps the last result in browser storage. |
|
|
268
272
|
| `gaid` | `string` or `null` | No | The client ID from Google Analytics. |
|
|
269
273
|
| `shopify_client_id` | `string` or `null` | No | The Shopify client ID. |
|
|
270
274
|
| `shopify_customer_id` | `string` or `null` | No | The Shopify customer ID. |
|
|
@@ -276,28 +280,33 @@ The `session` schema has no required field. A value is `null` until Picked has i
|
|
|
276
280
|
| Field | Type | Required | Description |
|
|
277
281
|
| --- | --- | --- | --- |
|
|
278
282
|
| `id` | `string` | Yes | The experience ID. |
|
|
279
|
-
| `title` | `string` | Yes | The experience title. It is `
|
|
283
|
+
| `title` | `string` | Yes | The experience title. It is the `title` column of `experiences` in Picked Analytics. |
|
|
280
284
|
| `type` | `string` or `null` | No | The experience type. |
|
|
281
285
|
|
|
282
286
|
### `step`
|
|
283
287
|
|
|
284
288
|
| Field | Type | Required | Description |
|
|
285
289
|
| --- | --- | --- | --- |
|
|
286
|
-
| `id` | `string` | Yes | The step ID. It is `step_id` in
|
|
287
|
-
| `title` | `string` | Yes | The step title. It is `
|
|
290
|
+
| `id` | `string` | Yes | The step ID. It is the `step_id` column of `fact_events` in Picked Analytics. |
|
|
291
|
+
| `title` | `string` | Yes | The step title. It is the `title` column of `steps` in Picked Analytics. |
|
|
288
292
|
| `key` | `string` or `null` | No | The stable key of the step. It does not change between versions. |
|
|
289
293
|
|
|
290
294
|
### `feature_list`
|
|
291
295
|
|
|
292
|
-
`items` is a list. Each item describes one feature flag
|
|
296
|
+
`items` is a list. Each item describes one feature flag that resolved for the visitor. In
|
|
297
|
+
Picked Analytics, the `feature_items` column of `fact_events` holds the list.
|
|
298
|
+
|
|
299
|
+
Two more columns of `fact_events` come from the visit, and not from the event. The
|
|
300
|
+
`features` column maps each `ab_feature` to its `ab_bucket`. The `feature_keys` column maps
|
|
301
|
+
each `ab_feature` to its `ab_key`.
|
|
293
302
|
|
|
294
303
|
| Field | Type | Required | Description |
|
|
295
304
|
| --- | --- | --- | --- |
|
|
296
305
|
| `items` | `array` | Yes | One entry for each feature flag. |
|
|
297
|
-
| `items[].ab_feature` | `string` | Yes | The feature
|
|
298
|
-
| `items[].ab_name` | `string` | Yes | The
|
|
299
|
-
| `items[].ab_key` | `string` | Yes | The
|
|
300
|
-
| `items[].ab_bucket` | `boolean` or `string` | Yes | The bucket of the visitor. It is `
|
|
306
|
+
| `items[].ab_feature` | `string` | Yes | The ID of the feature flag. For a feature flag from the dashboard, it is the key of the feature flag. |
|
|
307
|
+
| `items[].ab_name` | `string` | Yes | The name of the feature flag. |
|
|
308
|
+
| `items[].ab_key` | `string` | Yes | The version key. For a feature flag from the dashboard, it is `v` and the version, such as `v4`. A feature flag in SDK code sends its own `key`. |
|
|
309
|
+
| `items[].ab_bucket` | `boolean` or `string` | Yes | The bucket of the visitor. It is `true` or `false`, or the value of a variant of a Text feature flag. A feature flag in SDK code sends the value that its `decide` gives. |
|
|
301
310
|
|
|
302
311
|
### `field_list`
|
|
303
312
|
|
|
@@ -316,8 +325,8 @@ The `session` schema has no required field. A value is `null` until Picked has i
|
|
|
316
325
|
|
|
317
326
|
| Field | Type | Required | Description |
|
|
318
327
|
| --- | --- | --- | --- |
|
|
319
|
-
| `items` | `array` | Yes | One entry for each field
|
|
320
|
-
| `items[].field_id` | `string` | Yes | The
|
|
328
|
+
| `items` | `array` | Yes | One entry for each response to a field whose `policies.trackValue` is `true`. The SDK sends no `response_list` when no response has such a field. |
|
|
329
|
+
| `items[].field_id` | `string` | Yes | The key of the field, and not the `id` of the field in `field_list`. |
|
|
321
330
|
| `items[].values` | `array` | Yes | The values that the visitor gave. |
|
|
322
331
|
| `items[].values[].value` | `string`, `number`, `boolean`, `object`, `array`, or `null` | Yes | One response value. |
|
|
323
332
|
|
|
@@ -342,7 +351,7 @@ The `session` schema has no required field. A value is `null` until Picked has i
|
|
|
342
351
|
| `node_type` | `string` | Yes | The HTML tag name in lower case. It is `unknown` when the event has no element. |
|
|
343
352
|
| `id` | `string` or `null` | No | The `id` attribute of the element. |
|
|
344
353
|
| `text` | `string` or `null` | No | The text content of the element, to 255 characters. |
|
|
345
|
-
| `label` | `string` or `null` | No | The label of the element. It is the
|
|
354
|
+
| `label` | `string` or `null` | No | The label of the element. It is the `interaction_type` column of `fact_events` in Picked Analytics. That column is empty when the event has no label. |
|
|
346
355
|
|
|
347
356
|
### `exception`
|
|
348
357
|
|
|
@@ -359,10 +368,10 @@ Manager maps onto it directly. Every item field accepts `null`.
|
|
|
359
368
|
| --- | --- | --- | --- |
|
|
360
369
|
| `items` | `array` | Yes | One entry for each product. |
|
|
361
370
|
| `title` | `string` or `null` | No | The title of the list. |
|
|
362
|
-
| `items[].item_id` | `string` or `null` | No | The product ID.
|
|
363
|
-
| `items[].item_name` | `string` or `null` | No | The product name. |
|
|
371
|
+
| `items[].item_id` | `string` or `null` | No | The product ID. `dim_product` in Picked Analytics does not keep it. |
|
|
372
|
+
| `items[].item_name` | `string` or `null` | No | The product name. It is the `product_name` column of `dim_product` in Picked Analytics. `dim_product` keeps only an item that has a name. |
|
|
364
373
|
| `items[].item_brand` | `string` or `null` | No | The brand. |
|
|
365
|
-
| `items[].item_category` | `string` or `null` | No | The category. `item_category2` to `item_category5` hold the deeper levels. |
|
|
374
|
+
| `items[].item_category` | `string` or `null` | No | The category. It is the `product_category` column of `dim_product` in Picked Analytics. `item_category2` to `item_category5` hold the deeper levels. |
|
|
366
375
|
| `items[].item_variant` | `string` or `null` | No | The variant. |
|
|
367
376
|
| `items[].item_list_id` | `string` or `null` | No | The ID of the list that the product came from. |
|
|
368
377
|
| `items[].item_list_name` | `string` or `null` | No | The name of that list. |
|
|
@@ -384,7 +393,7 @@ Manager maps onto it directly. Every item field accepts `null`.
|
|
|
384
393
|
|
|
385
394
|
| Field | Type | Required | Description |
|
|
386
395
|
| --- | --- | --- | --- |
|
|
387
|
-
| `id` | `string` | Yes | The order ID. It is `order_id` in
|
|
396
|
+
| `id` | `string` | Yes | The order ID. It is the `order_id` column of `fact_events` in Picked Analytics. |
|
|
388
397
|
| `customer_id` | `string` or `null` | No | The customer ID in the store. |
|
|
389
398
|
| `checkout_token` | `string` or `null` | No | The checkout token in the store. |
|
|
390
399
|
| `cart_token` | `string` or `null` | No | The cart token in the store. |
|
|
@@ -395,9 +404,9 @@ The event schema wraps every event, and it is not a context.
|
|
|
395
404
|
|
|
396
405
|
| Field | Type | Required | Description |
|
|
397
406
|
| --- | --- | --- | --- |
|
|
398
|
-
| `type` | `string` | Yes | The event type. It is `event_type` in
|
|
407
|
+
| `type` | `string` | Yes | The event type. It is the `event_type` column of `fact_events` in Picked Analytics. |
|
|
399
408
|
|
|
400
|
-
The `meta` object of this schema is the `event_meta` column in
|
|
409
|
+
The `meta` object of this schema is the `event_meta` column of `fact_events` in Picked Analytics.
|
|
401
410
|
|
|
402
411
|
### `recommendation_list`
|
|
403
412
|
|
|
@@ -446,9 +455,6 @@ and on an option, `title` takes the place of `label`.
|
|
|
446
455
|
|
|
447
456
|
## Related
|
|
448
457
|
|
|
449
|
-
- [
|
|
450
|
-
contexts.
|
|
451
|
-
- [Schema](/reference/pickedql/schema) — the columns of `events` and of `metrics`.
|
|
452
|
-
- [Run an analytics query](/how-to/analytics) — a query for each common question.
|
|
458
|
+
- [MCP server](/reference/tools/mcp#run_analytics_sql) — the tools that query these events in Picked Analytics.
|
|
453
459
|
- [Install the GTM template](/how-to/install-the-gtm-template) — how to send an ecommerce
|
|
454
460
|
event from Google Tag Manager.
|
|
@@ -16,7 +16,7 @@ that the form responses decide:
|
|
|
16
16
|
```ts
|
|
17
17
|
import { createExperience } from '@picked/client/plugins/create-experience'
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const funnel = createExperience({
|
|
20
20
|
id: 'mini-funnel',
|
|
21
21
|
// experience config
|
|
22
22
|
})
|
|
@@ -56,7 +56,7 @@ response or a [predicate](/reference/sdk/predicates):
|
|
|
56
56
|
```ts
|
|
57
57
|
import { createField } from '@picked/client/plugins/create-experience'
|
|
58
58
|
|
|
59
|
-
// Show the email field only when the
|
|
59
|
+
// Show the email field only when the visitor chose "email" as a contact method.
|
|
60
60
|
export const emailField = createField({
|
|
61
61
|
id: 'email-input',
|
|
62
62
|
name: 'email-input',
|
|
@@ -124,7 +124,7 @@ export const contactMethodsField = createField({
|
|
|
124
124
|
id: 'mail',
|
|
125
125
|
label: 'Postal Mail',
|
|
126
126
|
value: 'mail',
|
|
127
|
-
// Only show this option if
|
|
127
|
+
// Only show this option if the visitor has a verified address
|
|
128
128
|
condition: {
|
|
129
129
|
'==': [
|
|
130
130
|
{
|
|
@@ -6,7 +6,7 @@ layout: docs
|
|
|
6
6
|
# Fields
|
|
7
7
|
|
|
8
8
|
Define your fields in code with `createField()`. Check the input with JSON Logic.
|
|
9
|
-
Read the values that a
|
|
9
|
+
Read the values that a visitor sends through the step context.
|
|
10
10
|
|
|
11
11
|
## Define a field
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ identifier, a name, a type, a label, and a count of the values that it takes:
|
|
|
17
17
|
```ts
|
|
18
18
|
import { createField } from '@picked/client/plugins/create-experience'
|
|
19
19
|
|
|
20
|
-
// A text input that the
|
|
20
|
+
// A text input that the visitor must fill in.
|
|
21
21
|
export const emailField = createField({
|
|
22
22
|
id: 'email-address',
|
|
23
23
|
name: 'email-address',
|
|
@@ -101,7 +101,8 @@ const nameField = createField({
|
|
|
101
101
|
})
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
Set `multiple: true` and give an `options` array to let the visitor choose more than one
|
|
105
|
+
value:
|
|
105
106
|
|
|
106
107
|
```ts
|
|
107
108
|
const nameField = createField({
|
|
@@ -204,7 +205,7 @@ storage.
|
|
|
204
205
|
|
|
205
206
|
## Field metadata
|
|
206
207
|
|
|
207
|
-
Add more text to help the
|
|
208
|
+
Add more text to help the visitor:
|
|
208
209
|
|
|
209
210
|
```ts
|
|
210
211
|
const passwordField = createField({
|
|
@@ -15,10 +15,10 @@ JavaScript.
|
|
|
15
15
|
|
|
16
16
|
## Precondition and condition
|
|
17
17
|
|
|
18
|
-
| Category | Question
|
|
19
|
-
| ------------ |
|
|
20
|
-
| Precondition | Must Picked start?
|
|
21
|
-
| Condition | Is this
|
|
18
|
+
| Category | Question | Description |
|
|
19
|
+
| ------------ | ------------------------- | --------------------------------------------------------------------------------------------- |
|
|
20
|
+
| Precondition | Must Picked start? | Use it to check the environment, to filter by page, or for a feature flag that turns the SDK off completely. |
|
|
21
|
+
| Condition | Is this visitor eligible? | Use it to divide your visitors into two groups for an A/B test, or to reach one group of visitors. The SDK starts an experience only for a visitor who passes it. The SDK records the last result as `is_user` in the `session` context of each event that it sends. The SDK keeps that result in browser storage. Until the condition runs on a page, the `session` context holds the result from an earlier page, or it has no `is_user`. |
|
|
22
22
|
|
|
23
23
|
```ts
|
|
24
24
|
const picked = createClient({
|
|
@@ -37,8 +37,9 @@ onboardingExperience.addStep(welcomeStep)
|
|
|
37
37
|
onboardingExperience.addStep(contactStep)
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Each step needs a `name
|
|
41
|
-
step
|
|
40
|
+
Each step needs a `name`. Your analytics events identify the step by its `id` and its
|
|
41
|
+
`key`, and put the name in the step context as `title`. An `id` is optional. Picked makes
|
|
42
|
+
one for you when you give none. The `key` is the `id` when you give no `key`.
|
|
42
43
|
|
|
43
44
|
You can use the same step on more than one experience.
|
|
44
45
|
|
|
@@ -60,29 +61,30 @@ const emailField = createField({
|
|
|
60
61
|
})
|
|
61
62
|
```
|
|
62
63
|
|
|
63
|
-
Add a field to a step with `step.addField()
|
|
64
|
-
`fieldIds` when you create the step:
|
|
64
|
+
Add a field to a step with `step.addField()`:
|
|
65
65
|
|
|
66
66
|
```ts
|
|
67
67
|
const contactStep = createStep({
|
|
68
68
|
id: 'contact',
|
|
69
|
-
|
|
69
|
+
name: 'Contact Details',
|
|
70
70
|
})
|
|
71
71
|
|
|
72
72
|
contactStep.addField(emailField)
|
|
73
|
+
```
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
You can also put the fields in the `fields` array when you create the step:
|
|
75
76
|
|
|
77
|
+
```ts
|
|
76
78
|
const contactStep = createStep({
|
|
77
79
|
id: 'contact',
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
name: 'Contact Details',
|
|
81
|
+
fields: [emailField],
|
|
80
82
|
})
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|
## Use a condition in an experience
|
|
84
86
|
|
|
85
|
-
A [condition](/reference/sdk/conditions) defines when an experience becomes active for the
|
|
87
|
+
A [condition](/reference/sdk/conditions) defines when an experience becomes active for the visitor.
|
|
86
88
|
|
|
87
89
|
```ts
|
|
88
90
|
import { createExperience, createStep } from '@picked/client/plugins/create-experience'
|
|
@@ -6,7 +6,7 @@ layout: docs
|
|
|
6
6
|
# Hotjar
|
|
7
7
|
|
|
8
8
|
`@picked/hotjar` sends the events of the Picked client to Hotjar. Each event becomes a
|
|
9
|
-
Hotjar event, and the
|
|
9
|
+
Hotjar event, and the visitor ID identifies the Hotjar user.
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
import { createClient } from 'picked'
|
|
@@ -49,7 +49,7 @@ The plugin keeps each event until Hotjar is ready, and then sends the events in
|
|
|
49
49
|
|
|
50
50
|
## User attributes
|
|
51
51
|
|
|
52
|
-
On the `session` event, the plugin calls `Hotjar.identify` with the
|
|
52
|
+
On the `session` event, the plugin calls `Hotjar.identify` with the visitor ID. The
|
|
53
53
|
attributes are `projectId` and the return value of `getUserAttributes`.
|
|
54
54
|
|
|
55
55
|
The plugin does nothing outside a browser.
|
|
@@ -39,9 +39,9 @@ different version makes a different Sentry scope, and the plugin then sends noth
|
|
|
39
39
|
| --- | --- |
|
|
40
40
|
| `exception` with `level: 'info'` | `captureMessage`, with the tag `picked: true`. |
|
|
41
41
|
| `exception` with a different `level` | `captureException`, with the tag `picked: true`. |
|
|
42
|
-
| `session` | The tag `picked.id`, with the
|
|
42
|
+
| `session` | The tag `picked.id`, with the visitor ID as its value. |
|
|
43
43
|
| `feature_decide` | The tag `picked.feature.<feature ID>`, with the bucket of the feature as its value. |
|
|
44
|
-
| `user_decide` | The tag `picked.is_user`, with the
|
|
44
|
+
| `user_decide` | The tag `picked.is_user`, with the result of the condition of the client as its value: `true` or `false`. |
|
|
45
45
|
|
|
46
46
|
The plugin does nothing outside a browser.
|
|
47
47
|
|
|
@@ -56,8 +56,8 @@ through the AJAX API of the Shopify cart:
|
|
|
56
56
|
|
|
57
57
|
| Attribute | Value |
|
|
58
58
|
| --- | --- |
|
|
59
|
-
| `picked.id` | The
|
|
60
|
-
| `picked.is_user` | `'true'` or `'false'
|
|
59
|
+
| `picked.id` | The visitor ID. The SDK keeps it in browser storage across visits. |
|
|
60
|
+
| `picked.is_user` | `'true'` or `'false'`: the result of the condition of the client. |
|
|
61
61
|
| `picked.features.<feature ID>` | The bucket of each resolved feature. |
|
|
62
62
|
|
|
63
63
|
The plugin writes the attributes again on the `initialize`, `session`, `user_decide`,
|
|
@@ -17,13 +17,13 @@ Each predicate takes a `StateSnapshot` object with these properties:
|
|
|
17
17
|
```ts
|
|
18
18
|
interface StateSnapshot {
|
|
19
19
|
client: Picked // The Picked client.
|
|
20
|
-
responses
|
|
21
|
-
// Every response from the
|
|
22
|
-
|
|
20
|
+
responses: Array<{
|
|
21
|
+
// Every response from the visitor.
|
|
22
|
+
fieldKey: string
|
|
23
23
|
value: FieldValue | undefined
|
|
24
24
|
}>
|
|
25
|
-
args
|
|
26
|
-
fields
|
|
25
|
+
args: unknown[]
|
|
26
|
+
fields: Field[] // Every registered field.
|
|
27
27
|
location?: Location // The browser location: URL, pathname, search, and more.
|
|
28
28
|
document?: Document // The browser document object.
|
|
29
29
|
sessionStorage?: Storage // The browser sessionStorage API.
|
|
@@ -11,11 +11,12 @@ each part.
|
|
|
11
11
|
|
|
12
12
|
## The server entry point
|
|
13
13
|
|
|
14
|
-
The
|
|
15
|
-
|
|
14
|
+
The snapshot helpers live in a dedicated entry point. `serialize` runs on the server.
|
|
15
|
+
`hydrateFromSnapshot` applies a snapshot to a client. You can use it on the server or
|
|
16
|
+
in the browser.
|
|
16
17
|
|
|
17
18
|
```ts
|
|
18
|
-
import { serialize, registerProjectConfig } from '@picked/client/server'
|
|
19
|
+
import { serialize, hydrateFromSnapshot, registerProjectConfig } from '@picked/client/server'
|
|
19
20
|
import type { PickedSnapshot } from '@picked/client/server'
|
|
20
21
|
```
|
|
21
22
|
|
|
@@ -47,6 +47,36 @@ top of the `<script>` block of a component. It takes the same two modes,
|
|
|
47
47
|
<ExperienceSlot name="page" />
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
## Navigate in place between server-rendered pages
|
|
51
|
+
|
|
52
|
+
An application can change the page without a full page load. For example, a router
|
|
53
|
+
loads the next page and its snapshot, then renders the page in the same document. Use
|
|
54
|
+
`hydrateFromSnapshot` from `@picked/client/server` to apply the new snapshot to the
|
|
55
|
+
client that is live.
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { hydrateFromSnapshot, type PickedSnapshot } from '@picked/client/server'
|
|
59
|
+
|
|
60
|
+
function showPage(snapshot: PickedSnapshot) {
|
|
61
|
+
hydrateFromSnapshot(client, snapshot)
|
|
62
|
+
// Render the next page here.
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`hydrateFromSnapshot` is synchronous. It registers the content of the snapshot and
|
|
67
|
+
seeds the condition results. The slots then show the experiences that the snapshot
|
|
68
|
+
chooses. `PickedProvider` and `setPickedContext` use the same function for the first
|
|
69
|
+
snapshot.
|
|
70
|
+
|
|
71
|
+
The client records the `versionId` of the first snapshot. When a later snapshot has
|
|
72
|
+
the same `versionId`, the function does not register the project config again. The
|
|
73
|
+
registered experiences and their live instances stay. When a later snapshot has a
|
|
74
|
+
different `versionId`, or its `versionId` is `null`, the function registers the
|
|
75
|
+
project config of that snapshot.
|
|
76
|
+
|
|
77
|
+
Apply the snapshot before you render the next page. If you render first, the slots
|
|
78
|
+
show the experiences of the previous page.
|
|
79
|
+
|
|
50
80
|
## Render the page component
|
|
51
81
|
|
|
52
82
|
The SDK does not connect content to a component. You own the component that a Page
|
|
@@ -22,13 +22,13 @@ export default defineConfig({
|
|
|
22
22
|
})
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
| Option
|
|
26
|
-
|
|
|
27
|
-
| `projectId`
|
|
28
|
-
| `typesOutput`
|
|
29
|
-
| `source`
|
|
30
|
-
| `previewToken` | Workspace preview token. Required when `source` is `'preview'`, and read only then.
|
|
31
|
-
| `data`
|
|
25
|
+
| Option | Description |
|
|
26
|
+
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `projectId` | **Required.** Your Picked project id. |
|
|
28
|
+
| `typesOutput` | Path for generated types (defaults to `./src/picked-env.d.ts`). |
|
|
29
|
+
| `source` | Schema surface to type against: `'published'` (default) or `'preview'`. |
|
|
30
|
+
| `previewToken` | Workspace preview token. Required when `source` is `'preview'`, and read only then. |
|
|
31
|
+
| `data` | Where a build gets the data of your project: `'bundle'` (default), `'api'` or `'snapshot'`. See [`data`](/reference/tools/vite-plugin#data). |
|
|
32
32
|
|
|
33
33
|
The `source` value matches the `x-picked-source` field on the [workspace schema](/reference/delivery-api/workspace-schema) document — it controls whether tooling fetches the published or preview workspace shape.
|
|
34
34
|
|
|
@@ -58,6 +58,17 @@ Three places can give the token. Tooling reads the first of them that has one: t
|
|
|
58
58
|
`PICKED_PREVIEW_TOKEN` environment variable, then the workspace that
|
|
59
59
|
[`picked workspace use`](/reference/tools/cli) chose, then this `previewToken` option.
|
|
60
60
|
|
|
61
|
+
The `picked.config.ts` of an app has an `app` section. A config can have a `projectId`, an
|
|
62
|
+
`app` section, or both. For the `app` section, refer to
|
|
63
|
+
[App manifest](/reference/apps/manifest#the-app-section-of-pickedconfig).
|
|
64
|
+
|
|
65
|
+
`picked generate types` and the Vite plugin need a `projectId`. They also read it from a config
|
|
66
|
+
that has an `app` section. When the config has no `projectId`, they stop with this error:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
picked.config in <dir> names no project. Add `projectId` beside its `app` section.
|
|
70
|
+
```
|
|
71
|
+
|
|
61
72
|
### 2. Enable the Vite plugin (recommended)
|
|
62
73
|
|
|
63
74
|
If you use Vite, add `@picked/vite-plugin-picked`. Type generation runs automatically on `dev` and `build` when `generateTypes` is enabled (the default):
|
|
@@ -122,12 +133,9 @@ The generated `picked-env.d.ts` file looks like:
|
|
|
122
133
|
// GENERATED by `@picked/typegen` — do not edit by hand.
|
|
123
134
|
// Reference: `https://docs.picked.app/reference/sdk/type-generation`
|
|
124
135
|
|
|
125
|
-
export type WelcomePage = {
|
|
126
|
-
export type FieldValues = {
|
|
127
|
-
export type FeatureKey =
|
|
128
|
-
| 'default'
|
|
129
|
-
| 'hero'
|
|
130
|
-
| 'winter-sale'
|
|
136
|
+
export type WelcomePage = {/* ... */}
|
|
137
|
+
export type FieldValues = {/* ... */}
|
|
138
|
+
export type FeatureKey = 'default' | 'hero' | 'winter-sale'
|
|
131
139
|
|
|
132
140
|
declare module '@picked/client' {
|
|
133
141
|
interface PickedSchemaRegistry {
|
|
@@ -135,13 +143,10 @@ declare module '@picked/client' {
|
|
|
135
143
|
'welcome-page': WelcomePage
|
|
136
144
|
}
|
|
137
145
|
stepContentModels: {
|
|
138
|
-
|
|
146
|
+
intro: 'welcome-page'
|
|
139
147
|
}
|
|
140
148
|
featureValues: {
|
|
141
|
-
'hero'
|
|
142
|
-
| false
|
|
143
|
-
| 'hero-a'
|
|
144
|
-
| 'hero-b'
|
|
149
|
+
hero: false | 'hero-a' | 'hero-b'
|
|
145
150
|
}
|
|
146
151
|
fieldValues: FieldValues
|
|
147
152
|
featureKeys: FeatureKey
|
|
@@ -237,7 +242,7 @@ A hook still accepts one. Each key type holds the keys of the workspace and any
|
|
|
237
242
|
string. Your editor shows the workspace keys, and no local key is an error:
|
|
238
243
|
|
|
239
244
|
```typescript
|
|
240
|
-
useFeature('winter-sale')
|
|
245
|
+
useFeature('winter-sale') // from the workspace, and suggested
|
|
241
246
|
useFeature('summer-sales-experiment') // from createClient, and accepted
|
|
242
247
|
```
|
|
243
248
|
|
|
@@ -38,6 +38,7 @@ const data = await client.request(MeQuery, {})
|
|
|
38
38
|
| `apiUrl` | `string` | required | The origin of the API, for example `https://api.picked.app`. |
|
|
39
39
|
| `token` | `string \| (() => string \| Promise<string>)` | none | A bearer token. A function gives a new token for each request. |
|
|
40
40
|
| `apiKey` | `string` | none | An API key. The client sends it in the `X-API-Key` header. |
|
|
41
|
+
| `fetch` | `typeof fetch` | the global `fetch` | The function that sends each request. |
|
|
41
42
|
|
|
42
43
|
See [Authentication](/reference/management-api/authentication) for the tokens and keys
|
|
43
44
|
that the API accepts.
|
|
@@ -53,6 +54,7 @@ client.request(document, variables, options?): Promise<Result>
|
|
|
53
54
|
| `document` | `TadaDocumentNode` | A document that `graphql` makes. |
|
|
54
55
|
| `variables` | `object` | The variables of the document. Use `{}` for a document without variables. |
|
|
55
56
|
| `options.timeoutMs` | `number` | The time limit of the request in milliseconds. The default is `30000`. |
|
|
57
|
+
| `options.headers` | `Record<string, string>` | Headers for this request only. They replace the `token` and `apiKey` headers that have the same name. |
|
|
56
58
|
|
|
57
59
|
The client does not check the shape of the response at runtime.
|
|
58
60
|
|
|
@@ -83,6 +85,19 @@ different project:
|
|
|
83
85
|
The `picked workspace export` and `picked workspace import` commands use these documents.
|
|
84
86
|
See [CLI](/reference/tools/cli).
|
|
85
87
|
|
|
88
|
+
## App installation documents
|
|
89
|
+
|
|
90
|
+
The package also gives the documents that an app server sends as one installation. The
|
|
91
|
+
installation client of [`@picked/app-kit`](/reference/apps/app-kit#installation-client)
|
|
92
|
+
sends them:
|
|
93
|
+
|
|
94
|
+
| Document | Operation |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `AppInstallationLabelsDocument` | Reads the labels of an installation. |
|
|
97
|
+
| `LabelsSetDocument` | Makes or replaces labels. |
|
|
98
|
+
| `LabelsDeleteDocument` | Removes labels. |
|
|
99
|
+
| `AppInstallationTokenCreateDocument` | Makes an installation token. The request sends an app assertion in the `picked-app-assertion` header, through `options.headers`. |
|
|
100
|
+
|
|
86
101
|
## Related
|
|
87
102
|
|
|
88
103
|
- [Authentication](/reference/management-api/authentication)
|