# Experimental Interface
Experimental capabilities are supported from the base library version 2.14.4 .
1.wx.getExptInfoSync(keys?: string[]) => Object
Given an array of experimental parameters, get the corresponding experimental parameter value
**Note that it is a character string **;None of the experiments returned empty objects.
Please call the API to get the parameters when you really need them. Each time you want to use a parameter, you need to re-call the API to get the latest value, and do not record the historical results. The reason is that the values of the parameter may change, and the old values are likely to have expired, leading to inaccurate experimental results.
'wxapp_expt_test'为 mp 上创建实验的实验参数,参数值 '0' 表示'对照组'、 '1' 表示'实验组1'、'2' 表示'实验组2',可支持最多 20 个实验组
const res = wx.getExptInfoSync(['wxapp_expt_test'])
if (res.wxapp_expt_test === undefined) {
// 返回空对象;未命中实验、实验待发布(白名单除外)或者实验结束后会命中该分支
/* 业务逻辑,可对齐线上 */
} else if (res.wxapp_expt_test == '0') {
/* 对照组业务逻辑 */
} else if (res.wxapp_expt_test == '1') {
/* 实验组1业务逻辑 */
} else if (res.wxapp_expt_test == '2') {
/* 实验组2业务逻辑 */
} else {
/* 异常分支逻辑 */
}
The incident was reported
EventId is the English name of the** event set in the Weixin Mini Program background experimental system.
Data is optional, an object that can be strinified by JSON.strinify, and will be reported to the system together.
wx.reportEvent('事件英文名', {expt_data: num})
其中expt_data固定;num由业务决定且只支持整数,可上报停留时长或者金额。
需注意的是 wx.reportEvent('事件英文名') 与 wx.reportEvent('事件英文名', {expt_data: 1}) 等价。