Skip to content

analytics domain override#1209

Merged
BilalG1 merged 2 commits intoanalytics-event-trackingfrom
analytics-domain-override
Feb 18, 2026
Merged

analytics domain override#1209
BilalG1 merged 2 commits intoanalytics-event-trackingfrom
analytics-domain-override

Conversation

@BilalG1
Copy link
Copy Markdown
Collaborator

@BilalG1 BilalG1 commented Feb 18, 2026

No description provided.

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 18, 2026

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

Project Deployment Actions Updated (UTC)
stack-backend Ready Ready Preview, Comment Feb 18, 2026 2:17am
stack-dashboard Ready Ready Preview, Comment Feb 18, 2026 2:17am
stack-demo Ready Ready Preview, Comment Feb 18, 2026 2:17am
stack-docs Ready Ready Preview, Comment Feb 18, 2026 2:17am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch analytics-domain-override

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@BilalG1 BilalG1 requested a review from N2D4 February 18, 2026 00:20
@BilalG1 BilalG1 assigned N2D4 and unassigned BilalG1 Feb 18, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 18, 2026

Greptile Summary

Implemented analytics domain override functionality to route analytics and session replay requests to a separate domain (r.stack-auth.com in production) while regular API requests continue to use the standard domain.

Key changes:

  • Added optional getAnalyticsBaseUrl configuration to ClientInterfaceOptions
  • Created getAnalyticsBaseUrl() method that maps production domain to analytics subdomain
  • Updated sendSessionReplayBatch() and sendAnalyticsEventBatch() to use analytics URL override
  • Modified sendClientRequest() to accept optional apiUrlOverride parameter for routing flexibility

The implementation correctly handles both production (uses separate analytics domain) and development (uses same domain) environments.

Confidence Score: 5/5

  • This PR is safe to merge with no concerns
  • The changes are straightforward and well-structured: they add optional analytics domain override functionality without breaking existing behavior. The implementation correctly handles fallback to the regular base URL when no analytics URL is provided, ensuring backward compatibility. All changes are isolated to analytics and session replay requests.
  • No files require special attention

Important Files Changed

Filename Overview
packages/stack-shared/src/interface/client-interface.ts Added optional analytics URL override support for routing analytics requests to separate domain
packages/template/src/lib/stack-app/apps/implementations/common.ts Added analytics domain mapping logic to route to r.stack-auth.com for production
packages/template/src/lib/stack-app/apps/implementations/client-app-impl.ts Integrated analytics domain override into client app initialization

Flowchart

flowchart TD
    A[Client Request] --> B{Request Type?}
    B -->|Analytics/Replays| C[getAnalyticsApiUrl]
    B -->|Regular API| D[getApiUrl]
    
    C --> E{Environment?}
    E -->|Production| F[r.stack-auth.com/api/v1]
    E -->|Development| G[Regular Base URL/api/v1]
    
    D --> H[Regular Base URL/api/v1]
    
    F --> I[sendClientRequest with apiUrlOverride]
    G --> I
    H --> J[sendClientRequest without override]
    
    I --> K[Execute Request]
    J --> K
Loading

Last reviewed commit: fb49d11

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@github-actions github-actions bot assigned BilalG1 and unassigned N2D4 Feb 18, 2026
@BilalG1 BilalG1 merged commit 73df340 into analytics-event-tracking Feb 18, 2026
18 of 26 checks passed
@BilalG1 BilalG1 deleted the analytics-domain-override branch February 18, 2026 02:32
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