Search.io's EventTracking provides flexible tracking which can be used to provide both useful analytics and to feed Search.io's machine learning algorithm data about the performance of search results.
This example includes three files of a shopping cart funnel where events are used to track search results (store products) as they move through the search -> add to cart -> purchase funnel. Additionally, localStorage is used to persist events for 30 days in case the initial search and final purchase occur over separate browser sessions.
On a search result screen, we can use the Search.io pre-built support rendering search results which includes storing events of clicked results into localStorage and sending them to Search.io as soon as possible.
const pipeline =newPipeline(
// Ensure field passed to EventTracking constructor is unique across products.
When a result is clicked we track a click event associated with query result from the previous screen. This lets the Search.io engine know that this was likely a good result for the search term.
Then, when a customer adds a product to their cart, we track an add_to_cart event which gives a stronger signal for this result. The customer has moved closer to the end of the funnel.
Unlike other examples which render Search.io search results, this is purely an example of how your own brand's storefront might be setup.