The Sensoreal Webfeed fires custom events on the native window object.

Event listeners can be configured to perform actions outside of the webfeed capabilities, such as navigating to a different page within the site or showing/hiding page additional content.

If additional events are required, please reach out to your Sensoreal account manager.

Events

# tag-click

Description

Fired when a decoration tag is clicked (i.e. not a release label tag). Event object will contain a $tag object that contains details about the tag that has been interacted with.

Usage

window.addEventListener('tag-click', event => {
  console.log(event.$tag)
})

Example

Navigating to a page when a specific tag is clicked.

window.addEventListener('tag-click', event => {
	if (!event.$tag) return
  if (event.$tag._id === "684f92d4d0c43f10174cc7d3") {
	  window.location = "/some-page"
  }
})

<aside> 💡

Note, the _id of a specific tag can be determined by console logging the tag event as in the Usage example and checking the $tag object in browser dev tools.

</aside>

# webfeed-navigation

Description

Fired when any navigation takes place. Event object will contain a $route object that contains details about the navigation destination location.

The event object will have a $route key which contains valuable information about the new route destination that has been navigated to, this could be used to choose which page content to programmically show.

Usage

window.addEventListener('webfeed-navigation', event => {
  console.log(event.$route)
})