Using "Display Specific Info" Query Rules with InstantSearch.js. How do you display?

After setting up a consequence for “Displaying Specific Info” like in the documentation, I have no idea how to now use the userData object on the front-end.

How do you display the content?

    "condition": { /* [...] */ },
    "consequence": {
        "userData": {
            "message": "Summer Sales going on!",
            "blink": true,
            "url": "https:/"

Hi Giovanni,
The server should send the userData next to the hits, something like:

{ hits:[], userData: [] }

With InstantSearch.js, you might need to use connectors to access the server response object:

1 Like

Thanks Nicolas, I found the property :slight_smile:

Example of a custom widget where I’m using the property:

// custom wiget
	render: function(renderOptions) {
		var results = renderOptions.results;
			 document.getElementById('customWidget').textContent = results.userData[0].userData.message;

Not a good final solution, but a start. Thanks!


Here’s an example on how to do it with connectHits