coveo.analytics 2.28.22 → 2.28.23
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/browser.mjs +5 -1
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +5 -2
- package/dist/coveoua.debug.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/events.d.ts +7 -7
- package/dist/definitions/version.d.ts +1 -1
- package/dist/library.cjs +5 -2
- package/dist/library.es.js +5 -1
- package/dist/library.js +5 -2
- package/dist/library.mjs +5 -2
- package/dist/react-native.es.js +5 -1
- package/package.json +1 -1
- package/src/client/analytics.spec.ts +66 -2
- package/src/client/analytics.ts +5 -0
- package/src/coveoua/simpleanalytics.ts +0 -1
- package/src/events.ts +7 -7
- package/src/insight/insightClient.spec.ts +1 -1
|
@@ -57,18 +57,18 @@ export interface SearchEventRequest extends EventBaseRequest {
|
|
|
57
57
|
export interface PreparedSearchEventRequest extends Omit<SearchEventRequest, 'searchQueryUid'> {
|
|
58
58
|
}
|
|
59
59
|
export interface DocumentInformation {
|
|
60
|
-
documentUri
|
|
60
|
+
documentUri?: string;
|
|
61
61
|
documentUriHash: string;
|
|
62
|
-
collectionName
|
|
62
|
+
collectionName?: string;
|
|
63
63
|
sourceName: string;
|
|
64
64
|
documentPosition: number;
|
|
65
65
|
actionCause: string;
|
|
66
66
|
searchQueryUid: string;
|
|
67
|
-
documentTitle
|
|
68
|
-
documentUrl
|
|
69
|
-
documentAuthor
|
|
70
|
-
queryPipeline
|
|
71
|
-
rankingModifier
|
|
67
|
+
documentTitle?: string;
|
|
68
|
+
documentUrl?: string;
|
|
69
|
+
documentAuthor?: string;
|
|
70
|
+
queryPipeline?: string;
|
|
71
|
+
rankingModifier?: string;
|
|
72
72
|
}
|
|
73
73
|
export interface ClickEventRequest extends EventBaseRequest, DocumentInformation {
|
|
74
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const libVersion = "2.28.
|
|
1
|
+
export declare const libVersion = "2.28.23";
|
package/dist/library.cjs
CHANGED
|
@@ -731,7 +731,7 @@ function sha1(bytes) {
|
|
|
731
731
|
const v5 = v35('v5', 0x50, sha1);
|
|
732
732
|
var uuidv5 = v5;
|
|
733
733
|
|
|
734
|
-
var libVersion = "2.28.
|
|
734
|
+
var libVersion = "2.28.23" ;
|
|
735
735
|
|
|
736
736
|
var getFormattedLocation = function (location) {
|
|
737
737
|
return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
|
|
@@ -83061,6 +83061,10 @@ var CoveoAnalyticsClient = (function () {
|
|
|
83061
83061
|
this.clear();
|
|
83062
83062
|
this.runtime.storage = new NullStorage();
|
|
83063
83063
|
}
|
|
83064
|
+
this.addEventTypeMapping(exports.EventType.view, { newEventType: exports.EventType.view, addClientIdParameter: true });
|
|
83065
|
+
this.addEventTypeMapping(exports.EventType.click, { newEventType: exports.EventType.click, addClientIdParameter: true });
|
|
83066
|
+
this.addEventTypeMapping(exports.EventType.custom, { newEventType: exports.EventType.custom, addClientIdParameter: true });
|
|
83067
|
+
this.addEventTypeMapping(exports.EventType.search, { newEventType: exports.EventType.search, addClientIdParameter: true });
|
|
83064
83068
|
}
|
|
83065
83069
|
Object.defineProperty(CoveoAnalyticsClient.prototype, "defaultOptions", {
|
|
83066
83070
|
get: function () {
|
|
@@ -84046,7 +84050,6 @@ var CoveoUA = (function () {
|
|
|
84046
84050
|
return _this.plugins.require(pluginKey, pluginOptions_1);
|
|
84047
84051
|
});
|
|
84048
84052
|
this.client.registerBeforeSendEventHook(function (eventType, payload) { return (__assign(__assign({}, payload), _this.params)); });
|
|
84049
|
-
this.client.addEventTypeMapping(exports.EventType.view, { newEventType: exports.EventType.view, addClientIdParameter: true });
|
|
84050
84053
|
}
|
|
84051
84054
|
else {
|
|
84052
84055
|
throw new Error("You must pass either your token or a valid object when you call 'init'");
|
package/dist/library.es.js
CHANGED
|
@@ -596,7 +596,7 @@ function sha1(bytes) {
|
|
|
596
596
|
const v5 = v35('v5', 0x50, sha1);
|
|
597
597
|
var uuidv5 = v5;
|
|
598
598
|
|
|
599
|
-
const libVersion = "2.28.
|
|
599
|
+
const libVersion = "2.28.23" ;
|
|
600
600
|
|
|
601
601
|
const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
|
|
602
602
|
|
|
@@ -1279,6 +1279,10 @@ class CoveoAnalyticsClient {
|
|
|
1279
1279
|
this.clear();
|
|
1280
1280
|
this.runtime.storage = new NullStorage();
|
|
1281
1281
|
}
|
|
1282
|
+
this.addEventTypeMapping(EventType.view, { newEventType: EventType.view, addClientIdParameter: true });
|
|
1283
|
+
this.addEventTypeMapping(EventType.click, { newEventType: EventType.click, addClientIdParameter: true });
|
|
1284
|
+
this.addEventTypeMapping(EventType.custom, { newEventType: EventType.custom, addClientIdParameter: true });
|
|
1285
|
+
this.addEventTypeMapping(EventType.search, { newEventType: EventType.search, addClientIdParameter: true });
|
|
1282
1286
|
}
|
|
1283
1287
|
initRuntime(clientsOptions) {
|
|
1284
1288
|
if (hasWindow() && hasDocument()) {
|
package/dist/library.js
CHANGED
|
@@ -731,7 +731,7 @@ function sha1(bytes) {
|
|
|
731
731
|
const v5 = v35('v5', 0x50, sha1);
|
|
732
732
|
var uuidv5 = v5;
|
|
733
733
|
|
|
734
|
-
var libVersion = "2.28.
|
|
734
|
+
var libVersion = "2.28.23" ;
|
|
735
735
|
|
|
736
736
|
var getFormattedLocation = function (location) {
|
|
737
737
|
return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
|
|
@@ -83061,6 +83061,10 @@ var CoveoAnalyticsClient = (function () {
|
|
|
83061
83061
|
this.clear();
|
|
83062
83062
|
this.runtime.storage = new NullStorage();
|
|
83063
83063
|
}
|
|
83064
|
+
this.addEventTypeMapping(exports.EventType.view, { newEventType: exports.EventType.view, addClientIdParameter: true });
|
|
83065
|
+
this.addEventTypeMapping(exports.EventType.click, { newEventType: exports.EventType.click, addClientIdParameter: true });
|
|
83066
|
+
this.addEventTypeMapping(exports.EventType.custom, { newEventType: exports.EventType.custom, addClientIdParameter: true });
|
|
83067
|
+
this.addEventTypeMapping(exports.EventType.search, { newEventType: exports.EventType.search, addClientIdParameter: true });
|
|
83064
83068
|
}
|
|
83065
83069
|
Object.defineProperty(CoveoAnalyticsClient.prototype, "defaultOptions", {
|
|
83066
83070
|
get: function () {
|
|
@@ -84046,7 +84050,6 @@ var CoveoUA = (function () {
|
|
|
84046
84050
|
return _this.plugins.require(pluginKey, pluginOptions_1);
|
|
84047
84051
|
});
|
|
84048
84052
|
this.client.registerBeforeSendEventHook(function (eventType, payload) { return (__assign(__assign({}, payload), _this.params)); });
|
|
84049
|
-
this.client.addEventTypeMapping(exports.EventType.view, { newEventType: exports.EventType.view, addClientIdParameter: true });
|
|
84050
84053
|
}
|
|
84051
84054
|
else {
|
|
84052
84055
|
throw new Error("You must pass either your token or a valid object when you call 'init'");
|
package/dist/library.mjs
CHANGED
|
@@ -729,7 +729,7 @@ function sha1(bytes) {
|
|
|
729
729
|
const v5 = v35('v5', 0x50, sha1);
|
|
730
730
|
var uuidv5 = v5;
|
|
731
731
|
|
|
732
|
-
var libVersion = "2.28.
|
|
732
|
+
var libVersion = "2.28.23" ;
|
|
733
733
|
|
|
734
734
|
var getFormattedLocation = function (location) {
|
|
735
735
|
return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
|
|
@@ -83059,6 +83059,10 @@ var CoveoAnalyticsClient = (function () {
|
|
|
83059
83059
|
this.clear();
|
|
83060
83060
|
this.runtime.storage = new NullStorage();
|
|
83061
83061
|
}
|
|
83062
|
+
this.addEventTypeMapping(EventType.view, { newEventType: EventType.view, addClientIdParameter: true });
|
|
83063
|
+
this.addEventTypeMapping(EventType.click, { newEventType: EventType.click, addClientIdParameter: true });
|
|
83064
|
+
this.addEventTypeMapping(EventType.custom, { newEventType: EventType.custom, addClientIdParameter: true });
|
|
83065
|
+
this.addEventTypeMapping(EventType.search, { newEventType: EventType.search, addClientIdParameter: true });
|
|
83062
83066
|
}
|
|
83063
83067
|
Object.defineProperty(CoveoAnalyticsClient.prototype, "defaultOptions", {
|
|
83064
83068
|
get: function () {
|
|
@@ -84044,7 +84048,6 @@ var CoveoUA = (function () {
|
|
|
84044
84048
|
return _this.plugins.require(pluginKey, pluginOptions_1);
|
|
84045
84049
|
});
|
|
84046
84050
|
this.client.registerBeforeSendEventHook(function (eventType, payload) { return (__assign(__assign({}, payload), _this.params)); });
|
|
84047
|
-
this.client.addEventTypeMapping(EventType.view, { newEventType: EventType.view, addClientIdParameter: true });
|
|
84048
84051
|
}
|
|
84049
84052
|
else {
|
|
84050
84053
|
throw new Error("You must pass either your token or a valid object when you call 'init'");
|
package/dist/react-native.es.js
CHANGED
|
@@ -658,7 +658,7 @@ const addPageViewToHistory = (pageViewValue) => __awaiter(void 0, void 0, void 0
|
|
|
658
658
|
yield store.addElementAsync(historyElement);
|
|
659
659
|
});
|
|
660
660
|
|
|
661
|
-
const libVersion = "2.28.
|
|
661
|
+
const libVersion = "2.28.23" ;
|
|
662
662
|
|
|
663
663
|
const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
|
|
664
664
|
|
|
@@ -1280,6 +1280,10 @@ class CoveoAnalyticsClient {
|
|
|
1280
1280
|
this.clear();
|
|
1281
1281
|
this.runtime.storage = new NullStorage();
|
|
1282
1282
|
}
|
|
1283
|
+
this.addEventTypeMapping(EventType.view, { newEventType: EventType.view, addClientIdParameter: true });
|
|
1284
|
+
this.addEventTypeMapping(EventType.click, { newEventType: EventType.click, addClientIdParameter: true });
|
|
1285
|
+
this.addEventTypeMapping(EventType.custom, { newEventType: EventType.custom, addClientIdParameter: true });
|
|
1286
|
+
this.addEventTypeMapping(EventType.search, { newEventType: EventType.search, addClientIdParameter: true });
|
|
1283
1287
|
}
|
|
1284
1288
|
initRuntime(clientsOptions) {
|
|
1285
1289
|
if (hasWindow() && hasDocument()) {
|
package/package.json
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ClickEventRequest,
|
|
3
|
+
CustomEventRequest,
|
|
4
|
+
DefaultEventResponse,
|
|
5
|
+
EventType,
|
|
6
|
+
SearchEventRequest,
|
|
7
|
+
ViewEventRequest,
|
|
8
|
+
} from '../events';
|
|
2
9
|
import {CoveoAnalyticsClient} from './analytics';
|
|
3
10
|
import {IAnalyticsRequestOptions} from './analyticsRequestClient';
|
|
4
11
|
import {CookieAndLocalStorage, CookieStorage, NullStorage} from '../storage';
|
|
@@ -29,6 +36,24 @@ describe('Analytics', () => {
|
|
|
29
36
|
contentIdValue: 'value',
|
|
30
37
|
language: 'en',
|
|
31
38
|
};
|
|
39
|
+
const searchEvent: SearchEventRequest = {
|
|
40
|
+
searchQueryUid: 'sqUid',
|
|
41
|
+
actionCause: 'interfaceLoad',
|
|
42
|
+
queryText: 'test',
|
|
43
|
+
responseTime: 50,
|
|
44
|
+
};
|
|
45
|
+
const clickEvent: ClickEventRequest = {
|
|
46
|
+
searchQueryUid: 'sqUid',
|
|
47
|
+
actionCause: 'documentOpen',
|
|
48
|
+
documentPosition: 1,
|
|
49
|
+
documentUriHash: 'docUriHash',
|
|
50
|
+
sourceName: 'source',
|
|
51
|
+
};
|
|
52
|
+
const customEvent: CustomEventRequest = {
|
|
53
|
+
eventType: 'custom',
|
|
54
|
+
eventValue: 'value',
|
|
55
|
+
};
|
|
56
|
+
|
|
32
57
|
const eventResponse: DefaultEventResponse = {
|
|
33
58
|
visitId: 'firsttimevisiting',
|
|
34
59
|
visitorId: aVisitorId,
|
|
@@ -158,7 +183,46 @@ describe('Analytics', () => {
|
|
|
158
183
|
const [body] = getParsedBodyCalls();
|
|
159
184
|
|
|
160
185
|
expect(body).toMatchObject({
|
|
161
|
-
|
|
186
|
+
clientId: '123',
|
|
187
|
+
userAgent: navigator.userAgent,
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('should append default values to the search event', async () => {
|
|
192
|
+
mockFetchRequestForEventType(EventType.search);
|
|
193
|
+
|
|
194
|
+
await client.sendSearchEvent(searchEvent);
|
|
195
|
+
|
|
196
|
+
const [body] = getParsedBodyCalls();
|
|
197
|
+
|
|
198
|
+
expect(body).toMatchObject({
|
|
199
|
+
clientId: '123',
|
|
200
|
+
userAgent: navigator.userAgent,
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('should append default values to the click event', async () => {
|
|
205
|
+
mockFetchRequestForEventType(EventType.click);
|
|
206
|
+
|
|
207
|
+
await client.sendClickEvent(clickEvent);
|
|
208
|
+
|
|
209
|
+
const [body] = getParsedBodyCalls();
|
|
210
|
+
|
|
211
|
+
expect(body).toMatchObject({
|
|
212
|
+
clientId: '123',
|
|
213
|
+
userAgent: navigator.userAgent,
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('should append default values to the custom event', async () => {
|
|
218
|
+
mockFetchRequestForEventType(EventType.custom);
|
|
219
|
+
|
|
220
|
+
await client.sendCustomEvent(customEvent);
|
|
221
|
+
|
|
222
|
+
const [body] = getParsedBodyCalls();
|
|
223
|
+
|
|
224
|
+
expect(body).toMatchObject({
|
|
225
|
+
clientId: '123',
|
|
162
226
|
userAgent: navigator.userAgent,
|
|
163
227
|
});
|
|
164
228
|
});
|
package/src/client/analytics.ts
CHANGED
|
@@ -187,6 +187,11 @@ export class CoveoAnalyticsClient implements AnalyticsClient, VisitorIdProvider
|
|
|
187
187
|
this.clear();
|
|
188
188
|
this.runtime.storage = new NullStorage();
|
|
189
189
|
}
|
|
190
|
+
|
|
191
|
+
this.addEventTypeMapping(EventType.view, {newEventType: EventType.view, addClientIdParameter: true});
|
|
192
|
+
this.addEventTypeMapping(EventType.click, {newEventType: EventType.click, addClientIdParameter: true});
|
|
193
|
+
this.addEventTypeMapping(EventType.custom, {newEventType: EventType.custom, addClientIdParameter: true});
|
|
194
|
+
this.addEventTypeMapping(EventType.search, {newEventType: EventType.search, addClientIdParameter: true});
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
private initRuntime(clientsOptions: IAnalyticsClientOptions) {
|
|
@@ -48,7 +48,6 @@ export class CoveoUA {
|
|
|
48
48
|
...payload,
|
|
49
49
|
...this.params,
|
|
50
50
|
}));
|
|
51
|
-
this.client.addEventTypeMapping(EventType.view, {newEventType: EventType.view, addClientIdParameter: true});
|
|
52
51
|
} else {
|
|
53
52
|
throw new Error(`You must pass either your token or a valid object when you call 'init'`);
|
|
54
53
|
}
|
package/src/events.ts
CHANGED
|
@@ -71,19 +71,19 @@ export interface SearchEventRequest extends EventBaseRequest {
|
|
|
71
71
|
export interface PreparedSearchEventRequest extends Omit<SearchEventRequest, 'searchQueryUid'> {}
|
|
72
72
|
|
|
73
73
|
export interface DocumentInformation {
|
|
74
|
-
documentUri
|
|
74
|
+
documentUri?: string;
|
|
75
75
|
documentUriHash: string;
|
|
76
|
-
collectionName
|
|
76
|
+
collectionName?: string;
|
|
77
77
|
sourceName: string;
|
|
78
78
|
documentPosition: number;
|
|
79
79
|
actionCause: string;
|
|
80
80
|
|
|
81
81
|
searchQueryUid: string;
|
|
82
|
-
documentTitle
|
|
83
|
-
documentUrl
|
|
84
|
-
documentAuthor
|
|
85
|
-
queryPipeline
|
|
86
|
-
rankingModifier
|
|
82
|
+
documentTitle?: string;
|
|
83
|
+
documentUrl?: string;
|
|
84
|
+
documentAuthor?: string;
|
|
85
|
+
queryPipeline?: string;
|
|
86
|
+
rankingModifier?: string;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export interface ClickEventRequest extends EventBaseRequest, DocumentInformation {}
|
|
@@ -1390,7 +1390,7 @@ describe('InsightClient', () => {
|
|
|
1390
1390
|
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerStreamEnd, expectedMetadata);
|
|
1391
1391
|
});
|
|
1392
1392
|
|
|
1393
|
-
it
|
|
1393
|
+
it('should send proper payload for #createArticle', async () => {
|
|
1394
1394
|
const exampleCreateArticleMetadata = {
|
|
1395
1395
|
articleType: 'Knowledge__kav',
|
|
1396
1396
|
triggeredBy: 'CreateArticleButton',
|