Ask API - interactions (explore)
Performance events
To generate performance measurement data for analytics, you can send the following events to Miso API:
- Impression
- Viewable impression
- Click
See Performance measurement for detailed definitions.
Syntax
To send an event using SDK that works with analytics, specifying api_group
, api_name
, and property
in custom_context
is required.
client.api.interactions.upload({
type: 'impression', // or 'viewable_impression', 'click'
product_ids: [...], // if subjects are catalog items
context: {
custom_context: {
api_group: 'ask',
api_name: 'related_questions',
property: '...',
items: [...], // if subjects are not catalog items
},
},
});
Parameter | Type | Description |
---|---|---|
type |
string | Event type: impression , viewable_impression , or click . |
product_ids |
array of strings | Product ids of the event subjects |
items |
array of strings | Event subjects (when they are not catalog items) |
api_group |
string | The first segment of API path, in snake case |
api_name |
string | The second segment of API path, in snake case |
property |
string | The property name of the event subjects, which corresponds to the API response |
API and key properties
API | Property | Is catalog item? |
---|---|---|
related_questions |
related_questions |
✗ |
Examples
For example, suppose we call the API with the following response:
const response = await client.api.ask.relatedQuestions(payload);
// response
{
related_questions: [
'question_1',
'question_2',
'question_3'
],
...
}
And we want to track click events on the first two items from the related_questions
property, then we send the following interaction:
client.api.interactions.upload({
type: 'click',
context: {
custom_context: {
api_group: 'ask',
api_name: 'related_questions',
property: 'related_questions',
items: ['question_1', 'question_2'],
},
},
});