Data collection method and device based on applet, storage medium and electronic device

By identifying the software environment and switching APIs in mini-programs, the difficulty in monitoring caused by differences in the APIs of different mini-programs is solved, improving the versatility of the SDK and reducing costs.

CN112463515BActive Publication Date: 2024-09-20BEIJING GRIDSUM TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN201910848564.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-09
Publication Date
2024-09-20
Estimated Expiration
2039-09-09

AI Technical Summary

Technical Problem

The APIs of mini programs on different platforms are different, making it difficult for the SDK to monitor the data of different mini programs, which increases production and maintenance costs.

Method used

Through the software development toolkit SDK deployed in the target applet, the software environment is identified, the target API is determined, and multiple APIs are built into the SDK to realize API switching to be compatible with different applets.

Benefits of technology

It improves the versatility of the SDK, reduces production and maintenance costs, and achieves monitoring compatibility for small programs with different APIs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112463515B
    Figure CN112463515B
Patent Text Reader

Abstract

The present disclosure relates to a data collection method and device based on mini-programs, a storage medium and an electronic device. The method comprises identifying the software environment of a target mini-program through a software development kit SDK deployed in the target mini-program to obtain the target software environment; determining a target application programming interface API corresponding to the target mini-program according to the target software environment; setting the API in the software development kit SDK for collecting data of the target mini-program as the target application programming interface API, wherein the software development kit SDK has application programming interface APIs corresponding to the software environments of multiple mini-programs respectively built in; and the software development kit SDK collects data of the target mini-program through the target application programming interface API.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of information technology, and in particular, to a data collection method and device based on a small program, a storage medium, and an electronic device. Background Art

[0002] Many current applications have added mini-program functions, which can be opened and used in a timely manner when needed without the need to download and install, thus improving the convenience of program application.

[0003] In order to improve the functions of mini programs and provide better user services, mini program monitoring SDK (Software Development Kit) is also widely used in mini program monitoring. Since different mini program platforms usually modify the API (Application Programming Interface) of the mini program framework, the mini program APIs of different platforms are different, and the SDK can only monitor the mini programs with the same API settings, which makes it difficult to monitor the data of mini programs. Summary of the invention

[0004] The purpose of the present disclosure is to provide a data collection method and device based on a small program, a storage medium and an electronic device to solve the above problems.

[0005] In order to achieve the above-mentioned objectives, the first aspect of the present disclosure provides a data collection method based on mini-programs, comprising: identifying the software environment of the target mini-program through a software development kit SDK deployed in the target mini-program to obtain the target software environment; determining the target application programming interface API corresponding to the target mini-program according to the target software environment; setting the API in the software development kit SDK for collecting data of the target mini-program to the target application programming interface API, wherein the software development kit SDK has built-in application programming interface APIs corresponding to multiple mini-program environments; the software development kit SDK collects data of the target mini-program through the target application programming interface API.

[0006] Optionally, the software environment of the target applet is identified by a software development kit SDK deployed in the target applet to obtain the target software environment, including: obtaining the global variable information of the target applet through the SDK deployed in the target applet; determining the target software environment of the target applet according to the environment identification information in the global variable information; determining the target application programming interface API corresponding to the target applet according to the target software environment, including: determining the target API corresponding to the target software environment in the SDK according to the target software environment and the preset correspondence between the software environment and the API. Optionally, determining the target API corresponding to the target applet includes: in response to receiving an API call instruction, using the API called by the API call instruction as the target API corresponding to the target applet.

[0007] Optionally, the method further includes: in response to receiving an API calling instruction, using the API called by the API calling instruction as the target API corresponding to the target applet.

[0008] Optionally, the preset correspondence is recorded in a mapping table; determining the target API corresponding to the target software environment in the SDK based on the target software environment and the preset correspondence between the software environment and the API includes: querying the target API corresponding to the target software environment in the mapping table.

[0009] According to a second aspect of the present disclosure, there is provided a data collection device based on a mini-program, comprising: a first determination module, for identifying the software environment of the target mini-program through a software development kit SDK deployed in the target mini-program to obtain a target software environment; a second determination module, for determining a target application programming interface API corresponding to the target mini-program according to the target software environment; a processing module, for setting the API used by the software development kit SDK for monitoring mini-programs to collect data of the target mini-program as the target API, wherein the SDK has built-in APIs for multiple software environments; and a collection module, for collecting data of the target mini-program through the SDK.

[0010] Optionally, the first determination module includes: an acquisition sub-module, used to obtain the global variable information of the target applet through the SDK deployed in the target applet; a determination sub-module, used to determine the software environment of the target applet according to the environment identification information in the global variable information; the second determination module, used to determine the target API in the SDK corresponding to the target software environment according to the target software environment and the preset correspondence between the software environment and the API.

[0011] Optionally, the device further comprises a third determination module, configured to, in response to receiving an API calling instruction, use the API called by the API calling instruction as the target API corresponding to the target applet.

[0012] Optionally, the preset corresponding relationship is recorded in a mapping table; and the second determining submodule is used to query the target API corresponding to the target software environment in the mapping table.

[0013] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of any method described in the first aspect of the present disclosure are implemented.

[0014] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a memory on which a computer program is stored; and a processor for executing the computer program in the memory to implement the steps of any one of the methods described in the first aspect of the present disclosure.

[0015] Through the above technical solution, at least the following effects can be achieved:

[0016] The target API corresponding to the software environment of the target mini-program can be determined according to the software environment of the mini-program, so that compatibility with different mini-programs can be achieved by switching the SDK's API. Further, an SDK with built-in APIs for multiple software environments can be used to monitor mini-programs with different APIs, thereby improving the versatility of the SDK used to monitor mini-programs. Compared with the prior art method of using different SDKs to monitor mini-programs with different APIs, the SDK's production and maintenance costs are reduced.

[0017] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:

[0019] Figure 1 It is a flowchart of a data collection method based on a small program according to an exemplary disclosed embodiment.

[0020] Figure 2 It is a block diagram of a data collection device based on a small program according to an exemplary disclosed embodiment.

[0021] Figure 3It is a block diagram of a data collection electronic device based on a small program according to an exemplary disclosed embodiment.

[0022] Figure 4 It is a block diagram of a data collection electronic device based on a small program according to an exemplary disclosed embodiment. DETAILED DESCRIPTION

[0023] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.

[0024] First, the application scenario of the present disclosure is explained. Depending on the different platforms or other reasons during development, the APIs corresponding to different mini-programs may be different. For example, the API corresponding to the WeChat mini-program is usually wx.request, while the API corresponding to the Alipay mini-program is usually my.request. The technical frameworks of these platforms are basically the same, and the processing logic of the SDK is also the same. However, due to the different APIs, when collecting data for mini-programs, it is often necessary to make different SDKs for different mini-programs. Such SDKs lack versatility and will also increase the production and maintenance costs of the SDK.

[0025] Figure 1 is a flowchart of a data collection method based on a small program according to an exemplary disclosed embodiment. Figure 1 As shown, the method comprises the following steps:

[0026] S11. Identify the software environment of the target applet through the software development kit SDK deployed in the target applet to obtain the target software environment.

[0027] Specifically, the target software environment can be determined in the following ways:

[0028] Acquire global variable information of the target applet; and determine the software environment of the target applet according to environment identification information in the global variable information.

[0029] A mini program may have multiple global variables, among which there may be global variables that can identify the software environment. For example, the global variable wx identifies the software environment as WeChat, the global variable qq identifies the software environment as QQ, the global variable my identifies the software environment as Alipay, etc. These global variables that can identify the software environment are environment identification information. The software environment corresponding to the environment identification information can be determined through the environment identification information in the global variable information.

[0030] S12. Determine a target application programming interface API corresponding to the target applet according to the target software environment.

[0031] After determining the target software environment, the API in the SDK can be switched to the API corresponding to the target software environment according to the preset correspondence. For example, when the environment identification information is wx, the target software environment is WeChat, and the network request sending API corresponding to the target software environment is wx.request; when the environment identification information is my, the target software environment is Alipay, and the network request sending API corresponding to the target software environment is my.request.

[0032] Optionally, the preset correspondence is recorded in a mapping table, which may be integrated in the SDK. After the target software environment is determined, the target API corresponding to the target software environment may be queried in the mapping table, and the API may be switched to the target API.

[0033] In addition, in response to receiving an API calling instruction, the API called by the API calling instruction can be used as the target API corresponding to the target applet.

[0034] It should be noted that the developer can specify the API corresponding to the mini-program, and in response to the developer's API call instruction, the API called by the API call instruction can be used as the target API, that is, in this embodiment, the priority of the API called by the API call instruction is higher than the API obtained by automatically identifying the software environment adaptation of the mini-program, so that in special cases, the API required by the user can be called according to the API call instruction, thereby modifying or supplementing the automatic adaptation result. In this way, when the API of the mini-program is changed, the SDK API can be flexibly modified according to the API change, thereby reducing maintenance costs.

[0035] S13. Setting the API used by the software development kit SDK to collect data of the target applet as the target API, wherein the SDK has built-in APIs corresponding to the software environments of multiple applet programs.

[0036] It is worth noting that there are multiple APIs for different purposes in the mini program, so there are also multiple corresponding APIs built into the SDK. For example, UpdateManager.onUpdateFailed is an API for monitoring mini program update failure events, wx.getLaunchOptionsSync is an API for obtaining parameters when the WeChat mini program is started, and wx.request is an API for the WeChat mini program to send network requests. According to the target API corresponding to the target software environment determined in step S12, the API for collecting the target mini program in the SDK can be switched to the target API so that the SDK can collect data through the target API.

[0037] Among them, APIs under various software environments can be pre-configured in the SDK, for example, APIs corresponding to WeChat, APIs corresponding to Alipay, etc., so that according to the actual monitored software environment, it is possible to easily switch to the API corresponding to the software environment.

[0038] S14. The SDK collects data of the target applet through the target API.

[0039] Among them, the SDK is pre-deployed in the target applet. After completing the switching of the SDK API, the SDK is compatible with the interface of the target applet, and the data of the target applet can be directly collected through the SDK.

[0040] Through the above technical solution, at least the following effects can be achieved:

[0041] The target API corresponding to the software environment of the target mini-program can be determined according to the software environment of the mini-program, so that compatibility with different mini-programs can be achieved by switching the SDK's API. Further, an SDK with built-in APIs for multiple software environments can be used to monitor mini-programs with different APIs, thereby improving the versatility of the SDK used to monitor mini-programs. Compared with the prior art method of using different SDKs to monitor mini-programs with different APIs, the SDK's production and maintenance costs are reduced.

[0042] Figure 2 is a block diagram of a data collection device based on a small program according to an exemplary disclosed embodiment. Figure 2 As shown, the data collection device based on the applet includes a first determination module 210 , a second determination module 220 , a processing module 230 and a collection module 240 .

[0043] The first determination module 210 is used to identify the software environment of the target applet through the software development kit SDK deployed in the target applet to obtain the target software environment.

[0044] Specifically, the target software environment can be determined in the following ways:

[0045] Acquire global variable information of the target applet; and determine the target software environment of the target applet according to the environment identification information in the global variable information.

[0046] A mini program may have multiple global variables, among which there may be global variables that can identify the software environment. For example, the global variable wx identifies the software environment as WeChat, the global variable qq identifies the software environment as QQ, the global variable my identifies the software environment as Alipay, etc. These global variables that can identify the software environment are environment identification information. The software environment corresponding to the environment identification information can be determined through the environment identification information in the global variable information.

[0047] The second determination module 220 is used to determine the target application programming interface API corresponding to the target applet according to the target software environment. After determining the target software environment, the API in the SDK can be switched to the API corresponding to the target software environment according to the preset correspondence. For example, when the environment identification information is wx, the target software environment is WeChat, and the network request sending API corresponding to the target software environment is wx.request; when the environment identification information is my, the target software environment is Alipay, and the network request sending API corresponding to the target software environment is my.request.

[0048] Optionally, the preset correspondence is recorded in a mapping table, which may be integrated in the SDK. After the target software environment is determined, the target API corresponding to the target software environment may be queried in the mapping table, and the API may be switched to the target API.

[0049] Optionally, the third determination module may also, in response to receiving an API call instruction, use the API called by the API call instruction as the target API corresponding to the target applet.

[0050] Developers can specify the API corresponding to the mini-program. In response to the API call instruction of the developer, the API called by the API call instruction can be used as the target API. That is, in this embodiment, the priority of the API called by the API call instruction is higher than the API obtained by automatically identifying the mini-program environment adaptation. Therefore, in special cases, the API required by the user can be called according to the API call instruction, thereby modifying or supplementing the automatic adaptation result. In this way, when the API of the mini-program is changed, the API of the SDK can be flexibly modified according to the API change, thereby reducing maintenance costs.

[0051] The processing module 230 is used to set the API used by the software development kit SDK for monitoring the mini-program to collect data of the target mini-program as the target API, wherein the SDK has built-in APIs under multiple software environments.

[0052] It is worth noting that there are multiple APIs for different purposes in the mini program, so there are also multiple corresponding APIs built into the SDK. For example, UpdateManager.onUpdateFailed is an API for monitoring mini program update failure events, wx.getLaunchOptionsSync is an API for obtaining parameters when the WeChat mini program is started, and wx.request is an API for the WeChat mini program to send network requests. According to the target API corresponding to the target software environment determined in step S12, the API for collecting the target mini program in the SDK can be switched to the target API so that the SDK can collect data through the target API.

[0053] Among them, APIs under various software environments can be pre-configured in the SDK, for example, APIs corresponding to WeChat, APIs corresponding to Alipay, etc., so that according to the actual monitored software environment, it is possible to easily switch to the API corresponding to the software environment.

[0054] The collection module 240 is used for the SDK to collect data of the target applet through the target API.

[0055] Among them, the SDK is pre-deployed in the target applet. After completing the switching of the SDK API, the SDK is compatible with the interface of the target applet, and the data of the target applet can be directly collected through the SDK.

[0056] Optionally, the first determination module includes: an acquisition sub-module, used to obtain the global variable information of the target applet through the SDK deployed in the target applet; a determination sub-module, used to determine the software environment of the target applet according to the environment identification information in the global variable information; the second determination module, used to determine the target API in the SDK corresponding to the target software environment according to the target software environment and the preset correspondence between the software environment and the API.

[0057] Optionally, the device further comprises a third determination module, configured to, in response to receiving an API calling instruction, use the API called by the API calling instruction as the target API corresponding to the target applet.

[0058] Optionally, the preset corresponding relationship is recorded in a mapping table; and the second determining submodule is used to query the target API corresponding to the target software environment in the mapping table.

[0059] Through the above technical solution, at least the following effects can be achieved:

[0060] The target API corresponding to the software environment of the target mini-program can be determined according to the software environment of the mini-program, so that compatibility with different mini-programs can be achieved by switching the SDK's API. Further, an SDK with built-in APIs for multiple software environments can be used to monitor mini-programs with different APIs, thereby improving the versatility of the SDK used to monitor mini-programs. Compared with the prior art method of using different SDKs to monitor mini-programs with different APIs, the SDK's production and maintenance costs are reduced.

[0061] Figure 3 FIG. 1 is a block diagram of an electronic device 300 according to an exemplary embodiment. Figure 3 As shown, the electronic device 300 may include: a processor 301 , a memory 302 . The electronic device 300 may also include one or more of a multimedia component 303 , an input / output (I / O) interface 304 , and a communication component 305 .

[0062] The processor 301 is used to control the overall operation of the electronic device 300 to complete all or part of the steps in the above-mentioned data collection method based on the applet. The memory 302 is used to store various types of data to support the operation of the electronic device 300, and these data may include, for example, instructions for any application or method used to operate on the electronic device 300, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, disk or optical disk. The multimedia component 303 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 302 or sent through the communication component 305. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 304 provides an interface between the processor 301 and other interface modules, and the other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 305 is used for wired or wireless communication between the electronic device 300 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 305 may include: Wi-Fi module, Bluetooth module, NFC module, etc.

[0063] In an exemplary embodiment, the electronic device 300 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned applet-based data acquisition method.

[0064] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned data collection method based on the applet are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 302 including program instructions, and the above-mentioned program instructions can be executed by the processor 301 of the electronic device 300 to complete the above-mentioned data collection method based on the applet.

[0065] Figure 4 4 is a block diagram of an electronic device 400 according to an exemplary embodiment. For example, the electronic device 400 may be provided as a server. Figure 4 The electronic device 400 includes a processor 422, which may be one or more, and a memory 432 for storing a computer program executable by the processor 422. The computer program stored in the memory 432 may include one or more modules each corresponding to a set of instructions. In addition, the processor 422 may be configured to execute the computer program to perform the above-mentioned applet-based data collection method.

[0066] In addition, the electronic device 400 may further include a power supply component 426 and a communication component 450, wherein the power supply component 426 may be configured to perform power management of the electronic device 400, and the communication component 450 may be configured to implement communication of the electronic device 400, for example, wired or wireless communication. In addition, the electronic device 400 may further include an input / output (I / O) interface 458. The electronic device 400 may operate based on an operating system stored in the memory 432, such as Windows ServerTM, Mac OSXTM, UnixTM, LinuxTM, etc.

[0067] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned data collection method based on the applet are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 432 including program instructions, and the above-mentioned program instructions can be executed by the processor 422 of the electronic device 400 to complete the above-mentioned data collection method based on the applet.

[0068] In another exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned applet-based data collection method when executed by the programmable device.

[0069] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0070] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0071] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A data collection method based on a small program, characterized in that: include: Identify the software environment of the target applet by using a software development kit SDK deployed in the target applet to obtain the target software environment; The software environment of the target applet is identified by a software development kit SDK deployed in the target applet to obtain the target software environment, including: Acquire the global variable information of the target applet through the SDK deployed in the target applet; Determining the target software environment of the target applet according to the environment identification information in the global variable information; According to the target software environment, determining a target application programming interface API corresponding to the target applet; Determining a target application programming interface API corresponding to the target applet according to the target software environment includes: Determine a target API in the SDK corresponding to the target software environment according to the target software environment and a preset correspondence between the software environment and the API; The API used to collect data of the target applet in the software development kit SDK is set as the target application programming interface API, wherein the software development kit SDK has application programming interface APIs corresponding to the software environments of multiple applet built in; The software development kit SDK collects data of the target applet through the target application programming interface API.

2. The method according to claim 1, characterized in that: The method further comprises: In response to receiving the API calling instruction, the API called by the API calling instruction is used as the target API corresponding to the target applet.

3. The method according to claim 1, characterized in that The preset corresponding relationship is recorded in a mapping table; The determining, according to the target software environment and the preset correspondence between the software environment and the API, a target API in the SDK corresponding to the target software environment includes: The target API corresponding to the target software environment is queried in the mapping table.

4. A data collection device based on a small program, characterized in that: include: A first determination module is used to identify the software environment of the target applet through a software development kit SDK deployed in the target applet to obtain a target software environment; The first determining module includes: An acquisition submodule, used to acquire the global variable information of the target applet through the SDK deployed in the target applet; A determination submodule, used to determine the software environment of the target applet according to the environment identification information in the global variable information; A second determination module is used to determine a target application programming interface API corresponding to the target applet according to the target software environment; Determining a target application programming interface API corresponding to the target applet according to the target software environment includes: Determine a target API in the SDK corresponding to the target software environment according to the target software environment and a preset correspondence between the software environment and the API; A processing module, used to set an API used by a software development kit SDK for monitoring mini-programs to collect data of the target mini-program as the target API, wherein the SDK has built-in APIs under multiple software environments; The collection module is used for the SDK to collect data of the target applet through the target API.

5. The device according to claim 4, characterized in that The device also includes a third determination module, which is used to, in response to receiving an API calling instruction, use the API called by the API calling instruction as the target API corresponding to the target applet.

6. The device according to claim 4, characterized in that The preset corresponding relationship is recorded in a mapping table; the second determination module is used to query the target API corresponding to the target software environment in the mapping table.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 3 are implemented.

8. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • System and method based on SDK for rapidly building mobile internet application module

    CN103559040A

  • Multi-channel SDK (software development kit) access system and multi-channel SDK access system for mobile terminal software

    CN104363264A

  • Advertisement display method and device and terminal equipment

    CN106779810A

  • Application version compatible processing method and device

    CN109032820A

  • Program calling method and device

    CN109582400A