Skip to content

fix: correct pageviews extraction #2420

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

Merged
merged 1 commit into from
May 31, 2025

Conversation

kungfux
Copy link
Collaborator

@kungfux kungfux commented May 27, 2025

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Description

Problem: NaN appears for pageview when over 1K pageview's value is returned by GoatCounter as JSON value contains formatted value like 1,234 that is expected according to documentation.

Solution: Remove any non-digit symbols from the value before trying to parse it.

Additional context

Reported by @SoumyaK4, discussed and tested under #2412.

Copy link
Owner

@cotes2020 cotes2020 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. GoatCounter seems to use a space or comma as the thousands separator.

$ curl https://chirpy-demo.goatcounter.com/counter/%2Fposts%2Fgetting-started.json
{
  "count": "34 640",
  "count_unique": "34 640"
}

@cotes2020 cotes2020 merged commit c706799 into cotes2020:master May 31, 2025
6 checks passed
@kungfux kungfux deleted the fix/pageviews-over-1k branch June 1, 2025 08:12
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