@threekit/analytics
Advanced tools
Comparing version 0.1.95 to 0.1.96
@@ -43,3 +43,4 @@ import { ARStage, type AssetOption, Configuration, type Context, OptionInteractionType, OptionsType, type QuizOption, ShareType, type ThreekitAuthProps, type ValueOption, VisualInteractionType } from '@threekit/rest-api'; | ||
}): void; | ||
query({ query }: { | ||
query({ queryName, query }: { | ||
queryName: string; | ||
query: Record<string, string>; | ||
@@ -46,0 +47,0 @@ }): void; |
@@ -152,3 +152,3 @@ import { errorToString } from '@threekit/diagnostics'; | ||
} | ||
query({ query }) { | ||
query({ queryName, query }) { | ||
// ensure we don't spam the service with repeated errors when things are in a bad state | ||
@@ -163,2 +163,3 @@ this.errorCount++; | ||
eventType: Event2Type.Query, | ||
queryName, | ||
query | ||
@@ -165,0 +166,0 @@ }; |
{ | ||
"name": "@threekit/analytics", | ||
"version": "0.1.95", | ||
"version": "0.1.96", | ||
"type": "module", | ||
@@ -9,7 +9,7 @@ "main": "dist/index.js", | ||
"@threekit/diagnostics": "*", | ||
"@threekit/rest-api": "^0.1.92", | ||
"@threekit/rest-api": "^0.1.96", | ||
"uuid": "^9.0.1" | ||
}, | ||
"sideEffects": false, | ||
"gitHead": "28b33f1d6f9046fa4ff8f46c538cabd06b30e38c" | ||
"gitHead": "9ae0e15577780e7b2098f9d00aa37e169555f86f" | ||
} |
@@ -94,2 +94,39 @@ # @Threekit/Analytics | ||
### Queries | ||
If the user makes a query you can record it using this event, you can record both its text-based search and its structured query using this event, which takes a dictionary of strings: | ||
```ts | ||
getCurrentSession().query({ queryName: "product-search", query: { text: "stylish leggings", size: "12", color: "Blue" } ); | ||
``` | ||
### Chat Prompts and Responses | ||
If the user makes a query you can record it using this event, you can record both its text-based search and its structured query using this event, which takes a dictionary of strings: | ||
```ts | ||
getCurrentSession().chatPrompt({ | ||
promptId: 'introduction', | ||
promptText: | ||
'Introduce the selected product to the user in a professional manner, the selected product is ...' | ||
}); | ||
// ...submit prompt to LLM and get a response... | ||
getCurrentSession().chatResponse({ | ||
promptId: 'introduction', | ||
promptResponseText: | ||
'Hello and Welcome to eShop! This electronic yak shaver you have selected is the perfect wedding gift...' | ||
}); | ||
``` | ||
## Errors | ||
You can record any errors on the frontend to analytics, just pass in the error object (which must be derived from the JavaScript Error class): | ||
```ts | ||
const error = new Error('bad data encountered'); | ||
getCurrentSession().error(error); | ||
``` | ||
### Add To Cart | ||
@@ -96,0 +133,0 @@ |
@@ -238,3 +238,9 @@ import { errorToString } from '@threekit/diagnostics'; | ||
query({ query }: { query: Record<string, string> }) { | ||
query({ | ||
queryName, | ||
query | ||
}: { | ||
queryName: string; | ||
query: Record<string, string>; | ||
}) { | ||
// ensure we don't spam the service with repeated errors when things are in a bad state | ||
@@ -250,2 +256,3 @@ this.errorCount++; | ||
eventType: Event2Type.Query, | ||
queryName, | ||
query | ||
@@ -252,0 +259,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
190800
1964
245
Updated@threekit/rest-api@^0.1.96