@adobe/spacecat-shared-utils 1.35.0 → 1.35.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/CHANGELOG.md +14 -0
- package/package.json +2 -2
- package/src/formcalc.js +11 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.35.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.35.1...@adobe/spacecat-shared-utils-v1.35.2) (2025-04-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update external major (major) ([#674](https://github.com/adobe/spacecat-shared/issues/674)) ([285b37d](https://github.com/adobe/spacecat-shared/commit/285b37de9df42adb6a23694bcc699608e3b5b8fe))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-utils-v1.35.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.35.0...@adobe/spacecat-shared-utils-v1.35.1) (2025-04-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* adding forms constants at common place ([#672](https://github.com/adobe/spacecat-shared/issues/672)) ([4b8254d](https://github.com/adobe/spacecat-shared/commit/4b8254d32112e4921ae63396733101fa1f3bbed7))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-utils-v1.35.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.34.0...@adobe/spacecat-shared-utils-v1.35.0) (2025-03-06)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-utils",
|
|
3
|
-
"version": "1.35.
|
|
3
|
+
"version": "1.35.2",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"chai-as-promised": "8.0.1",
|
|
41
41
|
"husky": "9.1.7",
|
|
42
42
|
"nock": "14.0.1",
|
|
43
|
-
"sinon": "
|
|
43
|
+
"sinon": "20.0.0",
|
|
44
44
|
"sinon-chai": "4.0.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
package/src/formcalc.js
CHANGED
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
const DAILY_PAGEVIEW_THRESHOLD = 200;
|
|
14
|
-
const CR_THRESHOLD_RATIO = 0.
|
|
14
|
+
const CR_THRESHOLD_RATIO = 0.3;
|
|
15
|
+
// audit interval
|
|
16
|
+
const INTERVAL = 15;
|
|
15
17
|
const MOBILE = 'mobile';
|
|
16
18
|
const DESKTOP = 'desktop';
|
|
17
19
|
|
|
@@ -60,8 +62,8 @@ function aggregateFormVitalsByDevice(formVitalsCollection) {
|
|
|
60
62
|
return resultMap;
|
|
61
63
|
}
|
|
62
64
|
|
|
63
|
-
function hasHighPageViews(
|
|
64
|
-
return pageViews > DAILY_PAGEVIEW_THRESHOLD *
|
|
65
|
+
function hasHighPageViews(pageViews) {
|
|
66
|
+
return pageViews > DAILY_PAGEVIEW_THRESHOLD * INTERVAL;
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
function hasLowerConversionRate(formSubmit, formViews) {
|
|
@@ -84,7 +86,7 @@ function hasHighPageViewLowFormCtr(ctaPageViews, ctaClicks, ctaPageTotalClicks,
|
|
|
84
86
|
* @param {*} formVitalsCollection - form vitals collection
|
|
85
87
|
* @returns {Array} - urls with high form views and low conversion rate
|
|
86
88
|
*/
|
|
87
|
-
export function getHighFormViewsLowConversionMetrics(formVitalsCollection
|
|
89
|
+
export function getHighFormViewsLowConversionMetrics(formVitalsCollection) {
|
|
88
90
|
const resultMap = aggregateFormVitalsByDevice(formVitalsCollection);
|
|
89
91
|
const urls = [];
|
|
90
92
|
resultMap.forEach((metrics, url) => {
|
|
@@ -94,7 +96,7 @@ export function getHighFormViewsLowConversionMetrics(formVitalsCollection, inter
|
|
|
94
96
|
const formEngagement = metrics.formengagement.total;
|
|
95
97
|
const formSubmit = metrics.formsubmit.total || formEngagement;
|
|
96
98
|
|
|
97
|
-
if (hasHighPageViews(
|
|
99
|
+
if (hasHighPageViews(pageViews) && hasLowerConversionRate(formSubmit, formViews)) {
|
|
98
100
|
urls.push({
|
|
99
101
|
url,
|
|
100
102
|
pageViews,
|
|
@@ -113,7 +115,7 @@ export function getHighFormViewsLowConversionMetrics(formVitalsCollection, inter
|
|
|
113
115
|
* @param resultMap
|
|
114
116
|
* @returns {*[]}
|
|
115
117
|
*/
|
|
116
|
-
export function getHighPageViewsLowFormViewsMetrics(formVitalsCollection
|
|
118
|
+
export function getHighPageViewsLowFormViewsMetrics(formVitalsCollection) {
|
|
117
119
|
const urls = [];
|
|
118
120
|
const resultMap = aggregateFormVitalsByDevice(formVitalsCollection);
|
|
119
121
|
resultMap.forEach((metrics, url) => {
|
|
@@ -121,7 +123,7 @@ export function getHighPageViewsLowFormViewsMetrics(formVitalsCollection, interv
|
|
|
121
123
|
const { total: formViews } = metrics.formview;
|
|
122
124
|
const { total: formEngagement } = metrics.formengagement;
|
|
123
125
|
|
|
124
|
-
if (hasHighPageViews(
|
|
126
|
+
if (hasHighPageViews(pageViews) && hasLowFormViews(pageViews, formViews)) {
|
|
125
127
|
urls.push({
|
|
126
128
|
url,
|
|
127
129
|
pageViews,
|
|
@@ -139,7 +141,7 @@ export function getHighPageViewsLowFormViewsMetrics(formVitalsCollection, interv
|
|
|
139
141
|
* @param formVitalsByDevice
|
|
140
142
|
* @returns {*[]}
|
|
141
143
|
*/
|
|
142
|
-
export function getHighPageViewsLowFormCtrMetrics(formVitalsCollection
|
|
144
|
+
export function getHighPageViewsLowFormCtrMetrics(formVitalsCollection) {
|
|
143
145
|
const urls = [];
|
|
144
146
|
const formVitalsByDevice = aggregateFormVitalsByDevice(formVitalsCollection);
|
|
145
147
|
formVitalsCollection.forEach((entry) => {
|
|
@@ -176,7 +178,7 @@ export function getHighPageViewsLowFormCtrMetrics(formVitalsCollection, interval
|
|
|
176
178
|
const f = Object.values(pageview).reduce((sum, val) => sum + val, 0);
|
|
177
179
|
|
|
178
180
|
// Evaluate conditions and add URL to the result if all are met
|
|
179
|
-
if (hasHighPageViews(
|
|
181
|
+
if (hasHighPageViews(x) && hasHighPageViewLowFormCtr(x, y.clicks, z, f)) {
|
|
180
182
|
const deviceData = formVitalsByDevice.get(entry.url);
|
|
181
183
|
if (deviceData != null) {
|
|
182
184
|
urls.push({
|