User Context

The user context serves as a unique identifier for individual users and plays a critical role in ensuring consistent feature rollouts across sessions and devices. Typically represented as an object, the user context includes an id key that uniquely identifies the user.

In addition to the user ID, the context can incorporate various attributes to support advanced targeting and segmentation strategies. These may include:

  • customVariables: User-specific data points for personalized experiences.

By leveraging these attributes, organizations can deliver precisely targeted features, maintain personalization consistency, and conduct granular experimentation for improved user engagement and performance analysis.

📘

Important Note

The user context attributes differ from the attributes set using the setAttribute API.

  • User Context Attributes: Primarily used for targeting purposes during feature rollouts and experimentation. These attributes help determine which users are eligible for specific features or variations.
  • setAttribute API Attributes: Specifically designed for post-segmentation analysis, allowing you to segment and analyze experiment results based on defined user characteristics.

🚧

Current Limitation

VWO does not support using user context attributes directly as post-segmentation filters in the reporting section of VWO applications. For post-segmentation, it is recommended to rely on attributes set via the setAttribute API.

Usage

import { VWOProvider } from 'vwo-fme-react-sdk';

const vwoConfig = {
  sdkKey: '32-alpha-numeric-sdk-key',  // Your VWO SDK Key
  accountId: '123456',  // Your VWO Account ID
};

const userContext = {
  id: 'unique_user_id',  // Required: Unique identifier for the user
  customVariables: {     // Optional
    age: 25,
    location: 'US',
  }
};

const App = () => (
  <VWOProvider config={vwoConfig} context={userContext}>
    <YourComponent />
  </VWOProvider>
);

export default App;

User Context keys

ParameterTypeDescription
id
Required
stringUnique user ID for the current user. 'id' is the only required property in userContext. This ID should be a unique identifier for the current user which you need to pass to VWO. Read more here.
userAgent
Optional
stringThe userAgent object for the current user can be used for targeting & segmentation.
ipAddress
Optional
stringIP Address of the current user can be used for targeting & segmentation.
customVariables
Optional
objectAny additional details of the current user that you want to push to VWO can be added here as key-value pairs and can be used for targeting & pre-segmentation.