Skip to main content

Plugin Support

Because after using third-party plug-ins, the mini program does not allow rewriting of App and Page objects, and does not allow modification of the definition of the official API, resulting in monitoring failure. The probe provides a solution for plug-ins, which requires manual calling of the probe interface to support it. Plug-in related APIs need to be used with the plug-in mode turned on, and the settings in the probe startup configuration will take effect. After the plug-in mode is turned on, the probe will not actively monitor and requires manual settings by the user.

  • In order to solve errors caused by low-version startup monitoring, the mini program probe plug-in mode is enabled by default. That is, the default behavior of the probe is Do not start monitoring if the Mini Program SDK version is lower than 2.6.4, and automatically start monitoring if the version is 2.6.4 or above (When the WeChat Mini Program SDK releases the introduction of plug-ins in 2.6.4 and later versions restrictions, so monitoring can be started directly). If the mini program project is lower than 2.6.4 and does not use plug-ins, you can force the plug-in mode to be turned off by configuring plugin: false to monitor the lower version.
  • The enterprise WeChat applet may default to a lower SDK version. If there is no data and no plug-ins are used, it is recommended to set plugin: false to turn off the plug-in mode.

Identifies the use of plug-ins

In the mini program probe initialization configuration, you can set the plug-in mode switch: plugin.

  • true: enable
  • false: off

Example:

monitor.config({
...,
plugin: true,
...
})

App

Use the hookApp interface to encapsulate the original parameters of the App.

app.js

const monitor = require('./agent/tingyun-mp-agent.js');


App(monitor.hookApp({
onLaunch: function() {

},
...

}))

Page

Use the hookPage interface to encapsulate the original parameters of Page.

const monitor = require('./agent/tingyun-mp-agent.js');

Page(monitor.hookPage({
onLoad: function() {

},
...
}))

Component

Use hookComponent for building pages using components.

const monitor = require('./agent/tingyun-mp-agent.js');

Component(monitor.hookComponent({

...
}))

Network request

Use the interface monitor.request provided by the probe to send a network request, and the parameters are consistent with the official wx.request interface.

const monitor = require('./agent/tingyun-mp-agent.js');

monitor.request({
url: '...'
});