English
注意
您正在浏览的是老版uni统计1.0的文档。推荐升级到uni统计2.0
uni-app 2.2.3+ version adds uni statistics 1.0
, which supports business statistics on the whole platform, including App, H5 and various small programs.
Web console address: https://tongji.dcloud.net.cn
Since uni-app version 2.2.3, the uni-app
project will enable uni statistics by default when it is released. .net.cn) to view the data report.
But since uni-app 2.7, the default is changed to not enabled. It needs to be manually configured in the manifest.
Open the manifest in HBuilderX and select uni statistics, as shown below:
If you don't use HBuilderX, you can also manually turn off uni statistics in the source view of manifest.json
Set the enable
field under manifest.json -> uniStatistics
to false
to turn off uni statistics
//...
"uniStatistics": {
"enable": false//全局关闭
},
//...
Note: uniStatistics
supports sub-platform settings. For example, if you only need to turn off uni statistics on the WeChat platform, you can set uniStatistics ->enable
under the mp-weixin
node, as follows:
//...
"mp-weixin":{
"uniStatistics": {
"enable": false //微信平台关闭统计
}
}
Because each applet needs to configure a whitelist for the accessible domain names, otherwise it will not be able to connect to the Internet, so you need to add tongji.dcloud.io
to the server domain name list. For detailed tutorials, please refer to https://ask.dcloud.net.cn/article/36298
The application will not report statistical data when it is running or debugged. It will only report the data after launching the new version of the app, h5, and applet.
Website of uni statistical report: https://tongji.dcloud.net.cn
Please use the correct DCloud account to log in to the background. After logging in with each DCloud account, you can see the applications created under your own name. If you don't see the expected app, then the account is not the owner of an app.
If the owner of the project corresponding to the appid changes, please refer to How to transfer the app
There is a delay in the update of the data report. After the data is reported on the mobile phone, the data can be seen in the background report after a delay of tens of minutes.
uni statistics
uses appid to distinguish different applications, so when compiling the project, if it is found that the current application is not configured with appid, the following warning will be displayed on the console:
当前应用未配置Appid,无法使用uni统计
At this point, developers can create applications through the two portals of HBuilderX and DCloud Developer Center to obtain the Appid.
Method 1. Log in to HBluiderX to obtain
Log in first in HBluiderX, then open manifest.json
in the project root directory, click to get APPID
in the visual interface, no other settings are required, as shown below
Method 2. Log in to DCud Developer Center to get it (coming soon)
Log in to DCloud Developer Center, create an application online, and then fill in the appid of the new application into manifest.json
{
// ...
"appid":"创建的 appid"
// ...
}
Tips
APPID
must be configured for normal useAPPID
obtained and created is bound to your DCloud
account, please do not fill in it at will, otherwise the report content will not be obtained normallymanifest.json
is configured with uni statistics enabledHBuilderX
has been upgraded to 2.2.3
or above, and whether CLI
has been upgraded to the latest version.tongji.dcloud.io
is added to the server domain name list of the appletHow to use custom events
Use the uni.report()
API to report data, see Custom Event Description
What is content statistics / how to configure page rules Content statistics is one of the characteristic functions of uni statistics. It is the access statistics of the content details page. For details, please refer to Content Statistics Description
Importing old data and combining statistics is not supported. uni statistics need to have data after it is opened and online
It is illegal to sell user data or share data to a third party without the user's consent. DCloud strictly complies with national legal requirements, and uni statistics can be used with peace of mind.