Creating a widget view event

You must send a widget view event when a visitor views a widget on a page. To ensure that analytics are recorded correctly, you must only send this event when the widget is in the visitor's viewport. This is to avoid incorrectly reporting a widget view event when the visitor has not yet scrolled down far enough to actually see the widget.

Important

In addition to the default attributes that are required for all events, the entities and rfk_id attributes are required for widget view events.

A widget can include multiple entities and, when viewing a widget, the user can see all content (entities) recommended to them. Because of this, the widget view event must include the entities attribute. The value of this attribute is an array of objects representing all of the recommended entities. By including these objects, you ensure proper attribution of entities by views.

The following is an example of a widget view event:

Note

For the event object data model, see the Events API reference.

RequestResponse
{
  "name": "widget",
  "action": "view",
  "uuid": "<uuid>",
  "client_time_ms": 1234,
  "page_load_time_ms": 1233,
  "request_id": "<Request ID from search/rec request>",
  "interaction_id": "<Interaction ID>",
  "value": {
    "rfk_id": "<Widget ID>",
    "context": <context object>,
    "request": {
      "keyword": "<kw>",
      "modified_keyword": "<>",
      "num_results": 20,
      "total_results": 50,
      "num_requested": 100,
      "page_size": 20
    },
    "entities": [
      {
        "id": "123",
        "entity_type": "content",
        "entity_subtype": "article",
        "attributes": {
           "author": "ABC"
        }
     },
     {
        "id": "124",
        "entity_type": "content",
        "entity_subtype": "article",
        "attributes": {
           "author": "ABC"
        }
     },
     {
        "id": "125",
        "entity_type": "content",
        "entity_subtype": "article",
        "attributes": {
           "author": "ABC"
        }
     }
    ]
   }
}

Do you have some feedback for us?

If you have suggestions for improving this article,