@@ -112,39 +112,6 @@ client.nextPage();
112112client .previousPage ();
113113```
114114
115- ### Search analytics
116- #### Send search event to analytics
117- When search is executed, send the event to your AddSearch Analytics Dashboard.
118- ``` js
119- // If the numberOfResults is 0, the search is shown in the list of "queries with no hits"
120- client .sendStatsEvent (' search' , keyword, {numberOfResults: n});
121- ```
122-
123- #### Send click event to analytics
124- When a search results is clicked, send the event to your AddSearch Analytics Dashboard. Click information is shown
125- in your statistics and used by the self-learning search algorithm.
126- ``` js
127- // documentId is the 32-character long id that is part of each hit in search results.
128- // position is the position of the document that was clicked, the first result being 1
129- client .sendStatsEvent (' click' , keyword, {documentId: id, position: n});
130- ```
131-
132- #### Set or get stats session ID
133- Control the search session ID manually. Search queries with the same ID are grouped on the Analytics Dashboard.
134- For example, in a search-as-you-type implementation the final keyword of a given session is shown.
135- ``` js
136- client .getStatsSessionId ();
137- client .setStatsSessionId (id);
138- ```
139-
140- #### Collect search events automatically
141- Send search events automatically. Not recommended in search-as-you-type implementations, as every keystroke
142- would fire a statistics event
143- ``` js
144- // Control whether search queries are sent to your AddSearch Analytics Dashboard automatically or not (default: false)
145- client .setCollectAnalytics (true );
146- ```
147-
148115### Filters
149116
150117#### Define language filter
@@ -227,6 +194,39 @@ Use the following function to get more or less facets.
227194client .setNumberOfFacets (20 );
228195```
229196
197+ ### Search analytics
198+ #### Send search event to analytics
199+ When search is executed, send the event to your AddSearch Analytics Dashboard.
200+ ``` js
201+ // If the numberOfResults is 0, the search is shown in the list of "queries with no hits"
202+ client .sendStatsEvent (' search' , keyword, {numberOfResults: n});
203+ ```
204+
205+ #### Send click event to analytics
206+ When a search results is clicked, send the event to your AddSearch Analytics Dashboard. Click information is shown
207+ in your statistics and used by the self-learning search algorithm.
208+ ``` js
209+ // documentId is the 32-character long id that is part of each hit in search results.
210+ // position is the position of the document that was clicked, the first result being 1
211+ client .sendStatsEvent (' click' , keyword, {documentId: id, position: n});
212+ ```
213+
214+ #### Set or get stats session ID
215+ Control the search session ID manually. Search queries with the same ID are grouped on the Analytics Dashboard.
216+ For example, in a search-as-you-type implementation the final keyword of a given session is shown.
217+ ``` js
218+ client .getStatsSessionId ();
219+ client .setStatsSessionId (id);
220+ ```
221+
222+ #### Collect search events automatically
223+ Send search events automatically. Not recommended in search-as-you-type implementations, as every keystroke
224+ would fire a statistics event
225+ ``` js
226+ // Control whether search queries are sent to your AddSearch Analytics Dashboard automatically or not (default: false)
227+ client .setCollectAnalytics (true );
228+ ```
229+
230230### Personalization
231231
232232#### Set user token (for personalized search results)
0 commit comments