coveo.analytics 2.18.55 → 2.18.62

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.
@@ -21,6 +21,8 @@ export interface EventBaseRequest {
21
21
  userDisplayName?: any;
22
22
  splitTestRunName?: string;
23
23
  splitTestRunVersion?: string;
24
+ clientId?: string;
25
+ originContext?: string;
24
26
  originLevel1?: string;
25
27
  originLevel2?: string;
26
28
  originLevel3?: string;
@@ -6,6 +6,7 @@ export interface SearchPageClientProvider {
6
6
  getSearchEventRequestPayload: () => Omit<SearchEventRequest, 'actionCause' | 'searchQueryUid'>;
7
7
  getSearchUID: () => string;
8
8
  getPipeline: () => string;
9
+ getOriginContext: () => string;
9
10
  getOriginLevel1: () => string;
10
11
  getOriginLevel2: () => string;
11
12
  getOriginLevel3: () => string;
@@ -90,4 +91,5 @@ export declare class CoveoSearchPageClient {
90
91
  private getBaseCustomEventRequest;
91
92
  private getBaseEventRequest;
92
93
  private getOrigins;
94
+ private getClientId;
93
95
  }
@@ -1423,40 +1423,60 @@ class CoveoSearchPageClient {
1423
1423
  return this.logSearchEvent(SearchPageEvents.noResultsBack);
1424
1424
  }
1425
1425
  logCustomEvent(event, metadata) {
1426
- const customData = Object.assign(Object.assign({}, this.provider.getBaseMetadata()), metadata);
1427
- const payload = Object.assign(Object.assign({}, this.getBaseCustomEventRequest(customData)), { eventType: CustomEventsTypes[event], eventValue: event });
1428
- return this.coveoAnalyticsClient.sendCustomEvent(payload);
1426
+ return __awaiter(this, void 0, void 0, function* () {
1427
+ const customData = Object.assign(Object.assign({}, this.provider.getBaseMetadata()), metadata);
1428
+ const payload = Object.assign(Object.assign({}, (yield this.getBaseCustomEventRequest(customData))), { eventType: CustomEventsTypes[event], eventValue: event });
1429
+ return this.coveoAnalyticsClient.sendCustomEvent(payload);
1430
+ });
1429
1431
  }
1430
1432
  logCustomEventWithType(eventValue, eventType, metadata) {
1431
- const customData = Object.assign(Object.assign({}, this.provider.getBaseMetadata()), metadata);
1432
- const payload = Object.assign(Object.assign({}, this.getBaseCustomEventRequest(customData)), { eventType,
1433
- eventValue });
1434
- return this.coveoAnalyticsClient.sendCustomEvent(payload);
1433
+ return __awaiter(this, void 0, void 0, function* () {
1434
+ const customData = Object.assign(Object.assign({}, this.provider.getBaseMetadata()), metadata);
1435
+ const payload = Object.assign(Object.assign({}, (yield this.getBaseCustomEventRequest(customData))), { eventType,
1436
+ eventValue });
1437
+ return this.coveoAnalyticsClient.sendCustomEvent(payload);
1438
+ });
1435
1439
  }
1436
1440
  logSearchEvent(event, metadata) {
1437
- return this.coveoAnalyticsClient.sendSearchEvent(this.getBaseSearchEventRequest(event, metadata));
1441
+ return __awaiter(this, void 0, void 0, function* () {
1442
+ return this.coveoAnalyticsClient.sendSearchEvent(yield this.getBaseSearchEventRequest(event, metadata));
1443
+ });
1438
1444
  }
1439
1445
  logClickEvent(event, info, identifier, metadata) {
1440
- const payload = Object.assign(Object.assign(Object.assign({}, info), this.getBaseEventRequest(Object.assign(Object.assign({}, identifier), metadata))), { searchQueryUid: this.provider.getSearchUID(), queryPipeline: this.provider.getPipeline(), actionCause: event });
1441
- return this.coveoAnalyticsClient.sendClickEvent(payload);
1446
+ return __awaiter(this, void 0, void 0, function* () {
1447
+ const payload = Object.assign(Object.assign(Object.assign({}, info), (yield this.getBaseEventRequest(Object.assign(Object.assign({}, identifier), metadata)))), { searchQueryUid: this.provider.getSearchUID(), queryPipeline: this.provider.getPipeline(), actionCause: event });
1448
+ return this.coveoAnalyticsClient.sendClickEvent(payload);
1449
+ });
1442
1450
  }
1443
1451
  getBaseSearchEventRequest(event, metadata) {
1444
- return Object.assign(Object.assign(Object.assign({}, this.getBaseEventRequest(metadata)), this.provider.getSearchEventRequestPayload()), { searchQueryUid: this.provider.getSearchUID(), queryPipeline: this.provider.getPipeline(), actionCause: event });
1452
+ return __awaiter(this, void 0, void 0, function* () {
1453
+ return Object.assign(Object.assign(Object.assign({}, (yield this.getBaseEventRequest(metadata))), this.provider.getSearchEventRequestPayload()), { searchQueryUid: this.provider.getSearchUID(), queryPipeline: this.provider.getPipeline(), actionCause: event });
1454
+ });
1445
1455
  }
1446
1456
  getBaseCustomEventRequest(metadata) {
1447
- return Object.assign(Object.assign({}, this.getBaseEventRequest(metadata)), { lastSearchQueryUid: this.provider.getSearchUID() });
1457
+ return __awaiter(this, void 0, void 0, function* () {
1458
+ return Object.assign(Object.assign({}, (yield this.getBaseEventRequest(metadata))), { lastSearchQueryUid: this.provider.getSearchUID() });
1459
+ });
1448
1460
  }
1449
1461
  getBaseEventRequest(metadata) {
1450
- const customData = Object.assign(Object.assign({}, this.provider.getBaseMetadata()), metadata);
1451
- return Object.assign(Object.assign({}, this.getOrigins()), { customData, language: this.provider.getLanguage(), facetState: this.provider.getFacetState ? this.provider.getFacetState() : [], anonymous: this.provider.getIsAnonymous() });
1462
+ return __awaiter(this, void 0, void 0, function* () {
1463
+ const customData = Object.assign(Object.assign({}, this.provider.getBaseMetadata()), metadata);
1464
+ return Object.assign(Object.assign({}, this.getOrigins()), { customData, language: this.provider.getLanguage(), facetState: this.provider.getFacetState ? this.provider.getFacetState() : [], anonymous: this.provider.getIsAnonymous(), clientId: yield this.getClientId() });
1465
+ });
1452
1466
  }
1453
1467
  getOrigins() {
1454
1468
  return {
1469
+ originContext: this.provider.getOriginContext(),
1455
1470
  originLevel1: this.provider.getOriginLevel1(),
1456
1471
  originLevel2: this.provider.getOriginLevel2(),
1457
1472
  originLevel3: this.provider.getOriginLevel3(),
1458
1473
  };
1459
1474
  }
1475
+ getClientId() {
1476
+ return this.coveoAnalyticsClient instanceof CoveoAnalyticsClient
1477
+ ? this.coveoAnalyticsClient.getCurrentVisitorId()
1478
+ : undefined;
1479
+ }
1460
1480
  }
1461
1481
 
1462
1482
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;