SDK Customization

SDK Customization

Overview

SDK customization involves tailoring a Software Development Kit (SDK) to meet the unique needs of your application or development environment. An SDK typically includes tools, libraries, documentation, and code samples to assist developers in building applications.

When you initialize the PageSense SDK with default settings, it will create a PageSenseClient instance with the following configuration.
  1. Polling Interval: Set to 10 seconds (10,000 milliseconds). This means the SDK checks the PageSense server every 10 seconds for any updates to any project configuration.
  2. Log Level: Set to INFO. This captures all log messages at the levels SEVERE, ERROR, WARNING, and INFO.
  3. Logger: The SDK uses a built-in logger that outputs all logs to your application’s console. No additional setup is needed to start capturing logs.
These defaults are ideal for quick integration and are suitable for most standard use cases.

Customizable configuration

To offer greater flexibility and customization, the PageSense SDK provides several optional configuration functions. These functions allow you to control various aspects of how the SDK operates. You can specify these options during SDK initialization to better align the SDK's behaviour with your application’s specific requirements and environment.

Function

Description

Polling Interval

Specifies how often the SDK should poll the PageSense server for project setting updates. This ensures that your SDK instance stays in sync with the latest project configurations defined in the PageSense application.

Logger

Allows integration of a custom logger to control where and how SDK logs are captured and stored. This is especially useful for aligning SDK logs with enterprise-wide logging frameworks.

User Storage Service

Enables the use of a custom user storage mechanism to persist variation assignments across different A/B Test experiments.

Log Level

Defines the minimum level of log messages to capture. Supported levels include: TRACE, DEBUG, INFO, WARN, ERROR, and SEVERE

Polling Interval

The addPollingInterval function allows you to set the polling interval for the PageSense SDK polling service.
By default, the polling interval is assigned a value of 10 seconds. User can change the polling interval by invoking the function addPollingInterval  as described below:

Example code

  1. PageSenseClient pageSenseClient = PageSenseClientBuilder.GetBuilder(projectSettings).AddPollingInterval(60000).BuildClient();

Parameter details

Parameter
Type
Description
addPollingInterval
Integer
Sets the polling interval for the SDK polling service

The API accepts the time in milliseconds to set the polling interval. In the above example, the polling interval is set as 60000 milliseconds, which is equal to 60 seconds.
            1. Choose a polling interval based on your application’s update frequency, expected traffic volume, and server performance capabilities.
            2. Short intervals (<10 seconds) can lead to:
            a. Increased server load.
            b. Higher network traffic.
            c. Potential race conditions if updates are frequent.
            3. Long intervals (>5 minutes) may:
            a. Cause delay in the propagation of latest project setting changes from PageSense.
            b. Cause users to be served A/B Test experiment with outdated project configurations.

Log level

The addlogLevel function allows you to configure the log level for the built-in logger of the PageSense SDK. This setting helps control the verbosity of logs written by the PageSenseClient, enabling you to manage log storage effectively based on your file system capacity.
By specifying a log level, you define the minimum severity of log messages that will be recorded. Log levels must be provided as a String and can be set to one of the following values (case-insensitive): TRACE, DEBUG, INFO, WARNING, ERROR, or SEVERE.

Example code

  1. PageSenseClient pageSenseClient = PageSenseClientBuilder.GetBuilder(projectSettings).AddLogLevel(“DEBUG”).BuildClient();

Parameter details

Param
Type
Description
logLevel
String
Specifies the minimum log severity to be recorded

In the example above, the log level is set to DEBUG. As a result, all log messages with severity levels of DEBUG, INFO, WARNING, ERROR, and SEVERE will be captured and written to the customer's console.

Custom logger

In addition to the built-in SDK logger, the PageSense SDK allows you to integrate your own custom logger to capture application events. This can be useful if you have an existing logging framework or need more control over how logs are handled.

The addCustomLogger function enables you to register a user-defined logger that will be used by the PageSense SDK to log all events. When a custom logger is provided, the PageSense SDK will route all log messages through your implementation instead of its own built-in logger.

Example code

  1. PageSenseClient pageSenseClient = PageSenseClientBuilder.getBuilder(projectSettings).addCustomLogger(customLogger).buildClient();

Parameter details

Param
Type
Description
customLogger
Instance of PageSenseLogger
Specifies the minimum log severity to be recorded

In the example above, customLogger is an instance of a class that implements the PageSenseLogger interface. Before passing it to addCustomLogger, you must implement this interface in your custom logger to handle the logging behaviour as needed.

Example code

  1. using System;
  2. using log4net;
  3.  
  4. /// <summary>
  5. /// log4net-based logger implementation that integrates with the PageSenseLogger system.
  6. /// Automatically detects the highest enabled log level from log4net and configures the PageSenseLogger.
  7. /// </summary>
  8. public class Log4NetLogger : PageSenseLogger
  9. {
  10.     /// <summary>
  11.     /// log4net logger instance used to delegate actual logging calls.
  12.     /// It logs messages based on the enabled levels in the underlying log4net configuration.
  13.     /// </summary>
  14.     private readonly ILog logger;
  15.  
  16.     /// <summary>
  17.     /// Constructs a Log4NetLogger for the given class name.
  18.     /// </summary>
  19.     /// <param name="className">The class for which logging is performed.</param>
  20.     public Log4NetLogger(string className)
  21.         : base(className, DetermineMaxLogLevel(LogManager.GetLogger(className)))
  22.     {
  23.         this.logger = LogManager.GetLogger(className);
  24.     }
  25.  
  26.     /// <summary>
  27.     /// Determines the highest log4net log level that is currently enabled
  28.     /// and returns it as a string that matches the expected format in PageSenseLogger.
  29.     /// </summary>
  30.     /// <param name="logger">log4net logger instance.</param>
  31.     /// <returns>The name of the highest enabled log level.</returns>
  32.     private static string DetermineMaxLogLevel(ILog logger)
  33.     {
  34.         if (logger.IsDebugEnabled) return "DEBUG";
  35.         if (logger.IsInfoEnabled) return "INFO";
  36.         if (logger.IsWarnEnabled) return "WARNING";
  37.         if (logger.IsErrorEnabled) return "ERROR";
  38.         if (logger.IsFatalEnabled) return "SEVERE"; // Map SEVERE to FATAL
  39.  
  40.         // Fallback if no levels are enabled
  41.         return "INFO"; // default fallback level
  42.     }
  43.  
  44.  
  45.     /// <summary>
  46.     /// Logs a TRACE level message.
  47.     /// Typically used for detailed debugging information.
  48.     ///
  49.     /// Note: TRACE messages are logged at the ALL level in log4net (mapped to Debug internally).
  50.     /// </summary>
  51.     /// <param name="logMessage">The message to log.</param>
  52.     public override void Trace(string logMessage)
  53.     {
  54.         // log4net does not have IsTraceEnabled; using IsDebugEnabled as closest approximation
  55.         if (logger.IsDebugEnabled)
  56.         {
  57.             logger.Debug(logMessage); // Log TRACE as DEBUG internally
  58.         }
  59.     }
  60.  
  61.  
  62.     /// <summary>
  63.     /// Logs a DEBUG level message.
  64.     /// Used for general debugging information to help diagnose application flow.
  65.     /// </summary>
  66.     /// <param name="logMessage">The message to log.</param>
  67.     public override void Debug(string logMessage)
  68.     {
  69.         if (logger.IsDebugEnabled)
  70.         {
  71.             logger.Debug(logMessage);
  72.         }
  73.     }
  74.  
  75.     /// <summary>
  76.     /// Logs an INFO level message.
  77.     /// Typically used for general runtime events.
  78.     /// </summary>
  79.     /// <param name="logMessage">The message to log.</param>
  80.     public override void Info(string logMessage)
  81.     {
  82.         if (logger.IsInfoEnabled)
  83.         {
  84.             logger.Info(logMessage);
  85.         }
  86.     }
  87.  
  88.     /// <summary>
  89.     /// Logs a WARNING level message.
  90.     /// Indicates a potential problem or unexpected situation that is not an error.
  91.     /// </summary>
  92.     /// <param name="logMessage">The message to log.</param>
  93.     public override void Warn(string logMessage)
  94.     {
  95.         if (logger.IsWarnEnabled)
  96.         {
  97.             logger.Warn(logMessage);
  98.         }
  99.     }
  100.  
  101.     /// <summary>
  102.     /// Logs an ERROR level message.
  103.     /// Used for error events that might still allow the application to continue running.
  104.     /// </summary>
  105.     /// <param name="logMessage">The message to log.</param>
  106.     public override void Error(string logMessage)
  107.     {
  108.         if (logger.IsErrorEnabled)
  109.         {
  110.             logger.Error(logMessage);
  111.         }
  112.     }
  113.  
  114.     /// <summary>
  115.     /// Logs a SEVERE level message.
  116.     /// Treated as a critical error; mapped to log4net's FATAL level with a [SEVERE] prefix for clarity.
  117.     /// </summary>
  118.     /// <param name="logMessage">The message to log.</param>
  119.     public override void Severe(string logMessage)
  120.     {
  121.         if (logger.IsFatalEnabled)
  122.         {
  123.             logger.Fatal("[SEVERE] " + logMessage);
  124.         }
  125.     }
  126. }

If you have already defined a log level for SDK and if you also initialize SDK with a customLogger, the log level of the custom logger will take precedence over the log level of the PageSense SDK.

User Storage Service

User Storage Service (USS) is an external storage mechanism that allows you to store variation assignments for users across different A/B test experiments persistently within a project. This feature is particularly useful when you want to ensure consistent variation allocation—that is, ensuring users continue to see the same variation even if the project configuration changes.

Such configuration changes might include:
  1. Adding new variations
  2. Adjusting experiment traffic allocation
  3. Adjusting traffic split between the variations

By using the User Storage Service, you can preserve the user experience and maintain the integrity of your A/B Test Experiment results over time. USS is optional - to enable it, implement the UserStorageService interface and pass an instance of your implementation to the PageSense SDK using the addUserStorageService function.

Example code

  1. PageSenseClient pageSenseClient = PageSenseClientBuilder.GetBuilder(projectSettings).AddUserStorageService(userStorageService).BuildClient();
In the above example, userStorageService is a user-defined instance of a class that implements the UserStorageService interface.

Parameter details

Param
Type
Description
userStorageService
Instance of a class implementing UserStorageService
A custom implementation to manage persistent variation assignments for users for FullStack A/B Test Experiment

Example code

  1. using System;
  2. using System.Collections.Concurrent;
  3.  
  4. /// <summary>
  5. /// Implementation of the UserStorageService interface using in-memory concurrent storage.
  6. /// </summary>
  7. public class IntegratedUserStorageService : UserStorageService
  8. {
  9.     /// <summary>
  10.     /// Storage for user profiles using a thread-safe dictionary.
  11.     /// </summary>
  12.     private readonly ConcurrentDictionary<string, string> userProfileStorage = new ConcurrentDictionary<string, string>();
  13.  
  14.     /// <summary>
  15.     /// Looks up the user profile JSON string for the given user ID.
  16.     /// </summary>
  17.     /// <param name="userId">The ID of the user.</param>
  18.     /// <returns>The user profile JSON string or null if not found.</returns>
  19.     /// <exception cref="ArgumentException">Thrown when userId is null or empty.</exception>
  20.     public override string LookUp(string userId)
  21.     {
  22.         // Validate the User Id
  23.         if (string.IsNullOrWhiteSpace(userId))
  24.         {
  25.             throw new ArgumentException("User ID cannot be null or empty");
  26.         }
  27.  
  28.         string value;
  29.         return userProfileStorage.TryGetValue(userId, out value) ? value : null;
  30.     }
  31.  
  32.     /// <summary>
  33.     /// Saves the user profile to the in-memory storage.
  34.     /// </summary>
  35.     /// <param name="userProfile">The user profile object.</param>
  36.     /// <exception cref="ArgumentException">Thrown when userProfile or User ID is null or empty.</exception>
  37.     /// <exception cref="Exception">Thrown when an error occurs while saving.</exception>
  38.     public override void Save(IUserProfile userProfile)
  39.     {
  40.         if (userProfile == null || string.IsNullOrWhiteSpace(userProfile.GetUserId()))
  41.         {
  42.             throw new ArgumentException("UserProfile or User ID cannot be null or empty");
  43.         }
  44.  
  45.         try
  46.         {
  47.             // Get the User Profile JSON String
  48.             string userProfileJSON = userProfile.GetUserProfileJSONString();
  49.  
  50.             // Save the User Profile JSON String
  51.             userProfileStorage[userProfile.GetUserId()] = userProfileJSON;
  52.         }
  53.         catch (Exception ex)
  54.         {
  55.             throw new Exception("Failed to store the User Profile: " + ex.Message, ex);
  56.         }
  57.     }
  58. }


We hope this documentation helps make the process easy for you. Please feel free to reach out to us anytime by dropping an email to support@zohopagesense.com if you need more explanation or have any questions.

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsEnterpriseOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceAccessible Forms
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit

                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic Forms
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsFormstack alternativeEncrypted Forms

                              Wufoo alternativeSecure Forms

                              WCAG



                                        Create. Review. Publish.

                                        Write, edit, collaborate on, and publish documents to different content management platforms.

                                        Get Started Now







                                                          You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                              Manage your brands on social media


                                                                • Desk Community Learning Series


                                                                • Digest


                                                                • Functions


                                                                • Meetups


                                                                • Kbase


                                                                • Resources


                                                                • Glossary


                                                                • Desk Marketplace


                                                                • MVP Corner


                                                                • Word of the Day


                                                                • Ask the Experts


                                                                  Zoho Sheet Resources

                                                                   

                                                                      Zoho Forms Resources


                                                                        Secure your business
                                                                        communication with Zoho Mail


                                                                        Mail on the move with
                                                                        Zoho Mail mobile application

                                                                          Stay on top of your schedule
                                                                          at all times


                                                                          Carry your calendar with you
                                                                          Anytime, anywhere




                                                                                Zoho Sign Resources

                                                                                  Sign, Paperless!

                                                                                  Sign and send business documents on the go!

                                                                                  Get Started Now




                                                                                          Zoho TeamInbox Resources





                                                                                                    Zoho DataPrep Demo

                                                                                                    Get a personalized demo or POC

                                                                                                    REGISTER NOW


                                                                                                      Design. Discuss. Deliver.

                                                                                                      Create visually engaging stories with Zoho Show.

                                                                                                      Get Started Now









                                                                                                                          • Related Articles

                                                                                                                          • SDK Customization

                                                                                                                            Overview: SDK customization involves tailoring a Software Development Kit (SDK) to meet the unique needs of your application or development environment. An SDK typically includes tools, libraries, documentation, and code samples to assist developers ...
                                                                                                                          • Installation of Java SDK

                                                                                                                            The PageSense JAVA SDK empowers developers to integrate, conduct A/B testing, and personalise user experiences within JAVA applications. PageSense JAVA SDK offers a simple and reliable way to integrate FullStack A/B Testing into your JAVA-based ...
                                                                                                                          • Initialization of C# SDK

                                                                                                                            PageSenseClient is the interface provided by the PageSense C# SDK library to run the FullStack A/B Test experiments for the users. To run the FullStack experiment for the user, the PageSenseClient should be first initialised with the Project Setting ...
                                                                                                                          • Initialization of Java SDK

                                                                                                                            PageSenseClient is the interface provided by the PageSense Java SDK library to run the FullStack A/B Test experiments for the users. To run the FullStack experiment for the user, the PageSenseClient should be first initialised with the Project ...
                                                                                                                          • Installation of C#.NET SDK

                                                                                                                            Overview: The PageSense C# SDK empowers developers to integrate, conduct A/B testing, and personalize user experiences within C#.NET applications. PageSense C# SDK offers a simple and reliable way to integrate FullStack A/B Testing into your ...
                                                                                                                            Wherever you are is as good as
                                                                                                                            your workplace

                                                                                                                              Resources

                                                                                                                              Videos

                                                                                                                              Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                              eBooks

                                                                                                                              Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                              Webinars

                                                                                                                              Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                              CRM Tips

                                                                                                                              Make the most of Zoho CRM with these useful tips.



                                                                                                                                Zoho Show Resources