Router

Router

This component interacts with the user's browser history and URL.

When you enable the router component, users can go back and forth in the browser history when filtering and searching. It also makes it possible to copy the URL to share the current search state.

This component must be linked to a search Store, since it retrieves the values of the last search from it.

Usage

This is how you create this component:

sdk.component('router', target: HTMLElement|String);

Tracking

This component does not track any event by itself. However, if the user reloads a page using the router component, it runs the search again using the endpoint POST /federated-searches. This search is bound to the current session and the tracking option set to true.

Example using the results component Store, using the linkTo method:

<div id="router"></div>
<div id="results"></div>

<script>
  var results = sdk.component('results', '#results');
  var router = sdk.component('router', '#router');
  results.linkTo(router);
</script>