You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/javascript/api.md
+42-30Lines changed: 42 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,9 @@ Where `callback` is a function that will receive a set of `parameters` and retur
33
33
|`constants`| A group of variables that hold the different [constants](#constants) that can be used for creating components on your site. |
34
34
|`render`| Function that allows rendering a component in a specific placement and target. See more details for this function [here](#render). |
35
35
|`session`| Object that contains several values from the current session that can be useful when creating customizations. See more details for this function [here](#session). |
36
-
|`on`| Function that will be executed upon user actions or component rendrering. See more details for this function [here](#on)|
37
-
|`onNavigation` (deprecated) | Function that will be executed once any widget in a content is rendered. See more details for this function [here](#on-widget-rendered)|
38
-
|`onWidgetRendered` (deprecated) | Function that will be executed once the application has performed a navigation. See more details for this function [here](#on-navigation)|
36
+
|`on`| Function that will be executed upon user actions or component rendering. See more details for this function [here](#on)|
37
+
|`onNavigation` (**deprecated**) | Function that will be executed once any widget in a content is rendered. See more details for this function [here](#on-widget-rendered)|
38
+
|`onWidgetRendered` (**deprecated**) | Function that will be executed once the application has performed a navigation. See more details for this function [here](#on-navigation)|
39
39
|`api`|[Axios](https://github.com/axios/axios) instance that allows the developer to execute AJAX requests. See more details for this function [here](#axios-api)|
40
40
41
41
And `configuration` is an object that allows these properties:
@@ -52,10 +52,7 @@ And `configuration` is an object that allows these properties:
|`events.NAVIGATION`| Event id for user navigation events. |[Documentation](./capabilities#event-navigation)|
55
-
|`events.SEARCH_BOX`| Event id for the user searchbox interaction events. |[Documentation](./capabilities#event-searchbox)|
56
-
|`events.SEARCH_FILTER`| Event id for the user filter interaction events on the search page. |[Documentation](./capabilities#event-search-filter)|
57
-
|`events.SEARCH_RESULT`| Event id for the search result events triggered when user makes a search query. |[Documentation](./capabilities#event-search-result)|
58
-
|`events.SEARCH_SORT`| Event id for the user sort interaction events on the search page. |[Documentation](./capabilities#event-search-sort)|
55
+
|`events.SEARCH`| Event id for the user search page interaction events. |[Documentation](./capabilities#event-search)|
59
56
|`events.WIDGET_RENDERED`| Event id for the event triggered after rendering a widget. |[Documentation](./capabilities#event-widget-rendered)|
60
57
61
58
### targets
@@ -1202,60 +1199,61 @@ across the entire platform, or if you need to communicate information between cu
1202
1199
1203
1200
The `props` parameter will have information depending on the event type. For a full list of all events, please refer to the [documentation](./api#events).
1204
1201
1205
-
### on navigation
1206
-
```js
1207
-
window.lumapps.customize(({ onNavigation }) => {
1208
-
onNavigation(({ currentPage }) => {
1209
-
sendTrack({
1210
-
page: currentPage,
1211
-
})
1212
-
})
1213
-
});
1214
-
```
1202
+
#### events.SEARCH
1203
+
1204
+
There are four main types of search events, all of them can ben easily identified using the `cause` props which can be found in all those events:
1205
+
-`searchbox-interaction`
1206
+
-`filter-interaction`
1207
+
-`sort-interaction`
1208
+
-`fetch-results`
1215
1209
1216
-
`onNavigation` is a function that will be called on each navigation. **This function is now deprecated**. Please `on` function with the [Navigation event](./api#eventsnavigation) instead.
1210
+
**Limitation**: The search events are 100% compatible with our native search. For other search engine (Coveo, Google Cloud Search...), please note that they could be unstable or return incorrect values. Please keep this in mind if you are in this situation.
1217
1211
1218
-
####events.SEARCH_BOX
1212
+
##### searchbox-interaction
1219
1213
1220
1214
Event triggered each time the user interacts with the search box and displays suggestions. Please find below the props available for this event.
|`props.filteredResultCount`| Number of results available with the current filters applied (if any). |`number`|
1228
+
|`props.filteredResultCount`| Number of results available with the current filters applied (if any). If result count is not available -1 is returned. |`number`|
1234
1229
|`props.query`| Current query used to display search results |`string`|
1235
1230
|`props.filters`| List of filters available. Contains id, label, value (all selected values) and choices (all available choices for a given filter) |`object[]`|
1231
+
|`props.cause`| Cause of the search event. Always set to `filter-interaction`|`string`|
1236
1232
1237
-
####events.SEARCH_RESULT
1233
+
##### fetch-results
1238
1234
1239
-
Event triggered each time the user makes a search query. Please find below the props available for this event.
1235
+
Event triggered each time the user makes a search query or change tabs. Please find below the props available for this event.
|`props.filteredResultCount`| Number of results available with the current filters applied (if any). |`number`|
1239
+
|`props.filteredResultCount`| Number of results available with the current filters applied (if any). If result count is not available -1 is returned.|`number`|
1244
1240
|`props.query`| Current query used to display search results |`string`|
1245
-
|`props.selectedFilters`| List of filters currently applied. Contains id, label, value (all selected values) and choices (all available choice for a given filter) |`object[]`|
1241
+
|`props.filters`| List of filters. Contains id, label, value (all selected values) and choices (all available choice for a given filter) |`object[]`|
1246
1242
|`props.selectedTabInfo`| Information for the current search tab. Contains label and totalResultCount |`object[]`|
1247
1243
|`props.results`| Information for the current search tab. Contains label and totalResultCount |`object[]`|
1244
+
|`props.cause`| Cause of the search event. Always set to `fetch-results`|`string`|
1248
1245
1249
-
####events.SEARCH_SORT
1246
+
##### sort-interaction
1250
1247
1251
1248
Event triggered each time the user makes apply a new sort order. Please find below the props available for this event.
|`props.filteredResultCount`| Number of results available with the current filters applied (if any). |`number`|
1252
+
|`props.filteredResultCount`| Number of results available with the current filters applied (if any). If result count is not available -1 is returned.|`number`|
1256
1253
|`props.query`| Current query used to display search results |`string`|
|`props.sortOrders`| List of all sort values available. Contains a value and a label |`object[]`|
1256
+
|`props.cause`| Cause of the search event. Always set to `sort-interaction`|`string`|
1259
1257
1260
1258
#### events.WIDGET_RENDERED
1261
1259
@@ -1289,9 +1287,23 @@ It is an event that will be called on each navigation. It receives the following
1289
1287
**Limitations and best practices**
1290
1288
- This specific event should be used for tracking purposes as well as triggering other external services. It should not be used in combination with the `render` function, since this is not intended to work by design. Targets and placement should already help in rendering customizations on specific pages.
1291
1289
1290
+
### on navigation
1291
+
**IMPORTANT**
1292
+
`onNavigation` is a function that will be called on each navigation. **This function is now deprecated**. Please use `on` function with the [Navigation event](./api#eventsnavigation) instead.
1293
+
1294
+
```js
1295
+
window.lumapps.customize(({ onNavigation }) => {
1296
+
onNavigation(({ currentPage }) => {
1297
+
sendTrack({
1298
+
page: currentPage,
1299
+
})
1300
+
})
1301
+
});
1302
+
```
1303
+
1292
1304
### on widget rendered
1293
1305
1294
-
`onWidgetRendered` is a function that will be called each time a widget is rendered on the page. **This function is now deprecated**. Please `on` function with the [Widget rendered event](./api#eventswidget_rendered) instead.
1306
+
**IMPORTANT**`onWidgetRendered` is a function that will be called each time a widget is rendered on the page. **This function is now deprecated**. Please use`on` function with the [Widget rendered event](./api#eventswidget_rendered) instead.
Copy file name to clipboardExpand all lines: docs/javascript/capabilities.md
+23-22Lines changed: 23 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -730,28 +730,29 @@ In order to understand the possibilities that we have with this API, we need to
730
730
As an example, inserting the following code in your LumApps site will display an icon in the search tab based on the number of result type filters selected:
731
731
732
732
```js
733
-
window.lumapps.customize(({ on, events, render, placement, targets, components }) => {
0 commit comments