Why this matters
The PageSense SDK works off a local copy of your project settings. When you update an experiment — change a variation, adjust traffic, modify targeting rules — the SDK needs to pick up those changes.
getAndUpdateProjectSettings does exactly that: it pulls the latest settings from PageSense and refreshes the SDK's internal state. You can trigger this via webhooks (real-time) or polling (scheduled).
Changes that trigger a sync:
New or updated experiments
Variation or traffic allocation changes
Updated audience targeting rules
Goal configuration changes
Experiment status updates
Option 1 — Webhook-based Sync (recommended)
Webhooks give you real-time updates. When you modify a FullStack experiment in PageSense, the flow looks like this:
Pause the experiment.
Apply the changes.
Relaunch the experiment.
If a webhook URL is set in your Environment Settings, PageSense sends a POST notification to that URL on relaunch. Your server should handle that event and call getAndUpdateProjectSettings immediately.
Retry behaviour if the webhook fails:
PageSense retries every 30 seconds.
Retries run for up to 15 minutes.
After that window, retries stop.
A new relaunch triggers a fresh notification.
Option 2 — Polling-based Sync
No webhook setup? Use polling instead. The SDK runs a background loop at a configured interval, calls the settings API, and updates the configuration if anything has changed. Nothing to manage manually — it just runs.
getAndUpdateProjectSettings API
Method
- await pageSenseClient.getAndUpdateProjectSettings(
- accountId,
- sdkKey,
- projectName
- );
Parameters
Parameter | Type | Required | Description |
accountId | String | Yes | Your PageSense account identifier. |
sdkKey | String | Yes | Secure SDK key for your environment. |
projectName | String | Yes | The PageSense project to sync. |
Return Value
true — settings fetched and updated successfully.
false — update failed (invalid params, network issue, or server error).
Usage Example
- await pageSenseClient.getAndUpdateProjectSettings(
- "ZylkerUser1",
- "xyz123abdscd",
- "ZylkerFullStackProject"
- );
After this runs, all subsequent experiment evaluations use the refreshed configuration.
Polling Lifecycle Methods
Method | What it does |
startPolling() | Kicks off the polling loop. |
runPollingCycle() | Runs one sync cycle manually. |
stopPolling() | Stops the loop and frees resources. |
registerShutdownHooks() | Ensures polling stops cleanly when the Node.js process exits. |
Quick comparison
Approach | Best for |
Webhook | Real-time updates, minimal latency. |
Polling | Environments where webhook setup isn't possible. |