Skip to content

Fix GA domain handling, GitHub URL validation, and build analytics event dispatch#11

Merged
ericmigi merged 2 commits intocoredevices:mainfrom
ateich:fix/issue7-8-9-followups
Mar 2, 2026
Merged

Fix GA domain handling, GitHub URL validation, and build analytics event dispatch#11
ericmigi merged 2 commits intocoredevices:mainfrom
ateich:fix/issue7-8-9-followups

Conversation

@ateich
Copy link
Copy Markdown
Contributor

@ateich ateich commented Feb 25, 2026

Summary

This PR fixes three small issues in GA tracking and GitHub repo URL validation.

Why this change

  • Google Analytics (GA) tracking was configured with the wrong fixed domain, which caused GA to break when the app was served from a different host.
  • The GitHub repo URL regex was failing in browsers using stricter /v pattern parsing.
  • The build-run analytics event was never sent because the call was after return (unreachable code).

What changed

  • Changed GA setup to use 'auto' domain resolution.
  • Skipped GA tracking on localhost, 127.0.0.1, and ::1 to match previous behavior.
  • Fixed GitHub repo input regex by escaping - in character classes:
    • [\w.-] -> [\w.\-]
  • Moved ga('send', 'event', 'build', 'run', ...) before return Ajax.Post(...) in run_build().

Result

  • GA tracking no longer fails when host/domain differs from the previously hardcoded value (cloudpebble.net).
  • Local dev traffic does not pollute production analytics.
  • GitHub repo URL field no longer throws the browser regex parsing error.
  • Build-run analytics events are sent again.

The GA tracker was configured with the wrong fixed domain.

Use GA 'auto' domain resolution and skip tracking on localhost/127.0.0.1/::1 to avoid polluting production analytics.
Fix the GitHub repo input `pattern` used by the project settings UI.

`[\w.-]` can fail under browser `/v` pattern parsing because `-` is not escaped in the character class. Change it to `[\w.\-]` so UI validation works consistently without changing intended accepted characters.

Fix the unreachable statement in `compile.js` that prevented the build-run analytics event from firing. The `ga('send', ...)` call was after `return Ajax.Post(...)`; move it before the return so the event is sent again.
@ericmigi
Copy link
Copy Markdown
Contributor

Did you actually run into a bug that caused this or is this just a general clean-up?

@ateich
Copy link
Copy Markdown
Contributor Author

ateich commented Feb 25, 2026

Very minor bugs that showed up in stack traces in #8 and #9 but were not the root cause.

These aren't user impacting issues. They just threw errors creating console noise, so I fixed them to make debugging a little easier in the future.

@ericmigi ericmigi merged commit c0306b4 into coredevices:main Mar 2, 2026
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