Mapping Variables

Introduction

This is the most common type of variable. Mapping variables map the result (or hits) of a widget strategy to Layout Block Parameters (the parameters used by your front-end to render each template). It can be related to the current layout block (current-hit) or other blocks from the layout (response path). It is also possible to access a global variable of the response.

You can find a concrete example with Mapping Variables here : Narrative Variables - A Concrete Example

Hit or Global?

A Mapping Variable can refer either to a hit (the returned element of one of the main widget or of one of the Widget Accessors defined in the Narrative).

Select Hit if you want to access to the property of a product or content which is returned by a widget to display it as a parameter of this Layout block.

Select Global if you want to access a global variable of the response.

Hit > Current or Response

Current : Access a field of the current hit.

Response : Access a field of another hit from any widget response

If you select Response, you will need to define what is the widget and what is the widget and hit indexes (by default zero) so we know what is the hit you want to access

Widget index: 0 by default. Select another index in case you have several requests for the same widget.

Hit index: 0 by default. Select another index in case you don’t want to access the first hit of the widget response.

Hit > Field

Select the widget hit field you want to access (you can search for any standard field with the search button)

Global > Request or Resopnse

Select Request if you want to display a parameter of your request (e.g.: the search made by the user)

Select Response if you want to display a global variable of the response (e.g.: the corrected search by the system)

For both cases, there is an index which is 0 by default. Select another index if you have several responses grouped together and want to access a specific one.

Global > Variable

Select Request or a Response variable in the list:

  • searchQuery: the query the user has typed without any modification

  • correctedSearchQuery: the query of the user after an automatic spelling correction

Mapping Variables on Campaigns

Banners are typically defined in Campaigns in the Boxalino Admin.

All the parameters of the Layout Block used to defined the campaign banner are automatically available with the same name as of the parameter but with the prefix

Typically the Layout Block used to defined the campaign is the same as the Layout Block used in the Narrative. This makes the mapping quite simple as in the example here:

In the narrative we can see that each Layout Block parameter of the banner is mapped with the current hit properties of the matching name.