Tracking user interactions
Sitecore Search JS Data package offers various methods to register user interactions with your component.
Registering user interactions
The following code block shows how you can register view and page view events. The methods contain all the necessary information to use HTTP to connect with Search. You must call these events after authentication.
import {
trackPageViewEvent,
trackPageViewEvent
} from "@sitecore-search/data";
const widgetPayLoad = { keyphrase: "search word", index: 0 }
const trackViewEventPayload = { rfkid: "rfk_id", entities: "content", payload: widgetPayLoad }
trackViewEvent ( trackViewEventPayload )
const entityPayload = { id: "i2382", entityType: "content" }
const pageViewPayload = { items: [ entityPayload ] }
const trackPageViewEventPayload = { name: "detail", pageViewPayload: widgetPayLoad }
trackPageViewEvent ( trackPageViewEventPayload )Available methods
The following table lists the various methods to register user interaction. In addition to the events for specific widget types, the list includes global and funnel events.
|
Event interface |
Event type |
|---|---|
|
Recommendation event | |
|
Recommendation event | |
|
Preview Search event | |
|
Search Results event | |
|
Search Results event | |
|
Global event | |
|
Funnel event | |
|
Funnel event | |
|
Global event | |
|
Global event | |
|
Global event |