Skip to content

Add tracker server module#227

Merged
stordahl merged 7 commits intomainfrom
stordahl/tracker-serverside
Oct 6, 2025
Merged

Add tracker server module#227
stordahl merged 7 commits intomainfrom
stordahl/tracker-serverside

Conversation

@stordahl
Copy link
Copy Markdown
Collaborator

@stordahl stordahl commented Sep 26, 2025

Overview

Currently, Counterscale requires JavaScript to run in the browser to collect page view events. However, some users may want to implement server-side analytics to, for example, reduce the amount of JS running on the page. The current tracker relies on DOM objects like document, navigator, and location making it not compatible with most server side runtimes. Rather than refactor the existing tracker, we just add a new modules under @counterscale/tracker/server to expose a server compatible version of the tracker.

Changes by Package

@counterscale/cli

No changes

@counterscale/server

No changes

@counterscale/tracker

  • Adds server module
  • Refactors some existing types/functions into /src/shared for use in both the browser and server modules

Other Changes

Additional Notes

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 26, 2025

Codecov Report

❌ Patch coverage is 95.25424% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.02%. Comparing base (66c8505) to head (883ef24).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
packages/tracker/vitest.integration.config.ts 0.00% 12 Missing and 1 partial ⚠️
packages/tracker/src/lib/track.ts 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #227      +/-   ##
==========================================
+ Coverage   80.34%   81.02%   +0.67%     
==========================================
  Files          56       65       +9     
  Lines        4406     4647     +241     
  Branches      580      653      +73     
==========================================
+ Hits         3540     3765     +225     
- Misses        857      872      +15     
- Partials        9       10       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stordahl stordahl force-pushed the stordahl/tracker-serverside branch from 34d3dd3 to 015fddb Compare October 1, 2025 01:04
@stordahl stordahl marked this pull request as ready for review October 1, 2025 01:34
@stordahl stordahl merged commit 5aaf1bd into main Oct 6, 2025
3 checks passed
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.

1 participant