@constructor-io/constructorio-node 4.9.1 → 4.9.2
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/package.json +1 -1
- package/src/modules/tracker.js +12 -0
- package/src/types/tracker.d.ts +2 -0
package/package.json
CHANGED
package/src/modules/tracker.js
CHANGED
|
@@ -278,6 +278,7 @@ class Tracker {
|
|
|
278
278
|
* @param {string} parameters.url - Current page URL
|
|
279
279
|
* @param {string} [parameters.variationId] - Product item variation unique identifier
|
|
280
280
|
* @param {object} [parameters.analyticsTags] - Pass additional analytics data
|
|
281
|
+
* @param {string} [parameters.section] - Index section
|
|
281
282
|
* @param {object} userParameters - Parameters relevant to the user request
|
|
282
283
|
* @param {number} userParameters.sessionId - Session ID, utilized to personalize results
|
|
283
284
|
* @param {string} userParameters.clientId - Client ID, utilized to personalize results
|
|
@@ -319,6 +320,7 @@ class Tracker {
|
|
|
319
320
|
variationId = variation_id,
|
|
320
321
|
url,
|
|
321
322
|
analyticsTags,
|
|
323
|
+
section,
|
|
322
324
|
} = parameters;
|
|
323
325
|
|
|
324
326
|
// Ensure support for both item_name and name as parameters
|
|
@@ -343,6 +345,10 @@ class Tracker {
|
|
|
343
345
|
bodyParams.analytics_tags = analyticsTags;
|
|
344
346
|
}
|
|
345
347
|
|
|
348
|
+
if (section) {
|
|
349
|
+
bodyParams.section = section;
|
|
350
|
+
}
|
|
351
|
+
|
|
346
352
|
const requestUrl = `${requestPath}${applyParamsAsString({}, userParameters, this.options)}`;
|
|
347
353
|
const requestMethod = 'POST';
|
|
348
354
|
const requestBody = applyParams(bodyParams, userParameters, { ...this.options, requestMethod });
|
|
@@ -558,6 +564,7 @@ class Tracker {
|
|
|
558
564
|
* @param {object} parameters - Additional parameters to be sent with request
|
|
559
565
|
* @param {number} parameters.numResults - Total number of results
|
|
560
566
|
* @param {string[]} parameters.itemIds - List of product item unique identifiers in search results listing
|
|
567
|
+
* @param {string} [parameters.section] - Index section
|
|
561
568
|
* @param {object} userParameters - Parameters relevant to the user request
|
|
562
569
|
* @param {number} userParameters.sessionId - Session ID, utilized to personalize results
|
|
563
570
|
* @param {string} userParameters.clientId - Client ID, utilized to personalize results
|
|
@@ -603,6 +610,7 @@ class Tracker {
|
|
|
603
610
|
customerIds = customer_ids,
|
|
604
611
|
item_ids,
|
|
605
612
|
itemIds = item_ids,
|
|
613
|
+
section,
|
|
606
614
|
} = parameters;
|
|
607
615
|
let customerIDs;
|
|
608
616
|
|
|
@@ -621,6 +629,10 @@ class Tracker {
|
|
|
621
629
|
queryParams.customer_ids = customerIDs.slice(0, 100).join(',');
|
|
622
630
|
}
|
|
623
631
|
|
|
632
|
+
if (section) {
|
|
633
|
+
queryParams.section = section;
|
|
634
|
+
}
|
|
635
|
+
|
|
624
636
|
const requestUrl = `${url}${applyParamsAsString(queryParams, userParameters, this.options)}`;
|
|
625
637
|
|
|
626
638
|
send.call(
|
package/src/types/tracker.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare class Tracker {
|
|
|
40
40
|
url: string;
|
|
41
41
|
variationId?: string;
|
|
42
42
|
analyticsTags?: Record<string, string>;
|
|
43
|
+
section?: string;
|
|
43
44
|
},
|
|
44
45
|
userParameters?: TrackerUserParameters,
|
|
45
46
|
networkParameters?: NetworkParameters
|
|
@@ -74,6 +75,7 @@ declare class Tracker {
|
|
|
74
75
|
parameters: {
|
|
75
76
|
numResults: number;
|
|
76
77
|
itemIds: string[];
|
|
78
|
+
section?: string;
|
|
77
79
|
},
|
|
78
80
|
userParameters?: TrackerUserParameters,
|
|
79
81
|
networkParameters?: NetworkParameters
|