# [MiniReportManager](/minigame/dev/api/data-analysis/MiniReportManager) wx.getMiniReportManager(Object param)

> 基础库 3.8.12 开始支持，低版本需做[兼容处理](1003706)。

> __以 [Promise 风格](/miniprogram/dev/framework/app-service/api.md#异步-API-返回-Promise) 调用__：不支持
> 
> __微信 Windows 版__：支持
> 
> __微信 Mac 版__：支持

## 功能描述

初始化并返回一个MiniReportManager实例，用于记录和管理小游戏上报。

## 参数

### Object param

| 属性 | 类型 | 默认值 | 必填 | 说明 |
| ---- | ---- | ------ | -------- | ---- |
| eventList | Array.<string> | [] | 否 | 需要上报的事件ID列表 |
| debug | boolean | false | 否 | 是否开启调试模式，调试模式下每次上报成功都会在控制台输出上报内容。调试模式仅在开发版和体验版小游戏中生效。 |
| success | function |  | 否 | 接口调用成功的回调函数 |
| fail | function |  | 否 | 接口调用失败的回调函数 |
| complete | function |  | 否 | 接口调用结束的回调函数（调用成功、失败都会执行） |

## 返回值

### [MiniReportManager](/minigame/dev/api/data-analysis/MiniReportManager)

## 上报限制

单次游戏生命周期内，上报日志的条数最大为999条。
单条日志体积最大为16KB。
超出上报限制，日志将无法上报成功。

## 示例代码

```js
let logger = null;
if (wx.getMiniReportManager) {
  logger = wx.getMiniReportManager({
    debug: true,
    eventList: ['10000003'],
  });
}

logger.report({
    eventID: '10000003', // 事件ID
    levelID: 1, // 关卡ID
    levelName: '第三关', // 关卡名称
    levelAction: 1, // 关卡类型
    levelResult: 2, // 关卡动作
    levelTime: 40, // 关卡用时
    levelProgress: 75, // 关卡进度
    externInfo: '{ fail_reason: 1 }', // 自定义属性
    gameVersion: 3, // 版本号
    loginCount: 1, // 关卡进入次数
    success(res) {
      console.log('success', res)
    },
    fail(res) {
      console.log('fail', res)
   },
    complete(res) {
      console.log('complete', res)
    }
  });
```
