Overview
The PageSense SDK provides configuration options that can be set during initialisation to control logging behaviour and how frequently the SDK fetches updated project settings. These options are configured in the native modules and apply to both Android and iOS.
Polling Interval
The polling interval controls how frequently the SDK fetches updated project settings from the PageSense server. This determines how quickly experiment and goal configuration changes are reflected in the application without requiring a restart.
Default Behaviour
If no polling interval is set, the SDK uses its built-in default. Setting a custom interval overrides this default.
Configuration
The polling interval is set in minutes on the PageSenseSDKOptions object before the SDK is initialised.
Android (Kotlin)
kotlin
val pageSenseSDKOptions = PageSenseSDKOptions()
pageSenseSDKOptions.pollingInterval = 5 // Fetch updated settings every 5 minutes
iOS (Swift)
swift
let pageSenseSDKOptions = PageSenseSDKOptions()
pageSenseSDKOptions.pollingInterval = 5 // Fetch updated settings every 5 minutes
Notes
The polling interval value is in minutes.
Setting a lower interval means the SDK fetches updates more frequently, which keeps experiment configuration more current but increases network activity.
Setting a higher interval reduces network activity but means configuration changes take longer to reflect in the application.
Log Level
The log level controls the verbosity of the PageSense SDK logs. Setting an appropriate log level helps with debugging during development and reduces noise in production.
Available Log Levels
Log Level | Description |
TRACE | Most verbose. Logs all SDK activity including internal state transitions. Use only for deep debugging. |
DEBUG | Logs detailed diagnostic information useful during development and integration. Recommended for development builds. |
INFO | Logs general operational messages confirming the SDK is working as expected. |
WARN | Logs potentially problematic situations that do not prevent the SDK from functioning. |
ERROR | Logs error events that may cause the SDK to fail specific operations. |
SEVERE | Logs only critical failures. Least verbose. Recommended for production builds. |
Configuration
The log level is set on the PageSenseSDKOptions object before the SDK is initialised.
Android (Kotlin)
kotlin
val pageSenseSDKOptions = PageSenseSDKOptions()
pageSenseSDKOptions.logLevel = LogLevel.DEBUG
iOS (Swift)
swift
let pageSenseSDKOptions = PageSenseSDKOptions()
pageSenseSDKOptions.logLevel = .DEBUG
Notes
Use DEBUG during development to get detailed logs that help verify experiment activation, variation assignment, and goal tracking.
Use SEVERE or ERROR in production to minimise log output.
Log level does not affect SDK functionality — only what is written to the log output.
Applying SDK Options During Initialisation
Both pollingInterval and logLevel are set on the PageSenseSDKOptions object, which is passed to the SDK initialisation call. The configuration applies for the lifetime of the PageSenseClient instance.
Android (Kotlin)
- kotlin
- val pageSenseSDKOptions = PageSenseSDKOptions()
- pageSenseSDKOptions.logLevel = LogLevel.DEBUG
- pageSenseSDKOptions.pollingInterval = 5
- PageSenseClientBuilder.createNewPageSenseClient(
- accountId,
- sdkKey,
- projectName,
- pageSenseSDKOptions,
- object : ProjectSettingsCallBack {
- override fun onFailure(message: String?, code: Int?) {
- println("SDK initialization failed: $message")
- promise.resolve(false)
- }
- override fun onSuccess(data: PageSenseClient?) {
- if (data != null) {
- client = data
- isInitialized = true
- println("SDK initialized successfully")
- promise.resolve(true)
- } else {
- promise.resolve(false)
- }
- }
- }
- )
iOS (Swift)
- swift
- let pageSenseSDKOptions = PageSenseSDKOptions()
- pageSenseSDKOptions.logLevel = .DEBUG
- pageSenseSDKOptions.pollingInterval = 5
- PageSense.shared.createNewPageSenseClient(
- sdkAccountIDForDC: accountId,
- sdkKey: sdkKey,
- projectname: projectName,
- sdkOptions: pageSenseSDKOptions
- ) { pagesenseclient in
- guard let client = pagesenseclient else {
- print("PageSenseClient initialization failed")
- resolve(false)
- return
- }
- self.client = client
- self.isInitialized = true
- print("PageSenseClient initialized successfully")
- resolve(true)
- }
Best Practices
Set logLevel to DEBUG during development and integration to help diagnose issues with experiment activation, variation assignment, and goal tracking.
Set logLevel to SEVERE or ERROR before releasing to production to avoid excessive logging.
Set a polling interval that balances the freshness of experiment configuration against acceptable network activity for your application.
PageSenseSDKOptions must be configured before calling the initialisation function. Changes to the options after initialisation will have no effect.
We’ve
designed this documentation to guide you every step of the way. If you
need further assistance or have any questions, don’t hesitate to contact
us at
support@zohopagesense.com - we’re always here to help!