coveo.analytics 2.30.45 → 2.30.46
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/README.md +41 -41
- package/dist/browser.mjs +34 -16
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +54 -36
- 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 +2 -2
- package/dist/definitions/insight/insightClient.d.ts +2 -0
- package/dist/definitions/version.d.ts +1 -1
- package/dist/library.cjs +151 -43
- package/dist/library.es.js +34 -16
- package/dist/library.js +151 -43
- package/dist/library.mjs +151 -43
- package/dist/react-native.es.js +34 -16
- package/package.json +7 -7
- package/src/caseAssist/caseAssistClient.spec.ts +5 -5
- package/src/caseAssist/caseAssistClient.ts +7 -4
- package/src/client/analytics.spec.ts +1 -1
- package/src/client/analytics.ts +11 -11
- package/src/client/analyticsBeaconClient.spec.ts +10 -10
- package/src/client/analyticsBeaconClient.ts +4 -4
- package/src/client/analyticsFetchClient.ts +1 -1
- package/src/client/analyticsRequestClient.ts +1 -1
- package/src/client/measurementProtocolMapper.ts +2 -2
- package/src/client/measurementProtocolMapping/baseMeasurementProtocolMapper.ts +1 -1
- package/src/client/measurementProtocolMapping/commerceMeasurementProtocolMapper.ts +5 -5
- package/src/client/noopAnalytics.ts +1 -1
- package/src/client/utils.spec.ts +6 -6
- package/src/coveoua/browser.ts +2 -2
- package/src/coveoua/plugins.ts +1 -1
- package/src/coveoua/simpleanalytics.spec.ts +5 -5
- package/src/coveoua/simpleanalytics.ts +1 -1
- package/src/donottrack.spec.ts +1 -1
- package/src/history.spec.ts +1 -1
- package/src/insight/insightClient.spec.ts +42 -8
- package/src/insight/insightClient.ts +82 -63
- package/src/plugins/ec.spec.ts +6 -6
- package/src/plugins/ec.ts +5 -5
- package/src/plugins/link.spec.ts +5 -5
- package/src/plugins/link.ts +1 -1
- package/src/plugins/svc.ts +1 -1
- package/src/searchPage/searchPageClient.spec.ts +3 -3
- package/src/searchPage/searchPageClient.ts +27 -24
- package/src/searchPage/searchPageEvents.ts +2 -1
- package/src/version.ts +1 -1
|
@@ -104,7 +104,7 @@ describe('SearchPageClient', () => {
|
|
|
104
104
|
Promise.resolve({...payload, customData: {...payload.customData, ...customDataFromMiddleware}}),
|
|
105
105
|
],
|
|
106
106
|
},
|
|
107
|
-
provider
|
|
107
|
+
provider,
|
|
108
108
|
);
|
|
109
109
|
};
|
|
110
110
|
|
|
@@ -151,7 +151,7 @@ describe('SearchPageClient', () => {
|
|
|
151
151
|
const expectSearchEventToMatchDescription = (
|
|
152
152
|
description: EventDescription,
|
|
153
153
|
actionCause: SearchPageEvents,
|
|
154
|
-
meta = {}
|
|
154
|
+
meta = {},
|
|
155
155
|
) => {
|
|
156
156
|
expectMatchDescription(description, actionCause, {...meta, genQaMetadata: 'bar'});
|
|
157
157
|
};
|
|
@@ -177,7 +177,7 @@ describe('SearchPageClient', () => {
|
|
|
177
177
|
const expectMatchCustomEventPayload = (
|
|
178
178
|
actionCause: SearchPageEvents,
|
|
179
179
|
meta = {},
|
|
180
|
-
eventType = CustomEventsTypes[actionCause]
|
|
180
|
+
eventType = CustomEventsTypes[actionCause],
|
|
181
181
|
) => {
|
|
182
182
|
const body: string = lastCallBody(fetchMock);
|
|
183
183
|
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
|
|
@@ -80,7 +80,10 @@ export interface EventBuilder<T extends AnyEventResponse = AnyEventResponse> {
|
|
|
80
80
|
export class CoveoSearchPageClient {
|
|
81
81
|
public coveoAnalyticsClient: AnalyticsClient;
|
|
82
82
|
|
|
83
|
-
constructor(
|
|
83
|
+
constructor(
|
|
84
|
+
private opts: Partial<SearchPageClientOptions>,
|
|
85
|
+
private provider: SearchPageClientProvider,
|
|
86
|
+
) {
|
|
84
87
|
const shouldDisableAnalytics = opts.enableAnalytics === false || doNotTrack();
|
|
85
88
|
this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
|
|
86
89
|
}
|
|
@@ -289,7 +292,7 @@ export class CoveoSearchPageClient {
|
|
|
289
292
|
return this.makeCustomEvent(
|
|
290
293
|
SearchPageEvents.triggerQuery,
|
|
291
294
|
{query: this.provider.getSearchEventRequestPayload().queryText},
|
|
292
|
-
'queryPipelineTriggers'
|
|
295
|
+
'queryPipelineTriggers',
|
|
293
296
|
);
|
|
294
297
|
}
|
|
295
298
|
|
|
@@ -550,7 +553,7 @@ export class CoveoSearchPageClient {
|
|
|
550
553
|
public makeExpandSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier) {
|
|
551
554
|
return this.makeCustomEvent(
|
|
552
555
|
SearchPageEvents.expandSmartSnippetSuggestion,
|
|
553
|
-
'documentId' in snippet ? snippet : {documentId: snippet}
|
|
556
|
+
'documentId' in snippet ? snippet : {documentId: snippet},
|
|
554
557
|
);
|
|
555
558
|
}
|
|
556
559
|
|
|
@@ -561,12 +564,12 @@ export class CoveoSearchPageClient {
|
|
|
561
564
|
public makeCollapseSmartSnippetSuggestion(snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier) {
|
|
562
565
|
return this.makeCustomEvent(
|
|
563
566
|
SearchPageEvents.collapseSmartSnippetSuggestion,
|
|
564
|
-
'documentId' in snippet ? snippet : {documentId: snippet}
|
|
567
|
+
'documentId' in snippet ? snippet : {documentId: snippet},
|
|
565
568
|
);
|
|
566
569
|
}
|
|
567
570
|
|
|
568
571
|
public async logCollapseSmartSnippetSuggestion(
|
|
569
|
-
snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier
|
|
572
|
+
snippet: SmartSnippetSuggestionMeta | SmartSnippetDocumentIdentifier,
|
|
570
573
|
) {
|
|
571
574
|
return (await this.makeCollapseSmartSnippetSuggestion(snippet)).log({searchUID: this.provider.getSearchUID()});
|
|
572
575
|
}
|
|
@@ -612,7 +615,7 @@ export class CoveoSearchPageClient {
|
|
|
612
615
|
SearchPageEvents.openSmartSnippetSuggestionSource,
|
|
613
616
|
info,
|
|
614
617
|
{contentIDKey: snippet.documentId.contentIdKey, contentIDValue: snippet.documentId.contentIdValue},
|
|
615
|
-
snippet
|
|
618
|
+
snippet,
|
|
616
619
|
);
|
|
617
620
|
}
|
|
618
621
|
|
|
@@ -626,7 +629,7 @@ export class CoveoSearchPageClient {
|
|
|
626
629
|
|
|
627
630
|
public async logOpenSmartSnippetSuggestionSource(
|
|
628
631
|
info: PartialDocumentInformation,
|
|
629
|
-
snippet: SmartSnippetSuggestionMeta
|
|
632
|
+
snippet: SmartSnippetSuggestionMeta,
|
|
630
633
|
) {
|
|
631
634
|
return (await this.makeOpenSmartSnippetSuggestionSource(info, snippet)).log({
|
|
632
635
|
searchUID: this.provider.getSearchUID(),
|
|
@@ -635,19 +638,19 @@ export class CoveoSearchPageClient {
|
|
|
635
638
|
|
|
636
639
|
public makeOpenSmartSnippetInlineLink(
|
|
637
640
|
info: PartialDocumentInformation,
|
|
638
|
-
identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta
|
|
641
|
+
identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta,
|
|
639
642
|
) {
|
|
640
643
|
return this.makeClickEvent(
|
|
641
644
|
SearchPageEvents.openSmartSnippetInlineLink,
|
|
642
645
|
info,
|
|
643
646
|
{contentIDKey: identifierAndLink.contentIDKey, contentIDValue: identifierAndLink.contentIDValue},
|
|
644
|
-
identifierAndLink
|
|
647
|
+
identifierAndLink,
|
|
645
648
|
);
|
|
646
649
|
}
|
|
647
650
|
|
|
648
651
|
public async logOpenSmartSnippetInlineLink(
|
|
649
652
|
info: PartialDocumentInformation,
|
|
650
|
-
identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta
|
|
653
|
+
identifierAndLink: DocumentIdentifier & SmartSnippetLinkMeta,
|
|
651
654
|
) {
|
|
652
655
|
return (await this.makeOpenSmartSnippetInlineLink(info, identifierAndLink)).log({
|
|
653
656
|
searchUID: this.provider.getSearchUID(),
|
|
@@ -656,7 +659,7 @@ export class CoveoSearchPageClient {
|
|
|
656
659
|
|
|
657
660
|
public makeOpenSmartSnippetSuggestionInlineLink(
|
|
658
661
|
info: PartialDocumentInformation,
|
|
659
|
-
snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta
|
|
662
|
+
snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta,
|
|
660
663
|
) {
|
|
661
664
|
return this.makeClickEvent(
|
|
662
665
|
SearchPageEvents.openSmartSnippetSuggestionInlineLink,
|
|
@@ -665,13 +668,13 @@ export class CoveoSearchPageClient {
|
|
|
665
668
|
contentIDKey: snippetAndLink.documentId.contentIdKey,
|
|
666
669
|
contentIDValue: snippetAndLink.documentId.contentIdValue,
|
|
667
670
|
},
|
|
668
|
-
snippetAndLink
|
|
671
|
+
snippetAndLink,
|
|
669
672
|
);
|
|
670
673
|
}
|
|
671
674
|
|
|
672
675
|
public async logOpenSmartSnippetSuggestionInlineLink(
|
|
673
676
|
info: PartialDocumentInformation,
|
|
674
|
-
snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta
|
|
677
|
+
snippetAndLink: SmartSnippetSuggestionMeta & SmartSnippetLinkMeta,
|
|
675
678
|
) {
|
|
676
679
|
return (await this.makeOpenSmartSnippetSuggestionInlineLink(info, snippetAndLink)).log({
|
|
677
680
|
searchUID: this.provider.getSearchUID(),
|
|
@@ -736,7 +739,7 @@ export class CoveoSearchPageClient {
|
|
|
736
739
|
|
|
737
740
|
private makeEventDescription(
|
|
738
741
|
preparedEvent: PreparedEvent<unknown, unknown, AnyEventResponse>,
|
|
739
|
-
actionCause: SearchPageEvents
|
|
742
|
+
actionCause: SearchPageEvents,
|
|
740
743
|
): EventDescription {
|
|
741
744
|
return {actionCause, customData: preparedEvent.payload?.customData};
|
|
742
745
|
}
|
|
@@ -744,7 +747,7 @@ export class CoveoSearchPageClient {
|
|
|
744
747
|
public async makeCustomEvent(
|
|
745
748
|
event: SearchPageEvents,
|
|
746
749
|
metadata?: Record<string, any>,
|
|
747
|
-
eventType: string = CustomEventsTypes[event]
|
|
750
|
+
eventType: string = CustomEventsTypes[event]!,
|
|
748
751
|
): Promise<EventBuilder<CustomEventResponse>> {
|
|
749
752
|
this.coveoAnalyticsClient.getParameters;
|
|
750
753
|
const customData = {...this.provider.getBaseMetadata(), ...metadata};
|
|
@@ -763,7 +766,7 @@ export class CoveoSearchPageClient {
|
|
|
763
766
|
public async logCustomEvent(
|
|
764
767
|
event: SearchPageEvents,
|
|
765
768
|
metadata?: Record<string, any>,
|
|
766
|
-
eventType: string = CustomEventsTypes[event]
|
|
769
|
+
eventType: string = CustomEventsTypes[event]!,
|
|
767
770
|
) {
|
|
768
771
|
return (await this.makeCustomEvent(event, metadata, eventType)).log({searchUID: this.provider.getSearchUID()});
|
|
769
772
|
}
|
|
@@ -771,7 +774,7 @@ export class CoveoSearchPageClient {
|
|
|
771
774
|
public async makeCustomEventWithType(
|
|
772
775
|
eventValue: string,
|
|
773
776
|
eventType: string,
|
|
774
|
-
metadata?: Record<string, any
|
|
777
|
+
metadata?: Record<string, any>,
|
|
775
778
|
): Promise<EventBuilder<CustomEventResponse>> {
|
|
776
779
|
const customData = {...this.provider.getBaseMetadata(), ...metadata};
|
|
777
780
|
const payload: CustomEventRequest = {
|
|
@@ -798,7 +801,7 @@ export class CoveoSearchPageClient {
|
|
|
798
801
|
|
|
799
802
|
public async makeSearchEvent(
|
|
800
803
|
event: SearchPageEvents,
|
|
801
|
-
metadata?: Record<string, any
|
|
804
|
+
metadata?: Record<string, any>,
|
|
802
805
|
): Promise<EventBuilder<SearchEventResponse>> {
|
|
803
806
|
const request = await this.getBaseSearchEventRequest(event, metadata);
|
|
804
807
|
const preparedEvent = await this.coveoAnalyticsClient.makeSearchEvent(request);
|
|
@@ -812,7 +815,7 @@ export class CoveoSearchPageClient {
|
|
|
812
815
|
event: SearchPageEvents,
|
|
813
816
|
info: PartialDocumentInformation,
|
|
814
817
|
identifier: DocumentIdentifier,
|
|
815
|
-
metadata?: Record<string, any
|
|
818
|
+
metadata?: Record<string, any>,
|
|
816
819
|
): Promise<EventBuilder<ClickEventResponse>> {
|
|
817
820
|
const request: PreparedClickEventRequest = {
|
|
818
821
|
...info,
|
|
@@ -831,7 +834,7 @@ export class CoveoSearchPageClient {
|
|
|
831
834
|
event: SearchPageEvents,
|
|
832
835
|
info: PartialDocumentInformation,
|
|
833
836
|
identifier: DocumentIdentifier,
|
|
834
|
-
metadata?: Record<string, any
|
|
837
|
+
metadata?: Record<string, any>,
|
|
835
838
|
) {
|
|
836
839
|
return (await this.makeClickEvent(event, info, identifier, metadata)).log({
|
|
837
840
|
searchUID: this.provider.getSearchUID(),
|
|
@@ -840,7 +843,7 @@ export class CoveoSearchPageClient {
|
|
|
840
843
|
|
|
841
844
|
private async getBaseSearchEventRequest(
|
|
842
845
|
event: SearchPageEvents,
|
|
843
|
-
metadata?: Record<string, any
|
|
846
|
+
metadata?: Record<string, any>,
|
|
844
847
|
): Promise<PreparedSearchEventRequest> {
|
|
845
848
|
return {
|
|
846
849
|
...(await this.getBaseEventRequest({...metadata, ...this.provider.getGeneratedAnswerMetadata?.()})),
|
|
@@ -915,19 +918,19 @@ export class CoveoSearchPageClient {
|
|
|
915
918
|
|
|
916
919
|
public makeGeneratedAnswerCitationClick(
|
|
917
920
|
info: PartialDocumentInformation,
|
|
918
|
-
citation: GeneratedAnswerCitationClickMeta
|
|
921
|
+
citation: GeneratedAnswerCitationClickMeta,
|
|
919
922
|
) {
|
|
920
923
|
return this.makeClickEvent(
|
|
921
924
|
SearchPageEvents.generatedAnswerCitationClick,
|
|
922
925
|
{...info, documentPosition: 1},
|
|
923
926
|
{contentIDKey: citation.documentId.contentIdKey, contentIDValue: citation.documentId.contentIdValue},
|
|
924
|
-
citation
|
|
927
|
+
citation,
|
|
925
928
|
);
|
|
926
929
|
}
|
|
927
930
|
|
|
928
931
|
public async logGeneratedAnswerCitationClick(
|
|
929
932
|
info: PartialDocumentInformation,
|
|
930
|
-
citation: GeneratedAnswerCitationClickMeta
|
|
933
|
+
citation: GeneratedAnswerCitationClickMeta,
|
|
931
934
|
) {
|
|
932
935
|
return (await this.makeGeneratedAnswerCitationClick(info, citation)).log({
|
|
933
936
|
searchUID: this.provider.getSearchUID(),
|
|
@@ -361,7 +361,8 @@ export const CustomEventsTypes: Partial<Record<SearchPageEvents | InsightEvents,
|
|
|
361
361
|
[SearchPageEvents.triggerExecute]: 'queryPipelineTriggers',
|
|
362
362
|
[SearchPageEvents.triggerQuery]: 'queryPipelineTriggers',
|
|
363
363
|
[SearchPageEvents.triggerRedirect]: 'queryPipelineTriggers',
|
|
364
|
-
|
|
364
|
+
// This value is the same as SearchPageEvents.triggerQuery, which is very likely a mistake.
|
|
365
|
+
//[SearchPageEvents.queryError]: 'errors',
|
|
365
366
|
[SearchPageEvents.queryErrorBack]: 'errors',
|
|
366
367
|
[SearchPageEvents.queryErrorClear]: 'errors',
|
|
367
368
|
[SearchPageEvents.queryErrorRetry]: 'errors',
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const libVersion =
|
|
1
|
+
export const libVersion = 'local'; // processed by @rollup/plugin-replace
|