Best Practices

Best Practices

Following these recommendations will help ensure optimal SDK performance, accurate experiment evaluation, and reliable goal tracking.

SDK Initialization  
  • Initialize the SDK once during application startup.
  • Reuse a single PageSenseClient instance throughout the application lifecycle.
  • Avoid creating multiple SDK client instances unless required.
Visitor Identification  
  • Use a stable and unique visitor identifier.
  • Do not change the visitor identifier for the same visitor across requests.
  • Reuse the same PageSenseUserContext instance throughout the visitor's request lifecycle.
Audience Targeting  
  • Populate all relevant visitor attributes before activating an experiment or tracking a goal.
  • Ensure attribute names match those configured in your PageSense project.
  • Use custom attributes consistently to improve audience targeting and reporting.
SDK Configuration  
  • Use the default polling interval unless your application requires a different synchronisation frequency.
  • Configure a custom UserStorageService for production environments to maintain sticky visitor assignments across application restarts.
  • Enable DEBUG or TRACE logging only during development or troubleshooting.