Skip to content

Send gameplay analytics to the StoneSiege service - #166

Merged
Knorcedger merged 1 commit into
mainfrom
contrib/165-first-party-analytics
Aug 29, 2026
Merged

Send gameplay analytics to the StoneSiege service#166
Knorcedger merged 1 commit into
mainfrom
contrib/165-first-party-analytics

Conversation

@Knorcedger

Copy link
Copy Markdown
Owner

What changed?

Replaced the gameplay GA4 transport with the first-party StoneSiege event service. The production client now batches up to 50 allowlisted events, posts credential-free text/plain envelopes with keepalive, retries network/429/5xx failures once, and flushes on page hide without ever blocking play.

Match start/resume/end events now share a random per-match join id, including across saved-match restores. Session grouping remains session-scoped only. The live opt-out is checked when events are queued and again before transmission, so Settings → Share anonymous gameplay stats stops requests immediately.

Updated the mobile, project, roadmap, changelog, and store disclosure sources to describe the first-party Railway/MongoDB Atlas service, two-year raw-event retention, no stored IP address, and no persistent person/device identifier. No gameplay event is sent to Google Analytics.

Paired backend: Knorcedger/stonesiege-be#2 (merged before this client ships).

Related issue

Closes #165

Why this approach?

The existing event builders and analytics sink stay provider-free; only the web/platform transport changes. Random ids use platform crypto when available and never enter deterministic simulation state. A match id is saved only with its active snapshot so aggregate reporting can join a resumed match to its outcome without creating a player identity.

The server ships first because it owns the event-name and property allowlist. The website privacy/consent update ships before this client reaches production.

Verification

  • npm run typecheck
  • npm test — 1,457 passed, 11 skipped
  • npm run build
  • npm run check — typecheck, full tests, production build, bundle budget, bundle self-test
  • Production-configured bundle contains https://api.stonesiegegame.com/api/events and no Google tag URL or measurement id
  • I added or updated tests where behavior changed
  • Screenshots or recording: not applicable; no visible UI changed

Provenance and AI assistance

OpenAI Codex materially assisted with repository auditing, implementation, tests, documentation, and verification. I reviewed the resulting changes. No generated or third-party assets are included.

Contributor checklist

  • I searched issues and active pull requests before implementation and coordinated ownership in the linked issue
  • This pull request closes or references exactly one primary coordination issue
  • I read CONTRIBUTING.md and followed the deterministic simulation rules
  • I reviewed and understand every submitted change
  • I have the right to submit this code and any included assets
  • My commits are signed off under the Developer Certificate of Origin (git commit -s)
  • This PR contains no credentials, private player data, or unlicensed third-party material

Signed-off-by: Achilleas Tsoumitas <knorcedger@gmail.com>
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bannerfall Ready Ready Preview Aug 29, 2026 10:06am

Request Review

@Knorcedger
Knorcedger merged commit 39de880 into main Aug 29, 2026
3 checks passed
@Knorcedger
Knorcedger deleted the contrib/165-first-party-analytics branch August 29, 2026 11:59
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.

Move gameplay analytics from GA4 to the first-party service

1 participant