Initialization of PHP SDK

Initialization of PHP SDK

The PageSenseClient class is the main interface provided by the PageSense PHP SDK to run Full Stack A/B Testing experiments for the users. Before serving variations or tracking goals, the client must be initialized with your project’s configuration, known as the Project Settings.

Project Settings contain metadata about all active experiments within your project, including the details of all variations, targeting conditions, goals and environment keys. Initializing the SDK ensures your PHP application has the latest experiment definitions and runs them correctly.

Initialization Overview  

Initialization of the PageSense PHP SDK involves two steps:

  1. Fetching the Project Settings from the PageSense server.

  2. Creating a PageSenseClient instance using those settings.

1. Get the Project Settings  

The Project Settings contains the details of all the A/B Test experiments that are active (Running, Paused and Scheduled) in your project, their configurations, variations, goals, and targeting rules, etc. Project Settings can be fetched directly from the PageSense servers using the getProjectSettings() method.

Calling the Method

Add the following code to your application to get the Project Setting file for your PageSense account.

 

  1. use Zoho\PageSense\PageSenseClientBuilder;
  2. // Get the Project Settings
  3. $projectSettings = PageSenseClientBuilder::getProjectSettings( 'accountId-DC','sdkKey',   'projectName' );
Method Parameters

Parameter

Type

Description

accountId

string

Your unique PageSense account ID with Data Center Code.

sdkKey

string

Unique key corresponding to your SDK environment. Available under the Environment tab in your Full Stack project settings.

projectName

string

Name of your Full Stack project.


Notes
Note: This function will return the Project Settings if present in the Stringified JSON format. If there are no project settings available, this function will return null.

2. Create the PageSenseClient Instance  

Once you’ve fetched the Project Settings, you can initialize the PageSenseClient. The client uses these settings to determine which experiments and variations apply to each user session.

Calling the Method

  1. // Create the PageSense Client instance
  2. $pageSenseClient = PageSenseClientBuilder::getBuilder($projectSettings)->buildClient();

After Initialization  

Your PageSenseClient instance is now ready to:

  • Activate experiments

  • Fetch variation names

  • Track goals and conversions

  • Manage project-level settings

You can create a single instance of the PageSenseClient during your application startup and use it for all the users using your application to run the A/B Test, deliver the variations and track the goal conversions and send the tracking details to PageSense.


NotesNote: Implement robust error-handling procedures to safely manage cases where the PageSenseClient fails to initialize and results in a null instance. Your application should handle this condition gracefully to avoid unexpected runtime errors.

      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

                              TypeformWCAG


                                          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

                                                                                                                              PageSense SDK provides a flexible configuration model that allows developers to adapt its behavior to suit the needs of their application. While the SDK can be used with minimal setup using the default configuration, applications with stricter ...
                                                                                                                            • Installation of PHP SDK

                                                                                                                              The PageSense PHP SDK empowers developers to integrate, run, and analyze Full Stack A/B tests directly from their PHP applications. It offers a simple, secure, and reliable way to connect your PHP applications to the PageSense’s experimentation ...
                                                                                                                            • 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 ...
                                                                                                                            • 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 ...
                                                                                                                              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