Skip to content

Conversation

@chakra-guy
Copy link
Collaborator

@chakra-guy chakra-guy commented Oct 8, 2025

Explanation

This PR refactors the SDK Analytics client to support our new V2 namespaced analytics architecture. The client is now split into analytics.v1 (for backward compatibility) and a new analytics.v2 for namespaced event tracking.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

Note

Introduce a namespaced V2 analytics client alongside legacy V1, add /v2 schema/types, refactor client API, update tests, and rewrite README with new usage and migration.

  • Analytics Client (packages/sdk-analytics/src/analytics.ts):
    • Split into analytics.v1 and analytics.v2; single enable() gates both.
    • V1: global properties via setGlobalProperty, track(name, props); batched sending to /v1/events.
    • V2: namespaced API with setup(namespace, props) and track(namespace, eventName, props); batched sending to /v2/events.
  • Schema (packages/sdk-analytics/src/schema.ts):
    • Add POST /v2/events endpoint.
    • Define EventV2 union with sdk/connect and mobile/sdk-connect-v2 payloads and properties.
  • Tests (packages/sdk-analytics/src/analytics.test.ts):
    • Add coverage for disabled state (no sends), V1 payload formatting with globals, V2 namespaced payload merge, and error when tracking without setup.
  • Docs (packages/sdk-analytics/README.md):
    • Rewrite to document V2 namespaced client, setup/track usage, and V1 migration with global properties.

Written by Cursor Bugbot for commit 23d2697. This will update automatically on new commits. Configure here.

@chakra-guy chakra-guy requested a review from a team as a code owner October 8, 2025 12:44
@chakra-guy chakra-guy changed the title v2 analytics Refactor Analytics Client for V2 Namespaced Events Oct 8, 2025
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