Creating a widget click event
When a visitor clicks anywhere on a Sitecore Search widget, you need to send a widget click
event. Most widget clicks are on entities, but they can also be on categories, filters, or navigation buttons.
For the event object data model, see the Events API reference.
Widget click on an entity
If a visitor clicks on an entity in a Sitecore Search widget, send a widget click
event with the action_cause
key set to entity.
In addition to the default attributes that are required for all events, the index,
rfk_id
, and entities
attributes are required for click
events on entities. The entities
array must contain an object representing the entity clicked on, with at least the id
and entity_type
attributes included.
The following is an example of a widget click
event on an entity:
{
"name": "widget",
"action": "click",
"action_cause": "entity",
"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": "<>"
},
"index": 1,
"entities": [
{
"id": "123",
"entity_type": "content",
"entity_subtype": "article",
"attributes": {
"author": "ABC"
}
}
]
}
}
Widget click on a category
If a visitor clicks on a category link in a Sitecore widget, send a widget click
event with the action_cause
key set to "category"
.
In addition to the default attributes that are required for all events, the click_text
, click_uri
, click_text_id
, rfk_id
, and entities
attributes are required for click
events on categories. The entities
array must contain an object representing the category clicked on, with at least the id
and entity_type
attributes included.
The following is an example of a widget click
event on a category:
{
"name": "widget",
"action": "click",
"action_cause": "category",
"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>",
"request": {
"keyword": "<kw>",
"modified_keyword": "<>"
},
"context": <context object>,
"click_text_id": "top-article",
"click_text": "Top Articles",
"click_uri": "http://test.com/top-articles",
"index": "3",
"entities": [
{
"id": "123",
"entity_type": "category"
}
]
}
}
Widget click on a filter
If a visitor clicks on a filter or facet in a Sitecore Search widget, send a widget click
event with the action_cause
key set to "filter"
.
In addition to the default attributes that are required for all events, the filters
and rfk_id
attributes are required for click
events on filters. The filters
array must contain an object representing the filter the user has selected. This object must include at least the name
attribute.
The following is an example of a widget click
event on a filter:
{
"name": "widget",
"action": "click",
"action_cause": "filter",
"uuid": "<uuid>",
"client_time_ms": 1234,
"page_load_time_ms": 1233,
"interaction_id": "<Interaction ID>",
"value": {
"rfk_id": "<Widget ID>",
"context": <context object>,
"request": {
"keyword": "<kw>",
"modified_keyword": "<>"
},
"index": 1,
"filters": [
{
"name": "content-type",
"value": ["article"],
"value_position": [2],
"facet_position": 3,
"display_name": ["Article"],
"title": "Content Type"
}
]
}
}