Skip to content

Commit

Permalink
feat: high bounce rate and low ctr opportunities
Browse files Browse the repository at this point in the history
  • Loading branch information
ekremney committed Aug 29, 2024
1 parent 9f3607e commit 61bf4b5
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?9b54c84d774a490e107c56c51db8d7a38562c8c9",
"@adobe/spacecat-shared-rum-api-client": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-rum-api-client?0ffe830c28130f8ad8050a5c8ac0226ccd54e3b0",
"@adobe/spacecat-shared-rum-api-client-v1": "npm:@adobe/[email protected]",
"@aws-sdk/client-lambda": "3.637.0",
"@aws-sdk/credential-provider-node": "3.637.0",
Expand Down
6 changes: 3 additions & 3 deletions src/opportunities/opportunities.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ 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',
'rageclick',
'high-inorganic-high-bounce-rate',
'high-organic-low-ctr',
];

let log = console;
Expand Down
23 changes: 13 additions & 10 deletions test/audits/opportunities.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,20 @@ describe('Opportunities Tests', () => {
};
const auditData = await opportunitiesHandler(url, context, site);

expect(context.rumApiClient.queryMulti).calledWith(
['rageclick'],
{
domain: 'https://abc.com',
domainkey: 'abc_dummy_key',
interval: 30,
granularity: 'hourly',
},
);
const expected = Object.values(opportunitiesData).flatMap((data) => data);

expect(context.rumApiClient.queryMulti).calledWith([
'rageclick',
'high-inorganic-high-bounce-rate',
'high-organic-low-ctr',
], {
domain: 'https://abc.com',
domainkey: 'abc_dummy_key',
interval: 30,
granularity: 'hourly',
});
expect(
auditData.auditResult.experimentationOpportunities,
).to.deep.equal(opportunitiesData.rageclick);
).to.deep.equal(expected);
});
});
22 changes: 21 additions & 1 deletion test/fixtures/opportunitiesdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,25 @@
}
]
}
]
],
"high-organic-low-ctr": [{
"type": "high-organic-low-ctr",
"page": "https://abc.com/abc-adoption/account",
"screenshot": "",
"trackedPageKPIName": "Click Through Rate",
"trackedPageKPIValue": "0.14",
"pageViews": 2145,
"samples": 123,
"metrics": []
}],
"high-inorganic-high-bounce-rate": [{
"type": "high-inorganic-high-bounce-rate",
"page": "https://abc.com/abc-adoption/pricing",
"screenshot": "",
"trackedPageKPIName": "Bounce Rate",
"trackedPageKPIValue": 0.76,
"pageViews": 8839,
"samples": 89,
"metrics": []
}]
}

0 comments on commit 61bf4b5

Please sign in to comment.