decentraland / decentraland/sites
[Feature]: support first-party proxy CDN for Segment analytics
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 48
Description
### Summary
Add support for loading Segment analytics through a first-party proxy CDN (`e.decentraland.org`) to bypass ad blockers. This mirrors the work done in `decentraland-dapps` ([#814](https://github.com/decentraland/decentraland-dapps/pull/814)) and `marketplace` ([#2679](https://github.com/decentraland/marketplace/pull/2679)).
### Problem / Motivation
Ad blockers drop all requests to `cdn.segment.com` and `api.segment.io`, causing sessions behind an ad blocker to send zero analytics events. Serving the analytics bundle and track API from a first-party domain (`e.decentraland.org`) avoids filter-list matches and recovers those sessions.
### Priority
High — blocks an important flow or initiative
### Target audience
All users
### Area
Tracking / Analytics
### Proposed Solution
1. Make the Segment analytics.js CDN URL configurable via `SEGMENT_ANALYTICS_URL` in `src/config/env/*.json` (dev only initially; stg/prd stay on default Segment CDN).
2. Make the Segment track API URL configurable via `SEGMENT_TRACK_URL` in `src/config/env/*.json` (dev only initially).
3. Update `DeferredAnalyticsProvider.tsx` to pass the proxy CDN URL to `@dcl/hooks` `AnalyticsProvider` (or configure `@segment/analytics-next` directly).
4. Update `segmentBeacon.ts` to read the track URL from config instead of the hardcoded `api.segment.io` constant.
5. Update `segmentConfig.ts` to expose the new config values.
### Acceptance Criteria
- [ ] `SEGMENT_ANALYTICS_URL` config key added to `dev.json`
- [ ] `SEGMENT_TRACK_URL` config key added to `dev.json`
- [ ] SDK path loads analytics.js from the proxy URL when configured
- [ ] Beacon transport uses the proxy track URL when configured
- [ ] Falls back to default Segment URLs when config is absent (stg/prd)
- [ ] Existing tests pass; new tests cover the proxy configuration
- [ ] Build passes
Contributor guide
Assessment
This issue has not been assessed yet.