Hybrid Search — Interactions

See what the Hybrid Search workflow reports to Miso as a reader uses the results and the answer, 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 search and answer metrics in Dojo from them. Below we list the interactions Hybrid Search sends, the fields Miso needs on each one, and then send one by hand.

You need a working Hybrid Search page first. See Hybrid Search — Quick Start.

What Hybrid Search sends

The SDK watches each part of the page and sends an interaction when the reader acts on it. property names the part:

PropertyElementTypesSubject
products<miso-products>impression, viewable_impression, clickproduct_ids of the results
sources<miso-sources>impression, viewable_impression, clickproduct_ids of the articles
images<miso-images>impression, viewable_impression, clickproduct_ids of the images
affiliation<miso-affiliation>impression, viewable_impression, clickThe affiliate products, with channel and positions
answer<miso-answer>clickitems, the link texts, with urls

The answer has its own workflow, client.ui.hybridSearch.answer, but its records go out as Hybrid Search records, with the same api_name and workflow as the results.

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, Hybrid Search 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:

TypeThe reader
impressionHas the part on the page, seen or not.
viewable_impressionHas at least half of the part in view for one second.
clickClicks a link in the part.
feedbackRates the answer.

Each part sends impression and viewable_impression once for each item and each query.

What a record holds

A click on a search result goes out like this:

{
  "type": "click",
  "product_ids": ["article-1042"],
  "miso_id": "7c8d9e0f-1a2b-…",
  "anonymous_id": "5f6a7b8c-9d0e-…",
  "context": {
    "custom_context": {
      "api_group": "ask",
      "api_name": "search",
      "property": "products",
      "question_id": "0e1f2a3b-4c5d-…",
      "root_miso_id": "d02603ab-d544-…",
      "question_source": "_organic",
      "workflow": "hybrid-search"
    }
  }
}

The fields mean:

FieldValue
typeOne of the types above.
product_idsThe product_id of each result, article, image or product the reader acted on. [] for answer.
miso_idOn products only: the miso_id of the search response the results came from.
anonymous_id, user_idThe reader, from the client context.
value, result_typeOn feedback only: the rating, and answer.
context.custom_context.api_groupask
context.custom_context.api_namesearch
context.custom_context.workflowhybrid-search
context.custom_context.propertyOne of the properties above. Absent on feedback.
context.custom_context.itemsThe link texts the reader acted on, for answer.
context.custom_context.event_targetcitation-link on a citation click.
context.custom_context.question_idThe question_id of the answer to the query.
context.custom_context.root_miso_idThe miso_id of the first page of results for the query. On every record, answer parts included.
context.custom_context.question_sourceHow the reader asked: _organic for a typed query.

Send an interaction yourself

Send your own when you render a part of the page with your own code, for example a list of results you build from the data event. Hybrid Search 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.hybridSearch.useTrackers({ products: { active: false } });

To track every part yourself, turn off all the trackers:

client.ui.hybridSearch.useTrackers(false);

Then call client.api.interactions.upload with the fields above. Pass it the request and value from the data event of client.ui.hybridSearch you rendered the list from:

function reportResultClick(client, { request, value }, productId) {
  const { metadata = {} } = request.payload;
  client.api.interactions.upload({
    type: "click",
    product_ids: [productId],
    miso_id: value.miso_id,
    context: {
      custom_context: {
        api_group: "ask",
        api_name: "search",
        workflow: "hybrid-search",
        property: "products",
        question_id: value.question_id,
        root_miso_id: value.root_miso_id,
        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

SymptomCause
Clicks count twiceThe SDK tracker for that part is still on. Turn it off with useTrackers.
A part shows clicks but no click-through rateOnly click is sent. Send impression and viewable_impression as well.
Nothing reaches Miso and the console warns about a playground appMiso does not store interactions for a playground app. Use your own app's key.

Next