coveo.analytics 2.23.6 → 2.23.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +869 -209
- package/dist/coveoua.debug.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/client/analytics.d.ts +18 -5
- package/dist/definitions/client/noopAnalytics.d.ts +7 -2
- package/dist/definitions/events.d.ts +8 -0
- package/dist/definitions/insight/insightClient.d.ts +2 -0
- package/dist/definitions/searchPage/searchPageClient.d.ts +75 -77
- package/dist/definitions/searchPage/searchPageEvents.d.ts +3 -1
- package/dist/library.es.js +374 -142
- package/dist/library.js +869 -209
- package/dist/react-native.es.js +374 -142
- package/package.json +1 -1
- package/src/client/analytics.ts +75 -16
- package/src/client/noopAnalytics.ts +27 -1
- package/src/events.ts +8 -0
- package/src/insight/insightClient.spec.ts +44 -0
- package/src/insight/insightClient.ts +26 -0
- package/src/searchPage/searchPageClient.spec.ts +176 -143
- package/src/searchPage/searchPageClient.ts +227 -205
- package/src/searchPage/searchPageEvents.ts +9 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import CoveoAnalyticsClient, {ClientOptions, AnalyticsClient} from '../client/analytics';
|
|
1
|
+
import CoveoAnalyticsClient, {ClientOptions, AnalyticsClient, PreparedEvent} from '../client/analytics';
|
|
2
2
|
import {
|
|
3
3
|
SearchEventRequest,
|
|
4
|
-
ClickEventRequest,
|
|
5
4
|
CustomEventRequest,
|
|
6
5
|
SearchEventResponse,
|
|
7
6
|
AnyEventResponse,
|
|
8
7
|
ClickEventResponse,
|
|
9
8
|
CustomEventResponse,
|
|
9
|
+
PreparedClickEventRequest,
|
|
10
|
+
PreparedSearchEventRequest,
|
|
10
11
|
} from '../events';
|
|
11
12
|
import {
|
|
12
13
|
SearchPageEvents,
|
|
@@ -64,7 +65,7 @@ export type EventDescription = Pick<SearchEventRequest, 'actionCause' | 'customD
|
|
|
64
65
|
|
|
65
66
|
export interface EventBuilder<T extends AnyEventResponse = AnyEventResponse> {
|
|
66
67
|
description: EventDescription;
|
|
67
|
-
log:
|
|
68
|
+
log(metadata: {searchUID: string}): Promise<T | void>;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export class CoveoSearchPageClient {
|
|
@@ -91,192 +92,192 @@ export class CoveoSearchPageClient {
|
|
|
91
92
|
return this.makeSearchEvent(SearchPageEvents.interfaceLoad);
|
|
92
93
|
}
|
|
93
94
|
|
|
94
|
-
public logInterfaceLoad() {
|
|
95
|
-
return this.makeInterfaceLoad().log();
|
|
95
|
+
public async logInterfaceLoad() {
|
|
96
|
+
return (await this.makeInterfaceLoad()).log({searchUID: this.provider.getSearchUID()});
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
public makeRecommendationInterfaceLoad() {
|
|
99
100
|
return this.makeSearchEvent(SearchPageEvents.recommendationInterfaceLoad);
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
public logRecommendationInterfaceLoad() {
|
|
103
|
-
return this.makeRecommendationInterfaceLoad().log();
|
|
103
|
+
public async logRecommendationInterfaceLoad() {
|
|
104
|
+
return (await this.makeRecommendationInterfaceLoad()).log({searchUID: this.provider.getSearchUID()});
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
public makeRecommendation() {
|
|
107
108
|
return this.makeCustomEvent(SearchPageEvents.recommendation);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
public logRecommendation() {
|
|
111
|
-
return this.makeRecommendation().log();
|
|
111
|
+
public async logRecommendation() {
|
|
112
|
+
return (await this.makeRecommendation()).log({searchUID: this.provider.getSearchUID()});
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
public makeRecommendationOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
115
116
|
return this.makeClickEvent(SearchPageEvents.recommendationOpen, info, identifier);
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
public logRecommendationOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
119
|
-
return this.makeRecommendationOpen(info, identifier).log();
|
|
119
|
+
public async logRecommendationOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
120
|
+
return (await this.makeRecommendationOpen(info, identifier)).log({searchUID: this.provider.getSearchUID()});
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
public makeStaticFilterClearAll(meta: StaticFilterMetadata) {
|
|
123
124
|
return this.makeSearchEvent(SearchPageEvents.staticFilterClearAll, meta);
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
public logStaticFilterClearAll(meta: StaticFilterMetadata) {
|
|
127
|
-
return this.makeStaticFilterClearAll(meta).log();
|
|
127
|
+
public async logStaticFilterClearAll(meta: StaticFilterMetadata) {
|
|
128
|
+
return (await this.makeStaticFilterClearAll(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
public makeStaticFilterSelect(meta: StaticFilterToggleValueMetadata) {
|
|
131
132
|
return this.makeSearchEvent(SearchPageEvents.staticFilterSelect, meta);
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
public logStaticFilterSelect(meta: StaticFilterToggleValueMetadata) {
|
|
135
|
-
return this.makeStaticFilterSelect(meta).log();
|
|
135
|
+
public async logStaticFilterSelect(meta: StaticFilterToggleValueMetadata) {
|
|
136
|
+
return (await this.makeStaticFilterSelect(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
public makeStaticFilterDeselect(meta: StaticFilterToggleValueMetadata) {
|
|
139
140
|
return this.makeSearchEvent(SearchPageEvents.staticFilterDeselect, meta);
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
public logStaticFilterDeselect(meta: StaticFilterToggleValueMetadata) {
|
|
143
|
-
return this.makeStaticFilterDeselect(meta).log();
|
|
143
|
+
public async logStaticFilterDeselect(meta: StaticFilterToggleValueMetadata) {
|
|
144
|
+
return (await this.makeStaticFilterDeselect(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
public makeFetchMoreResults() {
|
|
147
148
|
return this.makeCustomEvent(SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
public logFetchMoreResults() {
|
|
151
|
-
return this.makeFetchMoreResults().log();
|
|
151
|
+
public async logFetchMoreResults() {
|
|
152
|
+
return (await this.makeFetchMoreResults()).log({searchUID: this.provider.getSearchUID()});
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
public makeInterfaceChange(metadata: InterfaceChangeMetadata) {
|
|
155
156
|
return this.makeSearchEvent(SearchPageEvents.interfaceChange, metadata);
|
|
156
157
|
}
|
|
157
158
|
|
|
158
|
-
public logInterfaceChange(metadata: InterfaceChangeMetadata) {
|
|
159
|
-
return this.makeInterfaceChange(metadata).log();
|
|
159
|
+
public async logInterfaceChange(metadata: InterfaceChangeMetadata) {
|
|
160
|
+
return (await this.makeInterfaceChange(metadata)).log({searchUID: this.provider.getSearchUID()});
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
public makeDidYouMeanAutomatic() {
|
|
163
164
|
return this.makeSearchEvent(SearchPageEvents.didyoumeanAutomatic);
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
public logDidYouMeanAutomatic() {
|
|
167
|
-
return this.makeDidYouMeanAutomatic().log();
|
|
167
|
+
public async logDidYouMeanAutomatic() {
|
|
168
|
+
return (await this.makeDidYouMeanAutomatic()).log({searchUID: this.provider.getSearchUID()});
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
public makeDidYouMeanClick() {
|
|
171
172
|
return this.makeSearchEvent(SearchPageEvents.didyoumeanClick);
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
public logDidYouMeanClick() {
|
|
175
|
-
return this.makeDidYouMeanClick().log();
|
|
175
|
+
public async logDidYouMeanClick() {
|
|
176
|
+
return (await this.makeDidYouMeanClick()).log({searchUID: this.provider.getSearchUID()});
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
public makeResultsSort(metadata: ResultsSortMetadata) {
|
|
179
180
|
return this.makeSearchEvent(SearchPageEvents.resultsSort, metadata);
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
public logResultsSort(metadata: ResultsSortMetadata) {
|
|
183
|
-
return this.makeResultsSort(metadata).log();
|
|
183
|
+
public async logResultsSort(metadata: ResultsSortMetadata) {
|
|
184
|
+
return (await this.makeResultsSort(metadata)).log({searchUID: this.provider.getSearchUID()});
|
|
184
185
|
}
|
|
185
186
|
|
|
186
187
|
public makeSearchboxSubmit() {
|
|
187
188
|
return this.makeSearchEvent(SearchPageEvents.searchboxSubmit);
|
|
188
189
|
}
|
|
189
190
|
|
|
190
|
-
public logSearchboxSubmit() {
|
|
191
|
-
return this.makeSearchboxSubmit().log();
|
|
191
|
+
public async logSearchboxSubmit() {
|
|
192
|
+
return (await this.makeSearchboxSubmit()).log({searchUID: this.provider.getSearchUID()});
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
public makeSearchboxClear() {
|
|
195
196
|
return this.makeSearchEvent(SearchPageEvents.searchboxClear);
|
|
196
197
|
}
|
|
197
198
|
|
|
198
|
-
public logSearchboxClear() {
|
|
199
|
-
return this.makeSearchboxClear().log();
|
|
199
|
+
public async logSearchboxClear() {
|
|
200
|
+
return (await this.makeSearchboxClear()).log({searchUID: this.provider.getSearchUID()});
|
|
200
201
|
}
|
|
201
202
|
|
|
202
203
|
public makeSearchboxAsYouType() {
|
|
203
204
|
return this.makeSearchEvent(SearchPageEvents.searchboxAsYouType);
|
|
204
205
|
}
|
|
205
206
|
|
|
206
|
-
public logSearchboxAsYouType() {
|
|
207
|
-
return this.makeSearchboxAsYouType().log();
|
|
207
|
+
public async logSearchboxAsYouType() {
|
|
208
|
+
return (await this.makeSearchboxAsYouType()).log({searchUID: this.provider.getSearchUID()});
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
public makeBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata) {
|
|
211
212
|
return this.makeSearchEvent(SearchPageEvents.breadcrumbFacet, metadata);
|
|
212
213
|
}
|
|
213
214
|
|
|
214
|
-
public logBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata) {
|
|
215
|
-
return this.makeBreadcrumbFacet(metadata).log();
|
|
215
|
+
public async logBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata) {
|
|
216
|
+
return (await this.makeBreadcrumbFacet(metadata)).log({searchUID: this.provider.getSearchUID()});
|
|
216
217
|
}
|
|
217
218
|
|
|
218
219
|
public makeBreadcrumbResetAll() {
|
|
219
220
|
return this.makeSearchEvent(SearchPageEvents.breadcrumbResetAll);
|
|
220
221
|
}
|
|
221
222
|
|
|
222
|
-
public logBreadcrumbResetAll() {
|
|
223
|
-
return this.makeBreadcrumbResetAll().log();
|
|
223
|
+
public async logBreadcrumbResetAll() {
|
|
224
|
+
return (await this.makeBreadcrumbResetAll()).log({searchUID: this.provider.getSearchUID()});
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
public makeDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
227
228
|
return this.makeClickEvent(SearchPageEvents.documentQuickview, info, identifier);
|
|
228
229
|
}
|
|
229
230
|
|
|
230
|
-
public logDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
231
|
-
return this.makeDocumentQuickview(info, identifier).log();
|
|
231
|
+
public async logDocumentQuickview(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
232
|
+
return (await this.makeDocumentQuickview(info, identifier)).log({searchUID: this.provider.getSearchUID()});
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
public makeDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
235
236
|
return this.makeClickEvent(SearchPageEvents.documentOpen, info, identifier);
|
|
236
237
|
}
|
|
237
238
|
|
|
238
|
-
public logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
239
|
-
return this.makeDocumentOpen(info, identifier).log();
|
|
239
|
+
public async logDocumentOpen(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
240
|
+
return (await this.makeDocumentOpen(info, identifier)).log({searchUID: this.provider.getSearchUID()});
|
|
240
241
|
}
|
|
241
242
|
|
|
242
243
|
public makeOmniboxAnalytics(meta: OmniboxSuggestionsMetadata) {
|
|
243
244
|
return this.makeSearchEvent(SearchPageEvents.omniboxAnalytics, formatOmniboxMetadata(meta));
|
|
244
245
|
}
|
|
245
246
|
|
|
246
|
-
public logOmniboxAnalytics(meta: OmniboxSuggestionsMetadata) {
|
|
247
|
-
return this.makeOmniboxAnalytics(meta).log();
|
|
247
|
+
public async logOmniboxAnalytics(meta: OmniboxSuggestionsMetadata) {
|
|
248
|
+
return (await this.makeOmniboxAnalytics(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
248
249
|
}
|
|
249
250
|
|
|
250
251
|
public makeOmniboxFromLink(meta: OmniboxSuggestionsMetadata) {
|
|
251
252
|
return this.makeSearchEvent(SearchPageEvents.omniboxFromLink, formatOmniboxMetadata(meta));
|
|
252
253
|
}
|
|
253
254
|
|
|
254
|
-
public logOmniboxFromLink(meta: OmniboxSuggestionsMetadata) {
|
|
255
|
-
return this.makeOmniboxFromLink(meta).log();
|
|
255
|
+
public async logOmniboxFromLink(meta: OmniboxSuggestionsMetadata) {
|
|
256
|
+
return (await this.makeOmniboxFromLink(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
256
257
|
}
|
|
257
258
|
|
|
258
259
|
public makeSearchFromLink() {
|
|
259
260
|
return this.makeSearchEvent(SearchPageEvents.searchFromLink);
|
|
260
261
|
}
|
|
261
262
|
|
|
262
|
-
public logSearchFromLink() {
|
|
263
|
-
return this.makeSearchFromLink().log();
|
|
263
|
+
public async logSearchFromLink() {
|
|
264
|
+
return (await this.makeSearchFromLink()).log({searchUID: this.provider.getSearchUID()});
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
public makeTriggerNotify(meta: TriggerNotifyMetadata) {
|
|
267
268
|
return this.makeCustomEvent(SearchPageEvents.triggerNotify, meta);
|
|
268
269
|
}
|
|
269
270
|
|
|
270
|
-
public logTriggerNotify(meta: TriggerNotifyMetadata) {
|
|
271
|
-
return this.makeTriggerNotify(meta).log();
|
|
271
|
+
public async logTriggerNotify(meta: TriggerNotifyMetadata) {
|
|
272
|
+
return (await this.makeTriggerNotify(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
272
273
|
}
|
|
273
274
|
|
|
274
275
|
public makeTriggerExecute(meta: TriggerExecuteMetadata) {
|
|
275
276
|
return this.makeCustomEvent(SearchPageEvents.triggerExecute, meta);
|
|
276
277
|
}
|
|
277
278
|
|
|
278
|
-
public logTriggerExecute(meta: TriggerExecuteMetadata) {
|
|
279
|
-
return this.makeTriggerExecute(meta).log();
|
|
279
|
+
public async logTriggerExecute(meta: TriggerExecuteMetadata) {
|
|
280
|
+
return (await this.makeTriggerExecute(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
280
281
|
}
|
|
281
282
|
|
|
282
283
|
public makeTriggerQuery() {
|
|
@@ -287,16 +288,16 @@ export class CoveoSearchPageClient {
|
|
|
287
288
|
);
|
|
288
289
|
}
|
|
289
290
|
|
|
290
|
-
public logTriggerQuery() {
|
|
291
|
-
return this.makeTriggerQuery().log();
|
|
291
|
+
public async logTriggerQuery() {
|
|
292
|
+
return (await this.makeTriggerQuery()).log({searchUID: this.provider.getSearchUID()});
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
public makeUndoTriggerQuery(meta: UndoTriggerRedirectMetadata) {
|
|
295
296
|
return this.makeSearchEvent(SearchPageEvents.undoTriggerQuery, meta);
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
public logUndoTriggerQuery(meta: UndoTriggerRedirectMetadata) {
|
|
299
|
-
return this.makeUndoTriggerQuery(meta).log();
|
|
299
|
+
public async logUndoTriggerQuery(meta: UndoTriggerRedirectMetadata) {
|
|
300
|
+
return (await this.makeUndoTriggerQuery(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
300
301
|
}
|
|
301
302
|
|
|
302
303
|
public makeTriggerRedirect(meta: TriggerRedirectMetadata) {
|
|
@@ -306,234 +307,239 @@ export class CoveoSearchPageClient {
|
|
|
306
307
|
});
|
|
307
308
|
}
|
|
308
309
|
|
|
309
|
-
public logTriggerRedirect(meta: TriggerRedirectMetadata) {
|
|
310
|
-
return this.makeTriggerRedirect(meta).log();
|
|
310
|
+
public async logTriggerRedirect(meta: TriggerRedirectMetadata) {
|
|
311
|
+
return (await this.makeTriggerRedirect(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
311
312
|
}
|
|
312
313
|
|
|
313
314
|
public makePagerResize(meta: PagerResizeMetadata) {
|
|
314
315
|
return this.makeCustomEvent(SearchPageEvents.pagerResize, meta);
|
|
315
316
|
}
|
|
316
317
|
|
|
317
|
-
public logPagerResize(meta: PagerResizeMetadata) {
|
|
318
|
-
return this.makePagerResize(meta).log();
|
|
318
|
+
public async logPagerResize(meta: PagerResizeMetadata) {
|
|
319
|
+
return (await this.makePagerResize(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
319
320
|
}
|
|
320
321
|
|
|
321
322
|
public makePagerNumber(meta: PagerMetadata) {
|
|
322
323
|
return this.makeCustomEvent(SearchPageEvents.pagerNumber, meta);
|
|
323
324
|
}
|
|
324
325
|
|
|
325
|
-
public logPagerNumber(meta: PagerMetadata) {
|
|
326
|
-
return this.makePagerNumber(meta).log();
|
|
326
|
+
public async logPagerNumber(meta: PagerMetadata) {
|
|
327
|
+
return (await this.makePagerNumber(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
327
328
|
}
|
|
328
329
|
|
|
329
330
|
public makePagerNext(meta: PagerMetadata) {
|
|
330
331
|
return this.makeCustomEvent(SearchPageEvents.pagerNext, meta);
|
|
331
332
|
}
|
|
332
333
|
|
|
333
|
-
public logPagerNext(meta: PagerMetadata) {
|
|
334
|
-
return this.makePagerNext(meta).log();
|
|
334
|
+
public async logPagerNext(meta: PagerMetadata) {
|
|
335
|
+
return (await this.makePagerNext(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
335
336
|
}
|
|
336
337
|
|
|
337
338
|
public makePagerPrevious(meta: PagerMetadata) {
|
|
338
339
|
return this.makeCustomEvent(SearchPageEvents.pagerPrevious, meta);
|
|
339
340
|
}
|
|
340
341
|
|
|
341
|
-
public logPagerPrevious(meta: PagerMetadata) {
|
|
342
|
-
return this.makePagerPrevious(meta).log();
|
|
342
|
+
public async logPagerPrevious(meta: PagerMetadata) {
|
|
343
|
+
return (await this.makePagerPrevious(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
343
344
|
}
|
|
344
345
|
|
|
345
346
|
public makePagerScrolling() {
|
|
346
347
|
return this.makeCustomEvent(SearchPageEvents.pagerScrolling);
|
|
347
348
|
}
|
|
348
349
|
|
|
349
|
-
public logPagerScrolling() {
|
|
350
|
-
return this.makePagerScrolling().log();
|
|
350
|
+
public async logPagerScrolling() {
|
|
351
|
+
return (await this.makePagerScrolling()).log({searchUID: this.provider.getSearchUID()});
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
public makeFacetClearAll(meta: FacetBaseMeta) {
|
|
354
355
|
return this.makeSearchEvent(SearchPageEvents.facetClearAll, meta);
|
|
355
356
|
}
|
|
356
357
|
|
|
357
|
-
public logFacetClearAll(meta: FacetBaseMeta) {
|
|
358
|
-
return this.makeFacetClearAll(meta).log();
|
|
358
|
+
public async logFacetClearAll(meta: FacetBaseMeta) {
|
|
359
|
+
return (await this.makeFacetClearAll(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
359
360
|
}
|
|
360
361
|
|
|
361
362
|
public makeFacetSearch(meta: FacetBaseMeta) {
|
|
362
363
|
return this.makeSearchEvent(SearchPageEvents.facetSearch, meta);
|
|
363
364
|
}
|
|
364
365
|
|
|
365
|
-
public logFacetSearch(meta: FacetBaseMeta) {
|
|
366
|
-
return this.makeFacetSearch(meta).log();
|
|
366
|
+
public async logFacetSearch(meta: FacetBaseMeta) {
|
|
367
|
+
return (await this.makeFacetSearch(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
367
368
|
}
|
|
368
369
|
|
|
369
370
|
public makeFacetSelect(meta: FacetMetadata) {
|
|
370
371
|
return this.makeSearchEvent(SearchPageEvents.facetSelect, meta);
|
|
371
372
|
}
|
|
372
373
|
|
|
373
|
-
public logFacetSelect(meta: FacetMetadata) {
|
|
374
|
-
return this.makeFacetSelect(meta).log();
|
|
374
|
+
public async logFacetSelect(meta: FacetMetadata) {
|
|
375
|
+
return (await this.makeFacetSelect(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
375
376
|
}
|
|
376
377
|
|
|
377
378
|
public makeFacetDeselect(meta: FacetMetadata) {
|
|
378
379
|
return this.makeSearchEvent(SearchPageEvents.facetDeselect, meta);
|
|
379
380
|
}
|
|
380
381
|
|
|
381
|
-
public logFacetDeselect(meta: FacetMetadata) {
|
|
382
|
-
return this.makeFacetDeselect(meta).log();
|
|
382
|
+
public async logFacetDeselect(meta: FacetMetadata) {
|
|
383
|
+
return (await this.makeFacetDeselect(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
383
384
|
}
|
|
384
385
|
|
|
385
386
|
public makeFacetExclude(meta: FacetMetadata) {
|
|
386
387
|
return this.makeSearchEvent(SearchPageEvents.facetExclude, meta);
|
|
387
388
|
}
|
|
388
389
|
|
|
389
|
-
public logFacetExclude(meta: FacetMetadata) {
|
|
390
|
-
return this.makeFacetExclude(meta).log();
|
|
390
|
+
public async logFacetExclude(meta: FacetMetadata) {
|
|
391
|
+
return (await this.makeFacetExclude(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
391
392
|
}
|
|
392
393
|
|
|
393
394
|
public makeFacetUnexclude(meta: FacetMetadata) {
|
|
394
395
|
return this.makeSearchEvent(SearchPageEvents.facetUnexclude, meta);
|
|
395
396
|
}
|
|
396
397
|
|
|
397
|
-
public logFacetUnexclude(meta: FacetMetadata) {
|
|
398
|
-
return this.makeFacetUnexclude(meta).log();
|
|
398
|
+
public async logFacetUnexclude(meta: FacetMetadata) {
|
|
399
|
+
return (await this.makeFacetUnexclude(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
399
400
|
}
|
|
400
401
|
|
|
401
402
|
public makeFacetSelectAll(meta: FacetBaseMeta) {
|
|
402
403
|
return this.makeSearchEvent(SearchPageEvents.facetSelectAll, meta);
|
|
403
404
|
}
|
|
404
405
|
|
|
405
|
-
public logFacetSelectAll(meta: FacetBaseMeta) {
|
|
406
|
-
return this.makeFacetSelectAll(meta).log();
|
|
406
|
+
public async logFacetSelectAll(meta: FacetBaseMeta) {
|
|
407
|
+
return (await this.makeFacetSelectAll(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
407
408
|
}
|
|
408
409
|
|
|
409
410
|
public makeFacetUpdateSort(meta: FacetSortMeta) {
|
|
410
411
|
return this.makeSearchEvent(SearchPageEvents.facetUpdateSort, meta);
|
|
411
412
|
}
|
|
412
413
|
|
|
413
|
-
public logFacetUpdateSort(meta: FacetSortMeta) {
|
|
414
|
-
return this.makeFacetUpdateSort(meta).log();
|
|
414
|
+
public async logFacetUpdateSort(meta: FacetSortMeta) {
|
|
415
|
+
return (await this.makeFacetUpdateSort(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
415
416
|
}
|
|
416
417
|
|
|
417
418
|
public makeFacetShowMore(meta: FacetBaseMeta) {
|
|
418
419
|
return this.makeCustomEvent(SearchPageEvents.facetShowMore, meta);
|
|
419
420
|
}
|
|
420
421
|
|
|
421
|
-
public logFacetShowMore(meta: FacetBaseMeta) {
|
|
422
|
-
return this.makeFacetShowMore(meta).log();
|
|
422
|
+
public async logFacetShowMore(meta: FacetBaseMeta) {
|
|
423
|
+
return (await this.makeFacetShowMore(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
423
424
|
}
|
|
424
425
|
|
|
425
426
|
public makeFacetShowLess(meta: FacetBaseMeta) {
|
|
426
427
|
return this.makeCustomEvent(SearchPageEvents.facetShowLess, meta);
|
|
427
428
|
}
|
|
428
429
|
|
|
429
|
-
public logFacetShowLess(meta: FacetBaseMeta) {
|
|
430
|
-
return this.makeFacetShowLess(meta).log();
|
|
430
|
+
public async logFacetShowLess(meta: FacetBaseMeta) {
|
|
431
|
+
return (await this.makeFacetShowLess(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
431
432
|
}
|
|
432
433
|
|
|
433
434
|
public makeQueryError(meta: QueryErrorMeta) {
|
|
434
435
|
return this.makeCustomEvent(SearchPageEvents.queryError, meta);
|
|
435
436
|
}
|
|
436
437
|
|
|
437
|
-
public logQueryError(meta: QueryErrorMeta) {
|
|
438
|
-
return this.makeQueryError(meta).log();
|
|
438
|
+
public async logQueryError(meta: QueryErrorMeta) {
|
|
439
|
+
return (await this.makeQueryError(meta)).log({searchUID: this.provider.getSearchUID()});
|
|
439
440
|
}
|
|
440
441
|
|
|
441
|
-
public makeQueryErrorBack(): EventBuilder<SearchEventResponse
|
|
442
|
+
public async makeQueryErrorBack(): Promise<EventBuilder<SearchEventResponse>> {
|
|
443
|
+
const customEventBuilder = await this.makeCustomEvent(SearchPageEvents.queryErrorBack);
|
|
442
444
|
return {
|
|
443
|
-
description:
|
|
445
|
+
description: customEventBuilder.description,
|
|
444
446
|
log: async () => {
|
|
445
|
-
await this.
|
|
447
|
+
await customEventBuilder.log({searchUID: this.provider.getSearchUID()});
|
|
446
448
|
return this.logSearchEvent(SearchPageEvents.queryErrorBack);
|
|
447
449
|
},
|
|
448
450
|
};
|
|
449
451
|
}
|
|
450
452
|
|
|
451
|
-
public logQueryErrorBack() {
|
|
452
|
-
return this.makeQueryErrorBack().log();
|
|
453
|
+
public async logQueryErrorBack() {
|
|
454
|
+
return (await this.makeQueryErrorBack()).log({searchUID: this.provider.getSearchUID()});
|
|
453
455
|
}
|
|
454
456
|
|
|
455
|
-
public makeQueryErrorRetry(): EventBuilder<SearchEventResponse
|
|
457
|
+
public async makeQueryErrorRetry(): Promise<EventBuilder<SearchEventResponse>> {
|
|
458
|
+
const customEventBuilder = await this.makeCustomEvent(SearchPageEvents.queryErrorRetry);
|
|
456
459
|
return {
|
|
457
|
-
description:
|
|
460
|
+
description: customEventBuilder.description,
|
|
458
461
|
log: async () => {
|
|
459
|
-
await this.
|
|
462
|
+
await customEventBuilder.log({searchUID: this.provider.getSearchUID()});
|
|
460
463
|
return this.logSearchEvent(SearchPageEvents.queryErrorRetry);
|
|
461
464
|
},
|
|
462
465
|
};
|
|
463
466
|
}
|
|
464
467
|
|
|
465
|
-
public logQueryErrorRetry() {
|
|
466
|
-
return this.makeQueryErrorRetry().log();
|
|
468
|
+
public async logQueryErrorRetry() {
|
|
469
|
+
return (await this.makeQueryErrorRetry()).log({searchUID: this.provider.getSearchUID()});
|
|
467
470
|
}
|
|
468
471
|
|
|
469
|
-
public makeQueryErrorClear(): EventBuilder<SearchEventResponse
|
|
472
|
+
public async makeQueryErrorClear(): Promise<EventBuilder<SearchEventResponse>> {
|
|
473
|
+
const customEventBuilder = await this.makeCustomEvent(SearchPageEvents.queryErrorClear);
|
|
470
474
|
return {
|
|
471
|
-
description:
|
|
475
|
+
description: customEventBuilder.description,
|
|
472
476
|
log: async () => {
|
|
473
|
-
await this.
|
|
477
|
+
await customEventBuilder.log({searchUID: this.provider.getSearchUID()});
|
|
474
478
|
return this.logSearchEvent(SearchPageEvents.queryErrorClear);
|
|
475
479
|
},
|
|
476
480
|
};
|
|
477
481
|
}
|
|
478
482
|
|
|
479
|
-
public logQueryErrorClear() {
|
|
480
|
-
return this.makeQueryErrorClear().log();
|
|
483
|
+
public async logQueryErrorClear() {
|
|
484
|
+
return (await this.makeQueryErrorClear()).log({searchUID: this.provider.getSearchUID()});
|
|
481
485
|
}
|
|
482
486
|
|
|
483
487
|
public makeLikeSmartSnippet() {
|
|
484
488
|
return this.makeCustomEvent(SearchPageEvents.likeSmartSnippet);
|
|
485
489
|
}
|
|
486
490
|
|
|
487
|
-
public logLikeSmartSnippet() {
|
|
488
|
-
return this.makeLikeSmartSnippet().log();
|
|
491
|
+
public async logLikeSmartSnippet() {
|
|
492
|
+
return (await this.makeLikeSmartSnippet()).log({searchUID: this.provider.getSearchUID()});
|
|
489
493
|
}
|
|
490
494
|
|
|
491
495
|
public makeDislikeSmartSnippet() {
|
|
492
496
|
return this.makeCustomEvent(SearchPageEvents.dislikeSmartSnippet);
|
|
493
497
|
}
|
|
494
498
|
|
|
495
|
-
public logDislikeSmartSnippet() {
|
|
496
|
-
return this.makeDislikeSmartSnippet().log();
|
|
499
|
+
public async logDislikeSmartSnippet() {
|
|
500
|
+
return (await this.makeDislikeSmartSnippet()).log({searchUID: this.provider.getSearchUID()});
|
|
497
501
|
}
|
|
498
502
|
|
|
499
503
|
public makeExpandSmartSnippet() {
|
|
500
504
|
return this.makeCustomEvent(SearchPageEvents.expandSmartSnippet);
|
|
501
505
|
}
|
|
502
506
|
|
|
503
|
-
public logExpandSmartSnippet() {
|
|
504
|
-
return this.makeExpandSmartSnippet().log();
|
|
507
|
+
public async logExpandSmartSnippet() {
|
|
508
|
+
return (await this.makeExpandSmartSnippet()).log({searchUID: this.provider.getSearchUID()});
|
|
505
509
|
}
|
|
506
510
|
|
|
507
511
|
public makeCollapseSmartSnippet() {
|
|
508
512
|
return this.makeCustomEvent(SearchPageEvents.collapseSmartSnippet);
|
|
509
513
|
}
|
|
510
514
|
|
|
511
|
-
public logCollapseSmartSnippet() {
|
|
512
|
-
return this.makeCollapseSmartSnippet().log();
|
|
515
|
+
public async logCollapseSmartSnippet() {
|
|
516
|
+
return (await this.makeCollapseSmartSnippet()).log({searchUID: this.provider.getSearchUID()});
|
|
513
517
|
}
|
|
514
518
|
|
|
515
519
|
public makeOpenSmartSnippetFeedbackModal() {
|
|
516
520
|
return this.makeCustomEvent(SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
517
521
|
}
|
|
518
522
|
|
|
519
|
-
public logOpenSmartSnippetFeedbackModal() {
|
|
520
|
-
return this.makeOpenSmartSnippetFeedbackModal().log();
|
|
523
|
+
public async logOpenSmartSnippetFeedbackModal() {
|
|
524
|
+
return (await this.makeOpenSmartSnippetFeedbackModal()).log({searchUID: this.provider.getSearchUID()});
|
|
521
525
|
}
|
|
522
526
|
|
|
523
527
|
public makeCloseSmartSnippetFeedbackModal() {
|
|
524
528
|
return this.makeCustomEvent(SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
525
529
|
}
|
|
526
530
|
|
|
527
|
-
public logCloseSmartSnippetFeedbackModal() {
|
|
528
|
-
return this.makeCloseSmartSnippetFeedbackModal().log();
|
|
531
|
+
public async logCloseSmartSnippetFeedbackModal() {
|
|
532
|
+
return (await this.makeCloseSmartSnippetFeedbackModal()).log({searchUID: this.provider.getSearchUID()});
|
|
529
533
|
}
|
|
530
534
|
|
|
531
535
|
public makeSmartSnippetFeedbackReason(reason: SmartSnippetFeedbackReason, details?: string) {
|
|
532
536
|
return this.makeCustomEvent(SearchPageEvents.sendSmartSnippetReason, {reason, details});
|
|
533
537
|
}
|
|
534
538
|
|
|
535
|
-
public logSmartSnippetFeedbackReason(reason: SmartSnippetFeedbackReason, details?: string) {
|
|
536
|
-
return this.makeSmartSnippetFeedbackReason(reason, details).log(
|
|
539
|
+
public async logSmartSnippetFeedbackReason(reason: SmartSnippetFeedbackReason, details?: string) {
|
|
540
|
+
return (await this.makeSmartSnippetFeedbackReason(reason, details)).log({
|
|
541
|
+
searchUID: this.provider.getSearchUID(),
|
|
542
|
+
});
|
|
537
543
|
}
|
|
538
544
|
|
|
539
545
|
public makeExpandSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier) {
|
|
@@ -543,8 +549,8 @@ export class CoveoSearchPageClient {
|
|
|
543
549
|
);
|
|
544
550
|
}
|
|
545
551
|
|
|
546
|
-
public logExpandSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier) {
|
|
547
|
-
return this.makeExpandSmartSnippetSuggestion(snippet).log();
|
|
552
|
+
public async logExpandSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier) {
|
|
553
|
+
return (await this.makeExpandSmartSnippetSuggestion(snippet)).log({searchUID: this.provider.getSearchUID()});
|
|
548
554
|
}
|
|
549
555
|
|
|
550
556
|
public makeCollapseSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier) {
|
|
@@ -554,8 +560,10 @@ export class CoveoSearchPageClient {
|
|
|
554
560
|
);
|
|
555
561
|
}
|
|
556
562
|
|
|
557
|
-
public logCollapseSmartSnippetSuggestion(
|
|
558
|
-
|
|
563
|
+
public async logCollapseSmartSnippetSuggestion(
|
|
564
|
+
snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier
|
|
565
|
+
) {
|
|
566
|
+
return (await this.makeCollapseSmartSnippetSuggestion(snippet)).log({searchUID: this.provider.getSearchUID()});
|
|
559
567
|
}
|
|
560
568
|
|
|
561
569
|
/**
|
|
@@ -568,8 +576,8 @@ export class CoveoSearchPageClient {
|
|
|
568
576
|
/**
|
|
569
577
|
* @deprecated
|
|
570
578
|
*/
|
|
571
|
-
public logShowMoreSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta) {
|
|
572
|
-
return this.makeShowMoreSmartSnippetSuggestion(snippet).log();
|
|
579
|
+
public async logShowMoreSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta) {
|
|
580
|
+
return (await this.makeShowMoreSmartSnippetSuggestion(snippet)).log({searchUID: this.provider.getSearchUID()});
|
|
573
581
|
}
|
|
574
582
|
|
|
575
583
|
/**
|
|
@@ -582,16 +590,16 @@ export class CoveoSearchPageClient {
|
|
|
582
590
|
/**
|
|
583
591
|
* @deprecated
|
|
584
592
|
*/
|
|
585
|
-
public logShowLessSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta) {
|
|
586
|
-
return this.makeShowLessSmartSnippetSuggestion(snippet).log();
|
|
593
|
+
public async logShowLessSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta) {
|
|
594
|
+
return (await this.makeShowLessSmartSnippetSuggestion(snippet)).log({searchUID: this.provider.getSearchUID()});
|
|
587
595
|
}
|
|
588
596
|
|
|
589
597
|
public makeOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
590
598
|
return this.makeClickEvent(SearchPageEvents.openSmartSnippetSource, info, identifier);
|
|
591
599
|
}
|
|
592
600
|
|
|
593
|
-
public logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
594
|
-
return this.makeOpenSmartSnippetSource(info, identifier).log();
|
|
601
|
+
public async logOpenSmartSnippetSource(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
602
|
+
return (await this.makeOpenSmartSnippetSource(info, identifier)).log({searchUID: this.provider.getSearchUID()});
|
|
595
603
|
}
|
|
596
604
|
|
|
597
605
|
public makeOpenSmartSnippetSuggestionSource(info: PartialDocumentInformation, snippet: SmartSnippetSuggestionMeta) {
|
|
@@ -607,12 +615,17 @@ export class CoveoSearchPageClient {
|
|
|
607
615
|
return this.makeClickEvent(SearchPageEvents.copyToClipboard, info, identifier);
|
|
608
616
|
}
|
|
609
617
|
|
|
610
|
-
public logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
611
|
-
return this.makeCopyToClipboard(info, identifier).log();
|
|
618
|
+
public async logCopyToClipboard(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
619
|
+
return (await this.makeCopyToClipboard(info, identifier)).log({searchUID: this.provider.getSearchUID()});
|
|
612
620
|
}
|
|
613
621
|
|
|
614
|
-
public logOpenSmartSnippetSuggestionSource(
|
|
615
|
-
|
|
622
|
+
public async logOpenSmartSnippetSuggestionSource(
|
|
623
|
+
info: PartialDocumentInformation,
|
|
624
|
+
snippet: SmartSnippetSuggestionMeta
|
|
625
|
+
) {
|
|
626
|
+
return (await this.makeOpenSmartSnippetSuggestionSource(info, snippet)).log({
|
|
627
|
+
searchUID: this.provider.getSearchUID(),
|
|
628
|
+
});
|
|
616
629
|
}
|
|
617
630
|
|
|
618
631
|
public makeOpenSmartSnippetInlineLink(
|
|
@@ -627,11 +640,13 @@ export class CoveoSearchPageClient {
|
|
|
627
640
|
);
|
|
628
641
|
}
|
|
629
642
|
|
|
630
|
-
public logOpenSmartSnippetInlineLink(
|
|
643
|
+
public async logOpenSmartSnippetInlineLink(
|
|
631
644
|
info: PartialDocumentInformation,
|
|
632
645
|
identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta
|
|
633
646
|
) {
|
|
634
|
-
return this.makeOpenSmartSnippetInlineLink(info, identifierAndLink).log(
|
|
647
|
+
return (await this.makeOpenSmartSnippetInlineLink(info, identifierAndLink)).log({
|
|
648
|
+
searchUID: this.provider.getSearchUID(),
|
|
649
|
+
});
|
|
635
650
|
}
|
|
636
651
|
|
|
637
652
|
public makeOpenSmartSnippetSuggestionInlineLink(
|
|
@@ -649,180 +664,187 @@ export class CoveoSearchPageClient {
|
|
|
649
664
|
);
|
|
650
665
|
}
|
|
651
666
|
|
|
652
|
-
public logOpenSmartSnippetSuggestionInlineLink(
|
|
667
|
+
public async logOpenSmartSnippetSuggestionInlineLink(
|
|
653
668
|
info: PartialDocumentInformation,
|
|
654
669
|
snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta
|
|
655
670
|
) {
|
|
656
|
-
return this.makeOpenSmartSnippetSuggestionInlineLink(info, snippetAndLink).log(
|
|
671
|
+
return (await this.makeOpenSmartSnippetSuggestionInlineLink(info, snippetAndLink)).log({
|
|
672
|
+
searchUID: this.provider.getSearchUID(),
|
|
673
|
+
});
|
|
657
674
|
}
|
|
658
675
|
|
|
659
676
|
public makeRecentQueryClick() {
|
|
660
677
|
return this.makeSearchEvent(SearchPageEvents.recentQueryClick);
|
|
661
678
|
}
|
|
662
679
|
|
|
663
|
-
public logRecentQueryClick() {
|
|
664
|
-
return this.makeRecentQueryClick().log();
|
|
680
|
+
public async logRecentQueryClick() {
|
|
681
|
+
return (await this.makeRecentQueryClick()).log({searchUID: this.provider.getSearchUID()});
|
|
665
682
|
}
|
|
666
683
|
|
|
667
684
|
public makeClearRecentQueries() {
|
|
668
685
|
return this.makeCustomEvent(SearchPageEvents.clearRecentQueries);
|
|
669
686
|
}
|
|
670
687
|
|
|
671
|
-
public logClearRecentQueries() {
|
|
672
|
-
return this.makeClearRecentQueries().log();
|
|
688
|
+
public async logClearRecentQueries() {
|
|
689
|
+
return (await this.makeClearRecentQueries()).log({searchUID: this.provider.getSearchUID()});
|
|
673
690
|
}
|
|
674
691
|
|
|
675
692
|
public makeRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
676
693
|
return this.makeCustomEvent(SearchPageEvents.recentResultClick, {info, identifier});
|
|
677
694
|
}
|
|
678
695
|
|
|
679
|
-
public logRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
680
|
-
return this.makeRecentResultClick(info, identifier).log();
|
|
696
|
+
public async logRecentResultClick(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
697
|
+
return (await this.makeRecentResultClick(info, identifier)).log({searchUID: this.provider.getSearchUID()});
|
|
681
698
|
}
|
|
682
699
|
|
|
683
700
|
public makeClearRecentResults() {
|
|
684
701
|
return this.makeCustomEvent(SearchPageEvents.clearRecentResults);
|
|
685
702
|
}
|
|
686
703
|
|
|
687
|
-
public logClearRecentResults() {
|
|
688
|
-
return this.makeClearRecentResults().log();
|
|
704
|
+
public async logClearRecentResults() {
|
|
705
|
+
return (await this.makeClearRecentResults()).log({searchUID: this.provider.getSearchUID()});
|
|
689
706
|
}
|
|
690
707
|
|
|
691
708
|
public makeNoResultsBack() {
|
|
692
709
|
return this.makeSearchEvent(SearchPageEvents.noResultsBack);
|
|
693
710
|
}
|
|
694
711
|
|
|
695
|
-
public logNoResultsBack() {
|
|
696
|
-
return this.makeNoResultsBack().log();
|
|
712
|
+
public async logNoResultsBack() {
|
|
713
|
+
return (await this.makeNoResultsBack()).log({searchUID: this.provider.getSearchUID()});
|
|
697
714
|
}
|
|
698
715
|
|
|
699
716
|
public makeShowMoreFoldedResults(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
700
717
|
return this.makeClickEvent(SearchPageEvents.showMoreFoldedResults, info, identifier);
|
|
701
718
|
}
|
|
702
719
|
|
|
703
|
-
public logShowMoreFoldedResults(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
704
|
-
return this.makeShowMoreFoldedResults(info, identifier).log();
|
|
720
|
+
public async logShowMoreFoldedResults(info: PartialDocumentInformation, identifier: DocumentIdentifier) {
|
|
721
|
+
return (await this.makeShowMoreFoldedResults(info, identifier)).log({searchUID: this.provider.getSearchUID()});
|
|
705
722
|
}
|
|
706
723
|
|
|
707
724
|
public makeShowLessFoldedResults() {
|
|
708
725
|
return this.makeCustomEvent(SearchPageEvents.showLessFoldedResults);
|
|
709
726
|
}
|
|
710
727
|
|
|
711
|
-
public logShowLessFoldedResults() {
|
|
712
|
-
return this.makeShowLessFoldedResults().log();
|
|
728
|
+
public async logShowLessFoldedResults() {
|
|
729
|
+
return (await this.makeShowLessFoldedResults()).log({searchUID: this.provider.getSearchUID()});
|
|
713
730
|
}
|
|
714
731
|
|
|
715
|
-
|
|
732
|
+
private makeEventDescription(
|
|
733
|
+
preparedEvent: PreparedEvent<unknown, unknown, AnyEventResponse>,
|
|
734
|
+
actionCause: SearchPageEvents
|
|
735
|
+
): EventDescription {
|
|
736
|
+
return {actionCause, customData: preparedEvent.payload?.customData};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
public async makeCustomEvent(
|
|
716
740
|
event: SearchPageEvents,
|
|
717
741
|
metadata?: Record<string, any>,
|
|
718
742
|
eventType: string = CustomEventsTypes[event]!
|
|
719
|
-
): EventBuilder<CustomEventResponse
|
|
743
|
+
): Promise<EventBuilder<CustomEventResponse>> {
|
|
744
|
+
this.coveoAnalyticsClient.getParameters;
|
|
720
745
|
const customData = {...this.provider.getBaseMetadata(), ...metadata};
|
|
746
|
+
const request: CustomEventRequest = {
|
|
747
|
+
...(await this.getBaseEventRequest(customData)),
|
|
748
|
+
eventType,
|
|
749
|
+
eventValue: event,
|
|
750
|
+
};
|
|
751
|
+
const preparedEvent = await this.coveoAnalyticsClient.makeCustomEvent(request);
|
|
721
752
|
return {
|
|
722
|
-
description: this.
|
|
723
|
-
log:
|
|
724
|
-
const payload: CustomEventRequest = {
|
|
725
|
-
...(await this.getBaseCustomEventRequest(customData)),
|
|
726
|
-
eventType,
|
|
727
|
-
eventValue: event,
|
|
728
|
-
};
|
|
729
|
-
|
|
730
|
-
return this.coveoAnalyticsClient.sendCustomEvent(payload);
|
|
731
|
-
},
|
|
753
|
+
description: this.makeEventDescription(preparedEvent, event),
|
|
754
|
+
log: ({searchUID}) => preparedEvent.log({lastSearchQueryUid: searchUID}),
|
|
732
755
|
};
|
|
733
756
|
}
|
|
734
757
|
|
|
735
|
-
public logCustomEvent(
|
|
758
|
+
public async logCustomEvent(
|
|
736
759
|
event: SearchPageEvents,
|
|
737
760
|
metadata?: Record<string, any>,
|
|
738
761
|
eventType: string = CustomEventsTypes[event]!
|
|
739
762
|
) {
|
|
740
|
-
return this.makeCustomEvent(event, metadata, eventType).log();
|
|
763
|
+
return (await this.makeCustomEvent(event, metadata, eventType)).log({searchUID: this.provider.getSearchUID()});
|
|
741
764
|
}
|
|
742
765
|
|
|
743
|
-
public makeCustomEventWithType(
|
|
766
|
+
public async makeCustomEventWithType(
|
|
767
|
+
eventValue: string,
|
|
768
|
+
eventType: string,
|
|
769
|
+
metadata?: Record<string, any>
|
|
770
|
+
): Promise<EventBuilder<CustomEventResponse>> {
|
|
744
771
|
const customData = {...this.provider.getBaseMetadata(), ...metadata};
|
|
772
|
+
const payload: CustomEventRequest = {
|
|
773
|
+
...(await this.getBaseEventRequest(customData)),
|
|
774
|
+
eventType,
|
|
775
|
+
eventValue,
|
|
776
|
+
};
|
|
777
|
+
const preparedEvent = await this.coveoAnalyticsClient.makeCustomEvent(payload);
|
|
745
778
|
return {
|
|
746
|
-
description:
|
|
747
|
-
log:
|
|
748
|
-
const payload: CustomEventRequest = {
|
|
749
|
-
...(await this.getBaseCustomEventRequest(customData)),
|
|
750
|
-
eventType,
|
|
751
|
-
eventValue,
|
|
752
|
-
};
|
|
753
|
-
return this.coveoAnalyticsClient.sendCustomEvent(payload);
|
|
754
|
-
},
|
|
779
|
+
description: this.makeEventDescription(preparedEvent, eventValue as SearchPageEvents),
|
|
780
|
+
log: ({searchUID}) => preparedEvent.log({lastSearchQueryUid: searchUID}),
|
|
755
781
|
};
|
|
756
782
|
}
|
|
757
783
|
|
|
758
|
-
public logCustomEventWithType(eventValue: string, eventType: string, metadata?: Record<string, any>) {
|
|
759
|
-
return this.makeCustomEventWithType(eventValue, eventType, metadata).log(
|
|
784
|
+
public async logCustomEventWithType(eventValue: string, eventType: string, metadata?: Record<string, any>) {
|
|
785
|
+
return (await this.makeCustomEventWithType(eventValue, eventType, metadata)).log({
|
|
786
|
+
searchUID: this.provider.getSearchUID(),
|
|
787
|
+
});
|
|
760
788
|
}
|
|
761
789
|
|
|
762
790
|
public async logSearchEvent(event: SearchPageEvents, metadata?: Record<string, any>) {
|
|
763
|
-
return
|
|
791
|
+
return (await this.makeSearchEvent(event, metadata)).log({searchUID: this.provider.getSearchUID()});
|
|
764
792
|
}
|
|
765
793
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
794
|
+
public async makeSearchEvent(
|
|
795
|
+
event: SearchPageEvents,
|
|
796
|
+
metadata?: Record<string, any>
|
|
797
|
+
): Promise<EventBuilder<SearchEventResponse>> {
|
|
798
|
+
const request = await this.getBaseSearchEventRequest(event, metadata);
|
|
799
|
+
const preparedEvent = await this.coveoAnalyticsClient.makeSearchEvent(request);
|
|
771
800
|
return {
|
|
772
|
-
description: this.
|
|
773
|
-
log: () =>
|
|
801
|
+
description: this.makeEventDescription(preparedEvent, event),
|
|
802
|
+
log: ({searchUID}) => preparedEvent.log({searchQueryUid: searchUID}),
|
|
774
803
|
};
|
|
775
804
|
}
|
|
776
805
|
|
|
777
|
-
public async
|
|
806
|
+
public async makeClickEvent(
|
|
778
807
|
event: SearchPageEvents,
|
|
779
808
|
info: PartialDocumentInformation,
|
|
780
809
|
identifier: DocumentIdentifier,
|
|
781
810
|
metadata?: Record<string, any>
|
|
782
|
-
) {
|
|
783
|
-
const
|
|
811
|
+
): Promise<EventBuilder<ClickEventResponse>> {
|
|
812
|
+
const request: PreparedClickEventRequest = {
|
|
784
813
|
...info,
|
|
785
814
|
...(await this.getBaseEventRequest({...identifier, ...metadata})),
|
|
786
|
-
searchQueryUid: this.provider.getSearchUID(),
|
|
787
815
|
queryPipeline: this.provider.getPipeline(),
|
|
788
816
|
actionCause: event,
|
|
789
817
|
};
|
|
790
|
-
|
|
791
|
-
return
|
|
818
|
+
const preparedEvent = await this.coveoAnalyticsClient.makeClickEvent(request);
|
|
819
|
+
return {
|
|
820
|
+
description: this.makeEventDescription(preparedEvent, event),
|
|
821
|
+
log: ({searchUID}) => preparedEvent.log({searchQueryUid: searchUID}),
|
|
822
|
+
};
|
|
792
823
|
}
|
|
793
824
|
|
|
794
|
-
public
|
|
825
|
+
public async logClickEvent(
|
|
795
826
|
event: SearchPageEvents,
|
|
796
827
|
info: PartialDocumentInformation,
|
|
797
828
|
identifier: DocumentIdentifier,
|
|
798
829
|
metadata?: Record<string, any>
|
|
799
|
-
)
|
|
800
|
-
return {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
};
|
|
830
|
+
) {
|
|
831
|
+
return (await this.makeClickEvent(event, info, identifier, metadata)).log({
|
|
832
|
+
searchUID: this.provider.getSearchUID(),
|
|
833
|
+
});
|
|
804
834
|
}
|
|
805
835
|
|
|
806
836
|
private async getBaseSearchEventRequest(
|
|
807
837
|
event: SearchPageEvents,
|
|
808
838
|
metadata?: Record<string, any>
|
|
809
|
-
): Promise<
|
|
839
|
+
): Promise<PreparedSearchEventRequest> {
|
|
810
840
|
return {
|
|
811
841
|
...(await this.getBaseEventRequest(metadata)),
|
|
812
842
|
...this.provider.getSearchEventRequestPayload(),
|
|
813
|
-
searchQueryUid: this.provider.getSearchUID(),
|
|
814
843
|
queryPipeline: this.provider.getPipeline(),
|
|
815
844
|
actionCause: event,
|
|
816
845
|
};
|
|
817
846
|
}
|
|
818
847
|
|
|
819
|
-
private async getBaseCustomEventRequest(metadata?: Record<string, any>) {
|
|
820
|
-
return {
|
|
821
|
-
...(await this.getBaseEventRequest(metadata)),
|
|
822
|
-
lastSearchQueryUid: this.provider.getSearchUID(),
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
|
|
826
848
|
private async getBaseEventRequest(metadata?: Record<string, any>) {
|
|
827
849
|
const customData = {...this.provider.getBaseMetadata(), ...metadata};
|
|
828
850
|
return {
|