Skip to content
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

fix: Correct CTR calculation in InsightStats component #246

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

lidarbtc
Copy link
Contributor

Issue at #233

The CTR calculation was incorrectly summing up individual CTR values, resulting in inflated percentages. Now calculates CTR properly by dividing total clicks by total impressions.

Previous Implementation:

  • CTR was calculated by adding up individual CTR percentages
  • This resulted in artificially high CTR values
  • For example: [10%, 15%, 20%] => 45% (incorrect)

New Implementation:

  • CTR is now calculated using (total clicks / total impressions) * 100
  • This provides the actual click-through rate across all data
  • For example: (50 clicks / 1000 impressions) * 100 = 5% (correct)

This fix ensures accurate CTR reporting in the analytics dashboard.

Changes:

  • Removed CTR accumulation from reducer
  • Added proper CTR calculation based on total clicks and impressions
  • Maintains better statistical accuracy in reporting

The CTR calculation was incorrectly summing up individual CTR values,
resulting in inflated percentages. Now calculates CTR properly by
dividing total clicks by total impressions.

Previous Implementation:
- CTR was calculated by adding up individual CTR percentages
- This resulted in artificially high CTR values
- For example: [10%, 15%, 20%] => 45% (incorrect)

New Implementation:
- CTR is now calculated using (total clicks / total impressions) * 100
- This provides the actual click-through rate across all data
- For example: (50 clicks / 1000 impressions) * 100 = 5% (correct)

This fix ensures accurate CTR reporting in the analytics dashboard.

Changes:
- Removed CTR accumulation from reducer
- Added proper CTR calculation based on total clicks and impressions
- Maintains better statistical accuracy in reporting
@towfiqi towfiqi merged commit 432fc61 into towfiqi:main Nov 7, 2024
1 check passed
@towfiqi
Copy link
Owner

towfiqi commented Nov 7, 2024

Great Contribution! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants