Ask — Interactions
See what the Ask workflow reports to Miso as a reader uses the question box, and send the same records yourself when you render part of it on your own.
Each record is an interaction: a reader saw, scrolled to, clicked or rated something. Miso builds the answer metrics in Dojo from them. Below we list the interactions Ask sends, the fields Miso needs on each one, and then send one by hand.
You need a working Ask page first. See Ask — Quick Start.
What Ask sends
The SDK watches each part of the answer and sends an interaction when the
reader acts on it. property names the part:
| Property | Element | Types | Subject |
|---|---|---|---|
sources | <miso-sources> | impression, viewable_impression, click | product_ids of the articles |
related_resources | <miso-related-resources> | impression, viewable_impression, click | product_ids of the articles |
images | <miso-images> | impression, viewable_impression, click | product_ids of the images |
affiliation | <miso-affiliation> | impression, viewable_impression, click | The affiliate products, with channel and positions |
suggested_followup_questions | <miso-follow-up-questions> | impression, viewable_impression, click | items, the question texts |
answer | <miso-answer> | click | items, the link texts, with urls |
A click on a citation in the answer, such as [2], counts as a click on that
source. It goes out as a sources click with event_target: "citation-link",
so you can tell it apart from a click in the source list.
The rating buttons send one more type. When the reader clicks Helpful or
Not helpful, Ask sends type: "feedback" with result_type: "answer" and
value set to helpful or unhelpful. A second click on the same button
clears the rating and sends value: "unselected". This record has no
property.
The types mean:
| Type | The reader |
|---|---|
impression | Has the part on the page, seen or not. |
viewable_impression | Has at least half of the part in view for one second. |
click | Clicks a link in the part. |
feedback | Rates the answer. |
Each part sends impression and viewable_impression once for each answer.
A follow-up answer is a new question, so its parts send their own.
What a record holds
A click on the second citation of a follow-up answer goes out like this:
{
"type": "click",
"product_ids": ["article-1042"],
"anonymous_id": "5f6a7b8c-9d0e-…",
"context": {
"custom_context": {
"api_group": "ask",
"api_name": "questions",
"property": "sources",
"event_target": "citation-link",
"question_id": "0e1f2a3b-4c5d-…",
"root_question_id": "9a8b7c6d-5e4f-…",
"parent_question_id": "9a8b7c6d-5e4f-…",
"question_source": "_organic",
"workflow": "ask"
}
}
}
The fields mean:
| Field | Value |
|---|---|
type | One of the types above. |
product_ids | The product_id of each article, image or product the reader acted on. [] for a part whose subjects are text. |
anonymous_id, user_id | The reader, from the client context. |
value, result_type | On feedback only: the rating, and answer. |
context.custom_context.api_group | ask |
context.custom_context.api_name | questions |
context.custom_context.workflow | ask |
context.custom_context.property | One of the properties above. Absent on feedback. |
context.custom_context.items | The texts the reader acted on, for suggested_followup_questions and answer. |
context.custom_context.event_target | citation-link on a citation click. |
context.custom_context.question_id | The question_id of the answer the part belongs to. |
context.custom_context.root_question_id | The question_id of the first question in the thread. On the first question, this is the same as question_id. |
context.custom_context.parent_question_id | On a follow-up, the question it follows. |
context.custom_context.question_source | How the reader asked: _organic for a typed question, _suggested_questions for a click on a follow-up question. |
Send an interaction yourself
Send your own when you render a part of the answer with your own code, for
example a list of sources you build from the
data event. Ask cannot see clicks in
markup it did not render.
Turn off the SDK's tracker for that part first, so the same click does not count twice:
client.ui.asks.useTrackers({ sources: { active: false } });
To track every part yourself, turn off all the trackers:
client.ui.asks.useTrackers(false);
Then call client.api.interactions.upload with the fields above. Pass it
the workflow and request from the data event you rendered the list
from. client.ui.ask is the first question of the thread:
function reportSourceClick(client, { workflow, request }, productId) {
const { metadata = {} } = request.payload;
client.api.interactions.upload({
type: "click",
product_ids: [productId],
context: {
custom_context: {
api_group: "ask",
api_name: "questions",
workflow: "ask",
property: "sources",
question_id: workflow.questionId,
root_question_id: client.ui.ask.questionId,
parent_question_id: workflow.parentQuestionId,
question_source: metadata.question_source,
},
},
});
}
The SDK adds the reader's anonymous_id or user_id and the page URL for
you. Send impression and viewable_impression for the same list too, or
the click-through rate for that part has nothing to divide by.
From a server, or with no SDK on the page, send the same record to
POST /v1/interactions. See the API Reference.
If it does not work
| Symptom | Cause |
|---|---|
| Clicks count twice | The SDK tracker for that part is still on. Turn it off with useTrackers. |
| A part shows clicks but no click-through rate | Only click is sent. Send impression and viewable_impression as well. |
| Follow-up clicks count toward the first question | question_id is the root question. Take it from workflow.questionId. |
| Nothing reaches Miso and the console warns about a playground app | Miso does not store interactions for a playground app. Use your own app's key. |
Next
- Ask — Events — the events that carry
workflowand the response. - Answer Metrics — the reports Miso builds from these interactions.
