Menu

Web SDK

1. Function Overview

         In order to reduce the trouble for developers to update the application version frequently, the SolarEngine introduces online parameter functionality. By delivering parameters, the values of parameters in the application can be adjusted remotely at any time, allowing for application content updates without requiring a new release.

       When using the online parameter SDK plug-in, it depends on the Web SDK .

2. Before you start

Before officially starting data access, there are some parameters and SDK packages required. Follow the directions below to get prepared.

Step 1: Get User Code & AppKey

       See the Web SDK integration documentation for details.

Step 2: Obtain Online Parameter SDK Plug-in

       Click the link below to download the online parameter SDK plug-in package.

       https://sdk.solar-engine.com/webabtest/SolarEngine-webabtest-SDK-1.3.0.zip

3. Integrate the SDK

3.1 SDK Initialization

       Since the Parameter Delivery SDK is a plugin of the SolarEngine SDK, the initialization of the Parameter Delivery SDK depends on the SolarEngine SDK. Please refer to the Android SDK integration documentation for specific details.

       The SDK is built in UMD mode and supports multiple loading methods. Common loading methods are listed below:

import SESDK from './web-sesdk.js'
import webabtestPlugin from './sesdk-webabtest-plugin.js';

// Load online parameter SDK plug-in
SESDK.use(webabtestPlugin);
// Pre-initialization 
SESDK.prevInit(appKey);
// SDK initialization
SESDK.init(initParams);
<script src="./web-sesdk.js"></script>
<script src="./sesdk-webabtest-plugin.js"></script>

// Load online parameter SDK plug-in
window.SESDK.use(window.webabtestPlugin);
// Pre-initialization
window.SESDK.prevInit(appKey);
// SDK initialization
window.SESDK.init(initParams);

initParams parameter description:

Parameter NameParameter MeaningParameter TypeMandatory
userIdUser Code obtained in preparationStringYES
appKeyAppKey obtained in preparationStringYES
configInitialization related configurationConfigNO

Config parameter description:

Parameter NameParameter MeaningParameter TypeMandatory
remoteConfigOnline parameters & A/B test configurationRemoteConfigNO
multilinkTestConfigMulti-link test configurationMultilinkTestConfigNO

RemoteConfig parameter description:

Parameter NameParameter MeaningParameter TypeMandatory
enableWhether to initialize the online parameter SDK (Default false)booleanNO
mergeTypeServer and SDK merge type
0: Use the server configuration to merge with the user's local cache configuration.
1: Use the server configuration to merge with the user's default configuration
numberNO
customIDPropertiesCustom ID, matches the custom ID set by the user in the backgroundobjectNO
customIDEventPropertiesCustom ID event property value, matches the custom ID event attribute value set by the user in the background.objectNO
customIDUserPropertiesCustom ID user property value, matches the user attribute value set by the user in the background.objectNO
pollingIntervalPolling interval (unit: minutes), interval: 30 minutes-720 minutes, default 30 minutesnumberNO
requestTimeoutTimeout for requesting configuration plug-in  (Default 60*1000 milliseconds)numberNO

Multi-linkTestConfig parameter description:

ParameterTypeMandatoryDescription
enablebooleanNOWhether to initialize the multi-link test SDK (default false)
maskTimeoutCloseTimenumberNOThe timeout of multi-link test config request (default 500 milliseconds, minimum 200 milliseconds)
isSetMaskbooleanNOWhether to add a mask layer to the test page and prevent user operations before requesting a multi-link test configuration response. (default true). If you enable the mask layer, you need to put the SDK initialization logic in the head tag of the page, otherwise the page will flicker .
customIDPropertiesobjectNOCustom ID, matches the custom ID set by the user in the background
customIDEventPropertiesobjectNOCustom ID event property value, matches the custom ID event attribute value set by the user in the background.
customIDUserPropertiesobjectNOCustom ID user property value, matches the user attribute value set by the user in the background.
requestTimeoutnumberNOTimeout for requesting configuration plug-in (Default 60*1000 milliseconds)

Call example:

SESDK.init({
  appKey: '666666',
  userId: '888888',
  config: {
    debugModel: true,
    remoteConfig: {
      pollingInterval: 30,
      enable: true,
      mergeType: 1,
      customIDProperties: { a: 1 },
      customIDEventProperties: { e: 1 },
      customIDUserProperties: { u: 1 },
    },
    multilinkTestConfig: { 
       enable: true,
       isSetMask: true,
       maskTimeoutCloseTime: 500,
       customIDProperties: { a: 1 },
       customIDEventProperties: { e: 1 },
       customIDUserProperties: { u: 1 },
    },
  },
});

3.2 A/B Testing & Online Parameter

1) Set Default Configuration

       Developers who use parameters to deliver the SDK need to preset a default configuration into the App through the API. The SDK uses this default configuration as an alternative.

Method example:

SESDK.setRemoteDefaultConfig(defaultConfig)
Parameter NameParameter MeaningParameter TypeMandatory
defaultConfigThe default configuration passed by the developerArray<object>Yes

defaultConfig example:

// defaultConfig defaultConfig default configuration. Each parameter configuration is an object, formatted as follows:
SESDK.setRemoteDefaultConfig([
   {
          name : "k1", // Name of the configuration item, corresponding to the parameter key of the fastFetchRemoteConfig interface
          type : 1, // Type of the configuration item: 1 for string, 2 for number, 3 for boolean, 4 for json
          value : "v1", // Value of the configuration item
   }
]);   

2) Set Custom Event Properties

       Developers can set custom attributes for events, and the parameter delivery SDK will bring this attribute when requesting server configuration for server-side parameter matching.

Method example:

SESDK.setRemoteConfigEventProperties(properties)

Note: It must be set before SDK initialization.

Parameter NameParameter MeaningParameter TypeMandatory
propertiesCustom event propertiesobjectYes

Call example:

SESDK.setRemoteConfigEventProperties({
  k1: v1,
  k2: v2
});  

3) Set Custom User Properties

       Developers can set custom attributes for users. The parameter delivery SDK will bring this attribute when requesting server configuration for server-side parameter matching.

Method example:

SESDK.setRemoteConfigUserProperties(properties)
Parameter NameParameter MeaningParameter TypeMandatory
propertiesCustom user propertiesobjectYes

Call example:

SESDK.setRemoteConfigUserProperties({
  k1: v1,
  k2: v2
});

4) Obtain Online Parameter Configuration

       The parameter delivery SDK provides two methods for retrieving parameter configuration: synchronous and asynchronous.

  • Synchronous: Developers can directly obtain the result by calling the corresponding method.
  • Asynchronous: The result needs to be obtained after the callback is completed.

Note:

      When retrieving parameters synchronously or asynchronously, the SDK will trigger an event to report which experiment the user is assigned to. Therefore, it is recommended to retrieve parameters when the user reaches the experimental scenario (retrieving parameters signifies that the user has reached the experimental scenario and entered the experiment associated with that parameter). Please refrain from retrieving parameters prematurely.

Synchronously obtain online parameter configuration

Method example:

SESDK.fastFetchRemoteConfig(key);

Note: It must be obtained after the SDK. The SESDK.ready method can be called to determine whether the SDK has completed initialization.

Parameter NameParameter MeaningParameter TypeMandatory
keyParameter delivery key, corresponds to the parameter key configured by the user in the background.StringYes

Return value type: id

Call example:

SESDK.ready(function(){
  const v = SESDK.fastFetchRemoteConfig("k1");
  // Operations after getting the value
})

Asynchronously obtain online parameter configuration

Method example:

SESDK.asyncFetchRemoteConfig(key); //Return Promise
Parameter NameParameter MeaningParameter TypeMandatory
keyParameter delivery key, corresponds to the parameter key configured by the user in the background.StringYes

Call example:

SESDK.asyncFetchRemoteConfig("k1").then(function(value){
  // Operations after getting the value
})

4. Multi-Link Test

4.1 Set Custom Event Properties

       Developers can set custom attributes for events, and the parameter delivery SDK will bring this attribute when requesting server configuration for server-side parameter matching.

Method example:

SESDK.setMultilinkTestEventProperties(properties)

Note: It must be set before SDK initialization.

Parameter NameParameter MeaningParameter TypeMandatory
propertiesCustom event propertiesobjectYes

Call example:

SESDK.setRemoteConfigEventProperties({ k1: v1, k2: v2 }); 

4.2 Set Custom User Properties

       Developers can set custom attributes for users. The parameter delivery SDK will bring this attribute when requesting server configuration for server-side parameter matching.

Method example:

SESDK.setMultilinkTestUserProperties(properties)
Parameter NameParameter MeaningParameter TypeMandatory
propertiesCustom user propertiesobjectYes

Call example:

SESDK.setMultilinkTestUserProperties({
  k1: v1,
  k2: v2
});

————————————

SDK Update Log

2025-03-14 1.3.0

• Align with the main SDK version


2025-03-13 1.2.9

• Align with the main SDK version


2025-02-13 1.2.8

• Align with the main SDK version


2025-01-03 1.2.7

• Align with the main SDK version


2024-12-10 1.2.4

• Align with the main SDK version


2024-11-29 1.2.3

• Align with the main SDK version


2024-11-11 1.2.2

• Align with the main SDK version


2024-10-31 1.2.1

•Align with the main SDK version


2024-09-26 1.2.0

• Align with the main SDK version


2024-08-14 1.1.9

• Align with the main SDK version


2024-05-22 1.1.8

• Align with the main SDK version


2024-04-22 1.1.7

• Align with the main SDK version


2024-04-16 1.1.6

• Align with the main SDK version


2024-04-01 1.1.5

• Align with the main SDK version


2024-03-15 1.1.4

• Request to add parameters for A/B testing


2024-03-01 1.1.3

• Fix initialization parameter issue in A/B testing.


2024-01-22 1.1.2

• Align with the main SDK version


2023-12-06 1.1.1

  • Incident reporting online verification


2023-11-02 1.1.0

  • Align with the main SDK version


2023-08-16 1.0.6

  • Event reporting and offline verification


2023-08-08 1.0.5

  • Add multi-link test


2023-07-31 1.0.4

  • Optimize the offload event logic


2023-06-01 1.0.3

  • Add Setting service


2023-03-30 1.0.1

  • The plug-in logic is compatible with the debugModel debugging mode of the main SDK


2023-03-20 1.0.0

  • First version of online parameter SDK
  • Support online parameter function
  • Support AB testing function
  • Add internal log management to online parameters


Previous
iOS SDK
Next
Unity SDK
Last modified: 2025-07-29Powered by