@constructor-io/constructorio-node 4.6.7 → 4.6.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/package.json +1 -1
- package/src/modules/tracker.js +7 -0
- package/src/types/tracker.d.ts +1 -0
package/package.json
CHANGED
package/src/modules/tracker.js
CHANGED
|
@@ -975,6 +975,7 @@ class Tracker {
|
|
|
975
975
|
* @param {string} parameters.url - Current page URL
|
|
976
976
|
* @param {string} parameters.podId - Pod identifier
|
|
977
977
|
* @param {number} parameters.numResultsViewed - Number of results viewed
|
|
978
|
+
* @param {object[]} [parameters.items] - List of Product Item objects
|
|
978
979
|
* @param {number} [parameters.resultCount] - Total number of results
|
|
979
980
|
* @param {number} [parameters.resultPage] - Page number of results
|
|
980
981
|
* @param {string} [parameters.resultId] - Recommendation result identifier (returned in response from Constructor)
|
|
@@ -997,6 +998,7 @@ class Tracker {
|
|
|
997
998
|
* @example
|
|
998
999
|
* constructorio.tracker.trackRecommendationView(
|
|
999
1000
|
* {
|
|
1001
|
+
* items: [{ itemId: 'KMH876' }, { itemId: 'KMH140' }],
|
|
1000
1002
|
* resultCount: 22,
|
|
1001
1003
|
* resultPage: 2,
|
|
1002
1004
|
* resultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
|
|
@@ -1031,6 +1033,7 @@ class Tracker {
|
|
|
1031
1033
|
podId = pod_id,
|
|
1032
1034
|
num_results_viewed,
|
|
1033
1035
|
numResultsViewed = num_results_viewed,
|
|
1036
|
+
items,
|
|
1034
1037
|
} = parameters;
|
|
1035
1038
|
|
|
1036
1039
|
if (!helpers.isNil(resultCount)) {
|
|
@@ -1063,6 +1066,10 @@ class Tracker {
|
|
|
1063
1066
|
bodyParams.num_results_viewed = numResultsViewed;
|
|
1064
1067
|
}
|
|
1065
1068
|
|
|
1069
|
+
if (items && Array.isArray(items)) {
|
|
1070
|
+
bodyParams.items = items.slice(0, 100).map((item) => helpers.toSnakeCaseKeys(item, false));
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1066
1073
|
const requestUrl = `${requestPath}${applyParamsAsString({}, userParameters, this.options)}`;
|
|
1067
1074
|
const requestMethod = 'POST';
|
|
1068
1075
|
const requestBody = applyParams(bodyParams, userParameters, { ...this.options, requestMethod });
|