Introduction to Python SDK

Introduction to Python SDK

The PageSense Python SDK enables developers to integrate Zoho PageSense FullStack A/B Testing into Python applications. It allows server-side applications to evaluate experiments, retrieve variation assignments, and track goal conversions without relying on client-side execution.
The SDK downloads the latest project configuration from the PageSense server during initialization and maintains it in memory throughout the application lifecycle. Using the synchronised project configuration, experiments are evaluated locally to provide fast and reliable variation assignment while minimising network overhead.
The SDK supports:
  • Server-side FullStack A/B Testing
  • Sticky visitor assignment
  • Audience targeting using custom visitor attributes
  • Custom Event and Revenue Goal tracking
  • Automatic project synchronisation
  • Configurable polling interval
  • Custom logging
  • Persistent user storage for consistent visitor bucketing
Whether you're experimenting with new features, optimising user journeys, or measuring business outcomes such as purchases and sign-ups, the PageSense Python SDK provides a scalable and reliable solution for server-side experimentation.

How FullStack A/B Testing Works  

The PageSense Python SDK enables experimentation by evaluating visitors against the latest project configuration downloaded from the PageSense server. A typical experiment lifecycle comprises the following steps:
  1. Initialize the SDK using your SDK credentials.
  2. Download the latest project configuration.
  3. Create a PageSenseUserContext representing the current visitor.
  4. Evaluate the visitor against audience targeting rules.
  5. Assign the visitor to a variation using deterministic bucketing.
  6. Execute variation-specific application logic.
  7. Track custom goals and revenue conversions.
The SDK periodically synchronises the in-memory project configuration with the PageSense server to ensure experiments remain up to date.

Features  

The PageSense Python SDK provides the following capabilities:

Feature
Description
Server-side A/B Testing
Evaluate and activate experiments within Python applications.
Sticky Visitor Assignment
Ensures visitors consistently receive the same variation across multiple requests.
Audience Targeting
Evaluate visitors using custom attributes defined in PageSenseUserContext.
Experiment Activation
Activate experiments and retrieve assigned variations.
Variation Retrieval
Retrieve a visitor's assigned variation without activating the experiment.
Project-level Goal Tracking
Track goal conversions for the project using a single API.
Automatic Experiment Attribution
Automatically attributes goal conversions to all active experiments mapped to the goal for which the visitor has qualified.
Revenue Goal Tracking
Track revenue goals using goal properties.
Configurable Polling
Periodically synchronises the latest project configuration from the PageSense server.
Custom Logger
Integrate your own logging framework.
Persistent User Storage
Maintain sticky visitor assignment across application restarts.
Thread-safe Client
Reuse a single SDK instance throughout the application lifecycle.

Requirements  

Component
Supported Version
Python
3.8 or later
pip
Latest recommended version