analytics-next icon indicating copy to clipboard operation
analytics-next copied to clipboard

Metrics Calls When using a Proxy

Open ChrisSargent opened this issue 2 years ago • 1 comments

Hello,

We're using a proxy for our calls to Segment in order to prevent ad blockers from blocking calls and also to ease some CSP burden.

We have this setup correctly for everything in Segment to work (loading integrations, track calls, identify calls) but the SDK still tries to make regular calls to the Segment metrics url.

Is it possible to configure this already or would it require some PR?

Thanks.

ChrisSargent avatar Oct 27 '23 16:10 ChrisSargent

@ChrisSargent Thanks for opening this issue. Taking a quick look - looks like the metrics endpoint should be configurable but it isn't exposed somewhere that's easy to access.

If you're using the library via the NPM package there's a rough workaround where you can pass a function in via options.updateCDNSettings that mutates the CDN settings to change the api host in metrics - but if you're using the CDN bundle there are some metrics around load failures that wouldn't be affected by this.

We should make this more easily configurable though for proxy users.

chrisradek avatar Oct 27 '23 17:10 chrisradek