coveo.analytics 2.20.5 → 2.20.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.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/insight/insightClient.d.ts +7 -1
- package/dist/library.es.js +18 -0
- package/dist/library.js +18 -0
- package/package.json +2 -2
- package/src/insight/insightClient.spec.ts +39 -0
- package/src/insight/insightClient.ts +28 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnalyticsClient, ClientOptions } from '../client/analytics';
|
|
2
2
|
import { SearchEventRequest } from '../events';
|
|
3
|
-
import { FacetBaseMeta, FacetMetadata, FacetSortMeta, FacetStateMetadata, InterfaceChangeMetadata, QueryErrorMeta, SearchPageEvents } from '../searchPage/searchPageEvents';
|
|
3
|
+
import { FacetBaseMeta, FacetMetadata, FacetSortMeta, FacetStateMetadata, PagerMetadata, InterfaceChangeMetadata, QueryErrorMeta, SearchPageEvents, ResultsSortMetadata, FacetRangeMetadata, CategoryFacetMetadata } from '../searchPage/searchPageEvents';
|
|
4
4
|
export interface InsightClientProvider {
|
|
5
5
|
getSearchEventRequestPayload: () => Omit<SearchEventRequest, 'actionCause' | 'searchQueryUid'>;
|
|
6
6
|
getSearchUID: () => string;
|
|
@@ -27,6 +27,8 @@ export declare class CoveoInsightClient {
|
|
|
27
27
|
logInterfaceLoad(): Promise<void | import("../events").SearchEventResponse>;
|
|
28
28
|
logInterfaceChange(metadata: InterfaceChangeMetadata): Promise<void | import("../events").SearchEventResponse>;
|
|
29
29
|
logFetchMoreResults(): Promise<void | import("../events").CustomEventResponse>;
|
|
30
|
+
logBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata): Promise<void | import("../events").SearchEventResponse>;
|
|
31
|
+
logBreadcrumbResetAll(): Promise<void | import("../events").SearchEventResponse>;
|
|
30
32
|
logFacetSelect(meta: FacetMetadata): Promise<void | import("../events").SearchEventResponse>;
|
|
31
33
|
logFacetDeselect(meta: FacetMetadata): Promise<void | import("../events").SearchEventResponse>;
|
|
32
34
|
logFacetUpdateSort(meta: FacetSortMeta): Promise<void | import("../events").SearchEventResponse>;
|
|
@@ -36,6 +38,10 @@ export declare class CoveoInsightClient {
|
|
|
36
38
|
logQueryError(meta: QueryErrorMeta): Promise<void | import("../events").CustomEventResponse>;
|
|
37
39
|
logCustomEvent(event: SearchPageEvents, metadata?: Record<string, any>): Promise<void | import("../events").CustomEventResponse>;
|
|
38
40
|
logSearchEvent(event: SearchPageEvents, metadata?: Record<string, any>): Promise<void | import("../events").SearchEventResponse>;
|
|
41
|
+
logPagerNumber(meta: PagerMetadata): Promise<void | import("../events").CustomEventResponse>;
|
|
42
|
+
logPagerNext(meta: PagerMetadata): Promise<void | import("../events").CustomEventResponse>;
|
|
43
|
+
logPagerPrevious(meta: PagerMetadata): Promise<void | import("../events").CustomEventResponse>;
|
|
44
|
+
logResultsSort(metadata: ResultsSortMetadata): Promise<void | import("../events").SearchEventResponse>;
|
|
39
45
|
private getBaseCustomEventRequest;
|
|
40
46
|
private getBaseSearchEventRequest;
|
|
41
47
|
private getBaseEventRequest;
|
package/dist/library.es.js
CHANGED
|
@@ -1790,6 +1790,12 @@ class CoveoInsightClient {
|
|
|
1790
1790
|
logFetchMoreResults() {
|
|
1791
1791
|
return this.logCustomEvent(SearchPageEvents.pagerScrolling, { type: 'getMoreResults' });
|
|
1792
1792
|
}
|
|
1793
|
+
logBreadcrumbFacet(metadata) {
|
|
1794
|
+
return this.logSearchEvent(SearchPageEvents.breadcrumbFacet, metadata);
|
|
1795
|
+
}
|
|
1796
|
+
logBreadcrumbResetAll() {
|
|
1797
|
+
return this.logSearchEvent(SearchPageEvents.breadcrumbResetAll);
|
|
1798
|
+
}
|
|
1793
1799
|
logFacetSelect(meta) {
|
|
1794
1800
|
return this.logSearchEvent(SearchPageEvents.facetSelect, meta);
|
|
1795
1801
|
}
|
|
@@ -1823,6 +1829,18 @@ class CoveoInsightClient {
|
|
|
1823
1829
|
return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(event, metadata));
|
|
1824
1830
|
});
|
|
1825
1831
|
}
|
|
1832
|
+
logPagerNumber(meta) {
|
|
1833
|
+
return this.logCustomEvent(SearchPageEvents.pagerNumber, meta);
|
|
1834
|
+
}
|
|
1835
|
+
logPagerNext(meta) {
|
|
1836
|
+
return this.logCustomEvent(SearchPageEvents.pagerNext, meta);
|
|
1837
|
+
}
|
|
1838
|
+
logPagerPrevious(meta) {
|
|
1839
|
+
return this.logCustomEvent(SearchPageEvents.pagerPrevious, meta);
|
|
1840
|
+
}
|
|
1841
|
+
logResultsSort(metadata) {
|
|
1842
|
+
return this.logSearchEvent(SearchPageEvents.resultsSort, metadata);
|
|
1843
|
+
}
|
|
1826
1844
|
getBaseCustomEventRequest(metadata) {
|
|
1827
1845
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1828
1846
|
return Object.assign(Object.assign({}, (yield this.getBaseEventRequest(metadata))), { lastSearchQueryUid: this.provider.getSearchUID() });
|
package/dist/library.js
CHANGED
|
@@ -84171,6 +84171,12 @@ var CoveoInsightClient = (function () {
|
|
|
84171
84171
|
CoveoInsightClient.prototype.logFetchMoreResults = function () {
|
|
84172
84172
|
return this.logCustomEvent(SearchPageEvents.pagerScrolling, { type: 'getMoreResults' });
|
|
84173
84173
|
};
|
|
84174
|
+
CoveoInsightClient.prototype.logBreadcrumbFacet = function (metadata) {
|
|
84175
|
+
return this.logSearchEvent(SearchPageEvents.breadcrumbFacet, metadata);
|
|
84176
|
+
};
|
|
84177
|
+
CoveoInsightClient.prototype.logBreadcrumbResetAll = function () {
|
|
84178
|
+
return this.logSearchEvent(SearchPageEvents.breadcrumbResetAll);
|
|
84179
|
+
};
|
|
84174
84180
|
CoveoInsightClient.prototype.logFacetSelect = function (meta) {
|
|
84175
84181
|
return this.logSearchEvent(SearchPageEvents.facetSelect, meta);
|
|
84176
84182
|
};
|
|
@@ -84221,6 +84227,18 @@ var CoveoInsightClient = (function () {
|
|
|
84221
84227
|
});
|
|
84222
84228
|
});
|
|
84223
84229
|
};
|
|
84230
|
+
CoveoInsightClient.prototype.logPagerNumber = function (meta) {
|
|
84231
|
+
return this.logCustomEvent(SearchPageEvents.pagerNumber, meta);
|
|
84232
|
+
};
|
|
84233
|
+
CoveoInsightClient.prototype.logPagerNext = function (meta) {
|
|
84234
|
+
return this.logCustomEvent(SearchPageEvents.pagerNext, meta);
|
|
84235
|
+
};
|
|
84236
|
+
CoveoInsightClient.prototype.logPagerPrevious = function (meta) {
|
|
84237
|
+
return this.logCustomEvent(SearchPageEvents.pagerPrevious, meta);
|
|
84238
|
+
};
|
|
84239
|
+
CoveoInsightClient.prototype.logResultsSort = function (metadata) {
|
|
84240
|
+
return this.logSearchEvent(SearchPageEvents.resultsSort, metadata);
|
|
84241
|
+
};
|
|
84224
84242
|
CoveoInsightClient.prototype.getBaseCustomEventRequest = function (metadata) {
|
|
84225
84243
|
return __awaiter(this, void 0, void 0, function () {
|
|
84226
84244
|
var _a;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coveo.analytics",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.8",
|
|
4
4
|
"description": "📈 Coveo analytics client (node and browser compatible) ",
|
|
5
5
|
"main": "dist/library.js",
|
|
6
6
|
"module": "dist/library.es.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@react-native-async-storage/async-storage": "^1.17.
|
|
26
|
+
"@react-native-async-storage/async-storage": "^1.17.6",
|
|
27
27
|
"cross-fetch": "^3.1.5"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -119,6 +119,22 @@ describe('InsightClient', () => {
|
|
|
119
119
|
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
+
it('should send proper payload for #breadcrumbResetAll', async () => {
|
|
123
|
+
await client.logBreadcrumbResetAll();
|
|
124
|
+
expectMatchPayload(SearchPageEvents.breadcrumbResetAll);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should send proper payload for #breadcrumbFacet', async () => {
|
|
128
|
+
const meta = {
|
|
129
|
+
facetField: '@foo',
|
|
130
|
+
facetId: 'bar',
|
|
131
|
+
facetTitle: 'title',
|
|
132
|
+
facetValue: 'qwerty',
|
|
133
|
+
};
|
|
134
|
+
await client.logBreadcrumbFacet(meta);
|
|
135
|
+
expectMatchPayload(SearchPageEvents.breadcrumbFacet, meta);
|
|
136
|
+
});
|
|
137
|
+
|
|
122
138
|
it('should send proper payload for #logFacetSelect', async () => {
|
|
123
139
|
const meta = {
|
|
124
140
|
facetField: '@foo',
|
|
@@ -197,6 +213,29 @@ describe('InsightClient', () => {
|
|
|
197
213
|
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);
|
|
198
214
|
});
|
|
199
215
|
|
|
216
|
+
it('should send proper payload for #logPagerNumber', async () => {
|
|
217
|
+
const meta = {pagerNumber: 123};
|
|
218
|
+
await client.logPagerNumber(meta);
|
|
219
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, meta);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it('should send proper payload for #logPagerNext', async () => {
|
|
223
|
+
const meta = {pagerNumber: 123};
|
|
224
|
+
await client.logPagerNext(meta);
|
|
225
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, meta);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it('should send proper payload for #logPagerPrevious', async () => {
|
|
229
|
+
const meta = {pagerNumber: 123};
|
|
230
|
+
await client.logPagerPrevious(meta);
|
|
231
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, meta);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('should send proper payload for #resultsSort', async () => {
|
|
235
|
+
await client.logResultsSort({resultsSortBy: 'date ascending'});
|
|
236
|
+
expectMatchPayload(SearchPageEvents.resultsSort, {resultsSortBy: 'date ascending'});
|
|
237
|
+
});
|
|
238
|
+
|
|
200
239
|
it('should enable analytics tracking by default', () => {
|
|
201
240
|
const c = new CoveoInsightClient({}, provider);
|
|
202
241
|
expect(c.coveoAnalyticsClient instanceof CoveoAnalyticsClient).toBe(true);
|
|
@@ -8,9 +8,13 @@ import {
|
|
|
8
8
|
FacetMetadata,
|
|
9
9
|
FacetSortMeta,
|
|
10
10
|
FacetStateMetadata,
|
|
11
|
+
PagerMetadata,
|
|
11
12
|
InterfaceChangeMetadata,
|
|
12
13
|
QueryErrorMeta,
|
|
13
14
|
SearchPageEvents,
|
|
15
|
+
ResultsSortMetadata,
|
|
16
|
+
FacetRangeMetadata,
|
|
17
|
+
CategoryFacetMetadata,
|
|
14
18
|
} from '../searchPage/searchPageEvents';
|
|
15
19
|
|
|
16
20
|
export interface InsightClientProvider {
|
|
@@ -62,6 +66,14 @@ export class CoveoInsightClient {
|
|
|
62
66
|
return this.logCustomEvent(SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
|
|
63
67
|
}
|
|
64
68
|
|
|
69
|
+
public logBreadcrumbFacet(metadata: FacetMetadata | FacetRangeMetadata | CategoryFacetMetadata) {
|
|
70
|
+
return this.logSearchEvent(SearchPageEvents.breadcrumbFacet, metadata);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public logBreadcrumbResetAll() {
|
|
74
|
+
return this.logSearchEvent(SearchPageEvents.breadcrumbResetAll);
|
|
75
|
+
}
|
|
76
|
+
|
|
65
77
|
public logFacetSelect(meta: FacetMetadata) {
|
|
66
78
|
return this.logSearchEvent(SearchPageEvents.facetSelect, meta);
|
|
67
79
|
}
|
|
@@ -106,6 +118,22 @@ export class CoveoInsightClient {
|
|
|
106
118
|
return this.coveoAnalyticsClient.sendSearchEvent(await this.getBaseSearchEventRequest(event, metadata));
|
|
107
119
|
}
|
|
108
120
|
|
|
121
|
+
public logPagerNumber(meta: PagerMetadata) {
|
|
122
|
+
return this.logCustomEvent(SearchPageEvents.pagerNumber, meta);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public logPagerNext(meta: PagerMetadata) {
|
|
126
|
+
return this.logCustomEvent(SearchPageEvents.pagerNext, meta);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
public logPagerPrevious(meta: PagerMetadata) {
|
|
130
|
+
return this.logCustomEvent(SearchPageEvents.pagerPrevious, meta);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
public logResultsSort(metadata: ResultsSortMetadata) {
|
|
134
|
+
return this.logSearchEvent(SearchPageEvents.resultsSort, metadata);
|
|
135
|
+
}
|
|
136
|
+
|
|
109
137
|
private async getBaseCustomEventRequest(metadata?: Record<string, any>) {
|
|
110
138
|
return {
|
|
111
139
|
...(await this.getBaseEventRequest(metadata)),
|