-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Pages with steady decline of conversion #293
base: main
Are you sure you want to change the base?
Conversation
This PR will trigger a minor release when merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont have a way to calculate conversions accurately. Maybe we should change Pages with steady decline of conversion rate
to Pages with steady decline of click-through-rate
. What do you think @ramboz ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename the file to reflect the exact use case you handle. we'll likely have many opportunity implementations down the road
// Initialize a Set to hold the unique selectors for this bundle | ||
let uniqueSelectors = new Set(); | ||
const uniqueSelectors = new Set(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move the declaration outside of the loop so you re-use the same variable and avoid allocation of hundreds of different ones.
let uniqueSelectors;
for (const bundle of bundles) {
// Initialize a Set to hold the unique selectors for this bundle
uniqueSelectors = new Set();
let uniqueSelectors = new Set(); | ||
const uniqueSelectors = new Set(); | ||
|
||
let totalClicks = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, I'd move the declaration outside of the loop
@@ -83,13 +91,13 @@ function handler(bundles) { | |||
|
|||
// Iterate over the unique selectors and increment their count in the global selectors object | |||
for (const source of uniqueSelectors) { | |||
globalSelectors[source] = (globalSelectors[source] || 0) + 1; | |||
const count = uniqueSelectors[source] || 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again here as well
Please ensure your pull request adheres to the following guidelines:
Related Issues
Thanks for contributing!