User (StatsigUser) Object
Introduction to the StatsigUser object
The user object ("StatsigUser" in our SDKs) is the sole input you provide Statsig to target gates and assign users to experiment variants. Every additional field you add to your StatsigUser is one you can target on, or filter your metrics by - so we recommend providing as much info as possible. Statsig can also infer some information about each UserObject based on other traits (for example, we resolve IP Addresses into countries), read on for more details.
I passed that attribute before - why do I need to pass it again?
It's important to understand that Statsig evaluates gates and experiment buckets experiments based only on the information you provide when you check something. Statsig's promise of evaluating every gate or experiment in milliseconds is dependent on having all information available at request time, rather than searching through previous data.
User Attributes
- Client SDKs
- Server SDKs
All user attributes can be explicitly supplied, and some can be inferred from a user's device or connection. Supplying one will always override an inferred value.
Key | Description | Example | Client SDK Support | Auto-infer |
---|---|---|---|---|
userID | ID representing a unique user. This ID will be used to guarantee consistency of targeting for Feature Gates and Experiments and will be used to evaluate experiment results. If User ID doesn't exist yet, leave this empty; a Stable ID persisted locally will be used for evaluations. | your_user_id | All | |
email | Email of the user. | marcos@statsig.com | All | |
userAgent | User agent of the browser. This will be decoded to determine the Browser and Operating System of the user's context. Will be inferred if not provided. | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.40 Safari/537.36 | Web | ✔ |
ip | IP address of the user. Inferred from the request to /initialize if not provided | 192.168.1.101 | All | ✔ |
country | 2-letter country code of the user. This can be supplied or inferred, and we can target based on the country code in both cases. | US | All | ✔ |
locale | Locale of the user. When using the Android or iOS SDK, this will be inferred if not provided. | en_US | Mobile | ✔ |
appVersion | Version of the app the user is using. When using the Android or iOS SDK, this will be inferred if not provided. | 1.0.1 | Mobile |