Skip to content

Allow tracker script name configuration via secret#234

Merged
stordahl merged 8 commits intomainfrom
stordahl/config-script-name
Nov 19, 2025
Merged

Allow tracker script name configuration via secret#234
stordahl merged 8 commits intomainfrom
stordahl/config-script-name

Conversation

@stordahl
Copy link
Collaborator

@stordahl stordahl commented Oct 29, 2025

Overview

Closes #136 by allowing the tracker script to have a custom name by setting CF_TRACKER_NAME. To allow this, we also add an env cli command to enable updating counterscale related secrets.

Changes by Package

@counterscale/cli

  • Adds a new command; env that can be used to update counterscale secrets/env variable async from deployments.
    • To start, users can use this command to update their API token and configure the tracker script name

@counterscale/server

  • Creates an assets binding to enable requesting assets directly
  • Adds a dynamic route that serves the tracker script from the assets binding, using the custom name if configured. The script still defaults to tracker.js for backward compat
    • Noting that I've done some initial testing and this change doesn't have a meaningful impact on tracker script loading perf

@counterscale/tracker

Other Changes

Additional Notes

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 69.91150% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.58%. Comparing base (15480a7) to head (c3bd5b2).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
packages/cli/src/lib/ui.ts 46.15% 20 Missing and 8 partials ⚠️
packages/cli/src/commands/install.ts 0.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #234      +/-   ##
==========================================
- Coverage   85.16%   84.58%   -0.59%     
==========================================
  Files          53       55       +2     
  Lines        1773     1855      +82     
  Branches      495      517      +22     
==========================================
+ Hits         1510     1569      +59     
- Misses        235      252      +17     
- Partials       28       34       +6     

☔ 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 marked this pull request as ready for review November 18, 2025 13:54
@stordahl stordahl merged commit 1f92237 into main Nov 19, 2025
3 checks passed
@stordahl stordahl deleted the stordahl/config-script-name branch November 19, 2025 01:39
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.

Rename tracker to "reporter" (or similar)

1 participant