Skip to content

analytics enabled by default#72

Merged
OmerKat merged 1 commit intomainfrom
enabling-analytics-tracking-by-default
Jan 8, 2026
Merged

analytics enabled by default#72
OmerKat merged 1 commit intomainfrom
enabling-analytics-tracking-by-default

Conversation

@OmerKat
Copy link
Collaborator

@OmerKat OmerKat commented Jan 8, 2026

No description provided.

@claude
Copy link

claude bot commented Jan 8, 2026

Claude finished @OmerKat's task —— View job


PR Review: Analytics Enabled by Default

I've reviewed the change to enable analytics by default. Here's my comprehensive feedback:

Review Tasks:

  • Read the changed file (src/modules/analytics.ts)
  • Check for any repo-specific guidelines (CLAUDE.md)
  • Analyze code quality and best practices
  • Check for potential bugs or issues
  • Evaluate performance considerations
  • Assess security concerns
  • Review test coverage
  • Provide comprehensive feedback

Summary

This PR changes the default value of the enabled field in the analytics configuration from false to true (lines 24-26). This means analytics tracking will be enabled by default for all SDK users.

Code Quality & Best Practices ✅

The change itself is clean and the comment is appropriately updated to reflect the new default behavior.

Potential Bugs or Issues ⚠️

No bugs in the implementation, but there are some considerations:

  1. Breaking Change: This is potentially a breaking change for existing SDK users who rely on the default disabled behavior. Users who haven't explicitly set enabled: false will suddenly start sending analytics data.

  2. URL Parameter Override: The code supports overriding analytics via URL parameter (analytics-enable), which provides users a way to disable analytics if needed (lines 328-348).

Performance Considerations ✅

The analytics module is well-designed with performance in mind:

  • Queue-based batching with configurable batch size (default: 30 events)
  • Throttled processing (default: 1000ms between batches)
  • Maximum queue size limit (default: 1000 events) prevents memory issues
  • Uses sendBeacon API for page unload scenarios

Security Concerns 🔍

  1. Privacy Implications: Enabling analytics by default means user data (page URLs, custom event properties, user IDs, session IDs) will be collected without explicit opt-in.

  2. Data Collection: The module collects:

    • User IDs (when authenticated)
    • Session IDs (stored in localStorage)
    • Page URLs
    • Custom event properties
    • Referrer information
    • Session duration
  3. No PII Safeguards: There's no validation to prevent personally identifiable information from being included in event properties.

Test Coverage ⚠️

The test coverage is limited:

  • Tests exist in tests/unit/analytics.test.ts but they already assume analytics is enabled
  • No tests verify the default configuration behavior
  • No tests for the URL parameter override functionality
  • Missing tests for privacy-sensitive scenarios

Recommendations

  1. Migration Guide: Consider providing clear migration documentation for existing users about this breaking change.

  2. Opt-in vs Opt-out: Consider if opt-in (current behavior) is more appropriate than opt-out for privacy reasons, especially for GDPR/CCPA compliance.

  3. Add Tests: Add specific tests for:

    • Default configuration behavior
    • URL parameter override functionality
    • Analytics disabled scenario
  4. Documentation: The README should clearly document:

    • That analytics is enabled by default
    • How to disable analytics
    • What data is collected
    • Privacy implications
  5. Configuration Options: Consider exposing analytics configuration in the createClient options to make it more discoverable:

    const client = createClient({
      appId: 'xxx',
      serverUrl: 'xxx',
      analytics: { enabled: false } // More discoverable than URL params
    });

Verdict

The implementation is technically sound, but the change has significant privacy and compatibility implications that should be carefully considered and documented.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/sdk@0.8.13-pr.72.b37eb76

Prefer not to change any import paths? Install using npm alias so your code still imports @base44/sdk:

npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.13-pr.72.b37eb76"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "@base44/sdk": "npm:@base44-preview/sdk@0.8.13-pr.72.b37eb76"
  }
}

Preview published to npm registry — try new features instantly!

@OmerKat OmerKat merged commit 2b94e53 into main Jan 8, 2026
5 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.

2 participants