Skip to main content

Statsig Managed API Proxy

An API proxy gives you a unique URL to send and receive data to/from Statsig servers. This makes it less likely to be intercepted by client-side or DNS-side blockers. This way you'll be able to get the right configuration for your applications and more data back from your applications.

info

This is pro-tier functionality.

If you would rather host a proxy on your domain, you should follow the instructions to setup Custom Proxy

Why use a proxy

A significant number of web-browser instances have some sort of tracking blockers installed. Sometimes these blockers end up blocking feature flags, experiments and even runtime dynamic config data, resulting in the exclusion of those users in the statistical power.

Using a proxy that's unique to your application signals these tracking blockers that this is a necessary component of your application that's required for its functioning.

Setting up a managed proxy

If your project is in pro-tier, you will see an option to create a unique proxy for your SDK in the Settings -> Project -> Keys & Environments tab as shown below:

image

Clicking on 'Create a proxy' will generate a new unique worker on AWS and give you back a URL that you can start using immediately.

image

info

Currently the managed proxy that Statsig creates is hosted in ap-south-1 region. If you want this hosted in a different region, reach out to Statsig support

Using Your Proxy

Once you have a proxy setup, you will need to take its URL and apply it to the SDK. To do this, you can use StatsigOptions.api. You can visit Statsig Options to read about the Javascript specific StatsigOptions, but all SDKs have the ability to override the api via StatsigOptions.api.

The following is pseudo code of what initializing with a proxy looks like:

Statsig.initialize(mySdkKey, myUser, { api: "https://my-statsig-proxy.com/v1" });