-
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
Draft
Dereje24
wants to merge
44
commits into
main
Choose a base branch
from
SITES-22537
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
c42f301
feat: Pages with steady decline of conversion
7098e37
fix lint issues
a99194f
feat: Pages with steady decline of conversion
0ea09d1
merge main to branch
e64d279
WIP
1db3702
merging main to branch
1e86711
feat: Pages with steady decline of conversion
faab213
Merge branch 'main' into SITES-22537
Dereje24 b8c547f
SITES-22537 [oppty] Pages with steady decline of CTR
5627ed5
SITES-22537 [oppty] Pages with steady decline of CTR
7bd17ff
SITES-22537 [oppty] Pages with steady decline of CTR
057efc4
SITES-22537 [oppty] Pages with steady decline of CTR
5d6aada
SITES-22537 [oppty] Pages with steady decline of CTR
2f2c53f
SITES-22537 [oppty] Pages with steady decline of CTR
86f5aed
SITES-22537 [oppty] Pages with steady decline of CTR
6c212b4
SITES-22537 [oppty] Pages with steady decline of CTR
61d200e
SITES-22537 [oppty] Pages with steady decline of CTR
3edcd69
SITES-22537 [oppty] Pages with steady decline of CTR
c7e18b6
SITES-22537 [oppty] Pages with steady decline of CTR
f7624c1
SITES-22537 [oppty] Pages with steady decline of CTR
30358ed
SITES-22537 [oppty] Pages with steady decline of CTR
3ba9258
SITES-22537 [oppty] Pages with steady decline of CTR
51f2fdd
SITES-22537 [oppty] Pages with steady decline of CTR
d16f567
SITES-22537 [oppty] Pages with steady decline of CTR
07ff401
SITES-22537 [oppty] Pages with steady decline of CTR
92156f5
SITES-22537 [oppty] Pages with steady decline of CTR
b9384aa
SITES-22537 [oppty] Pages with steady decline of CTR
aa877bf
SITES-22537 [oppty] Pages with steady decline of CTR
311ff29
SITES-22537 [oppty] Pages with steady decline of CTR
baceb4f
SITES-22537 [oppty] Pages with steady decline of CTR
f56cecb
SITES-22537 [oppty] Pages with steady decline of CTR
5bec5aa
SITES-22537 [oppty] Pages with steady decline of CTR
9cb173d
SITES-22537 [oppty] Pages with steady decline of CTR
d5e5853
SITES-22537 [oppty] Pages with steady decline of CTR
88083f7
SITES-22537 [oppty] Pages with steady decline of CTR
69a926d
SITES-22537 [oppty] Pages with steady decline of CTR
11e4844
SITES-22537 [oppty] Pages with steady decline of CTR
fb7369b
SITES-22537 [oppty] Pages with steady decline of CTR
a52afa7
SITES-22537 [oppty] Pages with steady decline of CTR
ff4c4e5
SITES-22537 [oppty] Pages with steady decline of CTR
0f1a7ab
SITES-22537 [oppty] Pages with steady decline of CTR
ebf9175
SITES-22537 [oppty] Pages with steady decline of CTR
9af5727
fix filtering threshold
45a0fb3
refactor oppty
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,11 +69,19 @@ function handler(bundles) { | |
// data[bundle.url][weekKey].metrics.push({ selector: source, ctr }); | ||
// } | ||
// Initialize an object to hold the selectors and their counts | ||
let globalSelectors = {}; | ||
const globalSelectors = {}; | ||
|
||
for (const bundle of bundles) { | ||
// Initialize a Set to hold the unique selectors for this bundle | ||
let uniqueSelectors = new Set(); | ||
const uniqueSelectors = new Set(); | ||
|
||
let totalClicks = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, I'd move the declaration outside of the loop |
||
for (const event of bundle.events) { | ||
if (event.checkpoint === 'click') { | ||
uniqueSelectors.add(event.source); | ||
totalClicks++; | ||
} | ||
} | ||
|
||
for (const event of bundle.events) { | ||
if (event.checkpoint === 'click') { | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Again here as well |
||
if (count / totalClicks >= 0.1) { | ||
globalSelectors[source] = count + 1; | ||
} | ||
} | ||
} | ||
|
||
// Now, globalSelectors contains the count of each selector across all bundles | ||
// Convert the globalSelectors object to an array of objects and add it to the metrics array | ||
// data[bundle.url][weekKey].metrics = Object.entries(globalSelectors).map(([selector, count]) => ({ selector, count })); | ||
data[bundle.url][weekKey].metrics = Object.entries(globalSelectors).map(([selector, count]) => { | ||
const ctr = (count / data[bundle.url][weekKey].pageViews) * 100; | ||
return { selector, ctr }; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.