企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## 概述 1. 一张报表,掌握全端数据。业务介绍详见[https://tongji.dcloud.net.cn](https://tongji.dcloud.net.cn/) 2. 开发者可通过本API自定义上报统计数据,如统计登录、注册、点击某个按钮,我们都可以称之为自定义事件 格式 ``` uni.report( eventName , options) ``` | 参数 | 类型 | 描述 | | --- | --- | --- | | eventName | String | 事件名称,最大长度不超过 255 个字符 | | options | String 、 Object | 事件参数 | 提示 1. eventName 为 title 时为内容标题上报,用户不能自定义。此时数据会展现在uni统计的首页-内容统计及左侧导航的内容统计中。方便查看内容页数据 2. 用户在使用`uni.login()`会执行登录事件,不携带参数。如果如需上报携带具体参数的数据,需要手动调用`uni.report('login',{...})` 3. 用户在使用`uni.share()`或触发`onShareAppMessage`会执行分享事件,不携带参数。如果如需上报携带具体参数的数据,需要手动调用`uni.report('share',{...})` 4. 用户在使用`uni.requestPayment()`会执行支付事件,不携带参数。如果如需上报携带具体参数的数据,需要手动调用`uni.report('pay_success',{...})`和`uni.report('pay_fail',{...})` 示例 ``` // 内容统计 // 当 eventName 为 title 时,options 只能为 String 类型 uni.report('title','首页') // 登录 uni.report('login',{ 'name':'uni-app', 'age':'21', // ... }) // 分享 uni.report('share','分享') // 支付成功 uni.report('pay_success','支付成功') // or uni.report('pay_success',{ "订单金额":'20元', "订单名称":'鼠标', // ... }) // 支付失败 uni.report('pay_fail','支付失败') // or uni.report('pay_fail',{ "订单金额":'20元', "订单名称":'鼠标', // ... }) // 注册 uni.report('register',{ 'name':'uni-app', 'age':'21', // ... }) // 搜索 uni.report('search','搜索内容') // or uni.report('search',{ '内容':'搜索内容' }) ```