From 9f3607e4725a6750668312ad9d99b140d0869406 Mon Sep 17 00:00:00 2001 From: ekremney Date: Thu, 29 Aug 2024 16:41:22 +0200 Subject: [PATCH] feat: high bounce rate and low ctr opportunities --- package-lock.json | 6 +++--- package.json | 2 +- src/opportunities/opportunities.js | 11 ++++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9f59f6c4..0b28f5dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@adobe/spacecat-shared-data-access": "1.43.3", "@adobe/spacecat-shared-google-client": "1.2.2", "@adobe/spacecat-shared-http-utils": "1.6.8", - "@adobe/spacecat-shared-rum-api-client": "2.8.0", + "@adobe/spacecat-shared-rum-api-client": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?9b54c84d774a490e107c56c51db8d7a38562c8c9", "@adobe/spacecat-shared-rum-api-client-v1": "npm:@adobe/spacecat-shared-rum-api-client@1.8.4", "@adobe/spacecat-shared-utils": "1.19.6", "@aws-sdk/client-lambda": "3.637.0", @@ -5549,8 +5549,8 @@ }, "node_modules/@adobe/spacecat-shared-rum-api-client": { "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@adobe/spacecat-shared-rum-api-client/-/spacecat-shared-rum-api-client-2.8.0.tgz", - "integrity": "sha512-CNtQy6nYWErCJgG2YyFxej8hVBnoS8PItPNLvHRjEYXFpU9QhuoS+bSxcmDRbwRxMbHpAgK3XclddP6DFrKjDQ==", + "resolved": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?9b54c84d774a490e107c56c51db8d7a38562c8c9", + "integrity": "sha512-Q7jqs9u+pqaijp1ygQN3zKep8EZj8hlbGAMf+QhJHyRE9KzoKTb6INnq7sPEIP8FclmkmkuQ/sXO2UCUuPeiCA==", "dependencies": { "@adobe/fetch": "4.1.8", "@adobe/helix-shared-wrap": "2.0.2", diff --git a/package.json b/package.json index a8d3fd04..0a3927ee 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "@adobe/spacecat-shared-data-access": "1.43.3", "@adobe/spacecat-shared-google-client": "1.2.2", "@adobe/spacecat-shared-http-utils": "1.6.8", - "@adobe/spacecat-shared-rum-api-client": "2.8.0", + "@adobe/spacecat-shared-rum-api-client": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?9b54c84d774a490e107c56c51db8d7a38562c8c9", "@adobe/spacecat-shared-rum-api-client-v1": "npm:@adobe/spacecat-shared-rum-api-client@1.8.4", "@aws-sdk/client-lambda": "3.637.0", "@aws-sdk/credential-provider-node": "3.637.0", diff --git a/src/opportunities/opportunities.js b/src/opportunities/opportunities.js index 4eff2b43..c57d456b 100644 --- a/src/opportunities/opportunities.js +++ b/src/opportunities/opportunities.js @@ -16,6 +16,11 @@ import { AuditBuilder } from '../common/audit-builder.js'; import { getRUMDomainkey } from '../support/utils.js'; const DAYS = 30; +const OPPTY_QUERIES = [ + 'exp-opportunity/rage-click', + 'exp-opportunity/high-inorganic-high-bounce-rate', + 'exp-opportunity/high-organic-low-bounce-rate', +]; let log = console; @@ -40,13 +45,13 @@ export async function opportunitiesHandler(auditUrl, context, site) { interval: DAYS, granularity: 'hourly', }; - const experimentationHandlers = ['rageclick']; - const queryResults = await rumAPIClient.queryMulti(experimentationHandlers, options); + + const queryResults = await rumAPIClient.queryMulti(OPPTY_QUERIES, options); const auditData = { experimentationOpportunities: [], }; for (const queryResult of Object.keys(queryResults)) { - if (experimentationHandlers.includes(queryResult)) { + if (OPPTY_QUERIES.includes(queryResult)) { auditData.experimentationOpportunities.push(...queryResults[queryResult]); } }