Get and Update Project Settings

Get and Update Project Settings

The getAndUpdateProjectSettings() API is responsible for retrieving the latest project configuration from the PageSense servers and updating the SDK’s internal state accordingly. This ensures that your application always operates with the most recent experiment rules, variation details, targeting criteria, and other project-level updates defined in the PageSense dashboard.

The API can be triggered through one of the following mechanisms:

  • Webhook-based updates – Project settings are refreshed automatically when PageSense sends a webhook notification.

  • Polling-based updates – The SDK periodically checks for configuration changes using a scheduled background thread.

Both mechanisms serve the same purpose—keeping the SDK synchronized with PageSense—but differ in how and when the updates are initiated.

Webhook-Based Updates  

When changes are made to an experiment in PageSense—such as editing variations, updating conditions, or adjusting goals—the experiment is typically paused, modified, and then relaunched. If you have configured a webhook endpoint in your PageSense project’s Environment Settings, PageSense sends an outbound webhook request to your server each time an experiment is relaunched.

Your server should be prepared to:

  1. Receive the webhook request from PageSense, and

  2. Invoke the getAndUpdateProjectSettings API immediately after receiving the notification.

This ensures that the SDK refreshes its configuration without waiting for the next polling cycle, allowing users to receive the updated logic almost instantly.

Webhook Retry Behavior  

If PageSense cannot successfully deliver a webhook—due to network issues, downtime, or an unreachable endpoint—the system automatically retries delivery every 30 seconds, for up to 15 minutes.
If a retry window expires without success, attempts stop. However, any subsequent project update and relaunch will trigger a new webhook attempt.

Polling-Based Updates  

If webhook integration is not suitable for your infrastructure, the SDK supports a polling mechanism as an alternative approach. Polling enables the SDK to periodically check PageSense for configuration updates at intervals defined during initialization.

Once polling is enabled:

  1. The SDK starts a background polling thread.

  2. At each interval, the SDK calls getAndUpdateProjectSettings.

  3. If updates are detected, the SDK refreshes its internal project state.

  4. If no updates are found, the SDK continues using the existing configuration until the next cycle.

Polling provides a predictable and dependable way to keep project settings current, especially in environments where webhooks cannot be received due to firewall restrictions, network policies, or server limitations.  

Calling the Method

  1. $pageSenseClient->getAndUpdateProjectSettings($accountName,  $sdkKey, $projectName);
Parameter details:  

Parameter

Type

Required

Description

accountName

String

Yes

The unique identifier of your PageSense account.

sdkKey

String

Yes

The secure key for the environment, available under the Environment section of the PageSense application.

projectName

String

Yes

The name of the project as defined in your PageSense account.

 

 

Choosing Between Webhooks and Polling  

Method

Best For

Characteristics

Webhook

Real-time updates

Fastest way to sync settings; ideal for dynamic or frequently updated experiments.

Polling

Environments without webhook capabilities

SDK checks for updates on a schedule; reliable fallback when webhooks are not feasible.

 

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.