Methods, systems, electronic devices, and storage media for reproducing user behavior
Patent Information
- Application Number
- CN202310644902.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-01
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2043-06-01
AI Technical Summary
[0008]本发明要解决的技术问题是为了克服现有技术中无法在只采集少量数据的情况下,复现用户在小程序中的操作行为的缺陷,提供一种用户行为的还原方法、系统、电子设备及存储介质
Smart Images

Figure CN116662071B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated testing, and more specifically to a method, system, electronic device, and storage medium for reproducing user behavior. Background Technology
[0002] In existing technologies, two methods are generally used to recreate user actions on web pages.
[0003] Method 1
[0004] By continuously executing a core dump, the program's memory state at that moment is recorded and saved to a file. A core dump can be considered a "memory snapshot," but in reality, in addition to memory information, some critical program runtime states are also dumped simultaneously, such as register information (including the program pointer, stack pointer, etc.), memory management information, and other processor and operating system states and information. A core dump file can reproduce a user's actions within a certain timeframe. However, this method is not suitable for small programs.
[0005] Method 2
[0006] This method records all function calls made during program execution, reproducing user actions over a specific time period. However, the data collected requires excessive storage space, making it unsuitable for client-side use.
[0007] How to reproduce user behavior in a mini-program with only a small amount of data has become a difficult problem that needs to be solved by those skilled in the art. Summary of the Invention
[0008] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art in which it is impossible to reproduce the user's operation behavior in a mini-program when only a small amount of data is collected, and to provide a method, system, electronic device and storage medium for restoring user behavior.
[0009] The present invention solves the above-mentioned technical problems through the following technical solution:
[0010] This invention provides a method for restoring user behavior, the method comprising:
[0011] During the process of a target user entering and leaving the target page of the mini-program, the runtime environment data of the mini-program, the Storage data generated by the mini-program, global variable data, and function data are collected.
[0012] User behavior is reconstructed based on the runtime environment data, the Storage data, the global variable data, and the function data.
[0013] Optionally, the function data consists of the identifier of a specified function called by the mini-program and the parameters in the specified function; the specified function includes at least one of user operation functions, network request response functions, and system functions, and different specified functions correspond one-to-one with different identifiers.
[0014] Optionally, the restoration method further includes: collecting the code of the mini-program.
[0015] Optionally, the step of reconstructing user behavior based on the runtime environment data, the Storage data, the global variable data, and the function data specifically includes:
[0016] The code is constructed to obtain the development version entry address of the mini-program;
[0017] Enter the mini program using the development version entry address;
[0018] Load the runtime environment data, the Storage data, and the global variable data;
[0019] Access the target page;
[0020] The specified functions are executed sequentially according to the time order in which the function data is collected.
[0021] Optionally, the step of collecting the Storage data generated by the mini-program specifically includes:
[0022] When performing the first read operation on the Key (the object in the Storage data), the Key in the Storage data is recorded.
[0023] Optionally, the step of reconstructing user behavior based on the runtime environment data, the Storage data, the global variable data, and the function data further includes:
[0024] If a cross-page function exists among the specified functions, the cross-page function is skipped, and other specified functions whose time order follows the cross-page function are executed directly; the cross-page function indicates that the execution requires entering another page from the target page.
[0025] Optionally, the step of loading the runtime environment data, the Storage data, and the global variable data specifically includes:
[0026] Modify the Date object of the mini-program based on the runtime environment data;
[0027] Write the Storage data and the global variable data into the mini-program.
[0028] The present invention also provides a user behavior restoration system, the restoration system comprising:
[0029] The data collection module is used to collect the runtime environment data, Storage data generated by the mini-program, global variable data, and function data of the mini-program during the process of the target user entering the target page of the mini-program and leaving the target page.
[0030] The restoration module is used to restore user behavior based on the runtime environment data, the Storage data, the global variable data, and the function data.
[0031] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the aforementioned method for restoring user behavior.
[0032] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the aforementioned method for restoring user behavior.
[0033] The positive and progressive effects of this invention are as follows: This invention can reproduce the user's operation behavior in the mini-program with only a small amount of data, enabling merchants to understand the specific situation when the user operates in the mini-program. Attached Figure Description
[0034] Figure 1 A flowchart of a user behavior restoration method provided in Embodiment 1 of the present invention.
[0035] Figure 2 This is a schematic diagram of the user behavior restoration system provided in Embodiment 2 of the present invention.
[0036] Figure 3 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Detailed Implementation
[0037] The present invention will be further illustrated by way of embodiments below, but the present invention is not limited to the scope of the embodiments described herein.
[0038] Example 1
[0039] This embodiment provides a method for restoring user behavior, such as... Figure 1 As shown, the restoration method includes:
[0040] S101. During the process of the target user entering the target page of the mini program and leaving the target page, collect the mini program's runtime environment data, the storage data generated by the mini program, global variable data, and function data.
[0041] The runtime environment data includes system time, time zone, and user screen size, etc., which are not limited in this embodiment. Global variable data includes the values of global variables that the target page depends on.
[0042] Specifically, in step S101, data can be collected by introducing an SDK (Software Development Kit) into the target page, or by using event tracking. The specific data collection method can be determined based on the actual situation, and this embodiment does not impose any restrictions on it. After step S101, an identifier can be assigned to the collected data, and then the data can be stored in the database using the identifier as the primary key, making it convenient to retrieve the collected data later using the identifier.
[0043] S102. Reconstruct user behavior based on runtime environment data, Storage data, global variable data, and function data.
[0044] This embodiment provides a method for reproducing user behavior. This method can reproduce the user's operation behavior in the mini program with only a small amount of data, so that merchants can understand the specific situation when the user operates in the mini program.
[0045] In one optional implementation, the function data consists of the identifier of the specified function called by the mini-program and the parameters in the specified function; the specified function includes at least one of user operation functions, network request response functions and system functions, and different specified functions correspond one-to-one with different identifiers.
[0046] The user operations can be configured according to actual needs, generally including common operations such as clicking, swiping, and zooming; this embodiment does not impose any restrictions on these. System functions can be configured according to actual needs, generally including timer functions, message push functions, and Bluetooth functions; this embodiment does not impose any restrictions on these.
[0047] Specifically, when collecting function data, only the identifier corresponding to the specified function and the parameters in the specified function are collected, instead of the entire code of the specified function, thus reducing the amount of data collected. The type of identifier can be determined according to the actual situation, and this embodiment does not impose any restrictions on it.
[0048] In one optional implementation, the restoration method further includes:
[0049] S103, Collect the code of the mini-program.
[0050] Specifically, because mini-programs are updated rapidly, the version of the mini-program used when a user performs an action may be different from the version of the mini-program on the system when the user's behavior is reconstructed. For example, the user may have performed an action on a version 2.0 mini-program, but when the user's behavior is reconstructed, the mini-program on the system may have been updated to version 3.0. Generally, it is impossible to completely reconstruct user behavior in one version of a mini-program. To ensure that the version of the mini-program used when reconstructing user behavior is the same as the version used when the user performed the action, the mini-program's code is collected before step S101. During the process of reconstructing user behavior, the collected code is used to build the development version entry address of the specific version of the mini-program used by the user during the action. Furthermore, the collected code can be stored in a code repository using the code version as the BuildID.
[0051] In one optional implementation, step S102 specifically includes:
[0052] S1021. Build the code to obtain the entry address of the development version of the mini program.
[0053] S1022. Enter the mini program using the mini program's developer version entry address.
[0054] S1023, Load runtime environment data, Storage data, and global variable data.
[0055] S1024. Enter the target page.
[0056] S1025. Execute the specified functions sequentially according to the time order in which the function data was collected.
[0057] Specifically, if the data collected in step S101 is stored in the database using an identifier as the primary key, the collected data can be retrieved using the identifier. If the collected code is stored using the code version as the BuildID in step S103, the code can be retrieved from the code repository using the BuildID.
[0058] Specifically, during steps S1024 and S1025, video recording can be performed, and the recording ends after step S1025 is completed, storing the resulting video on the system server. Furthermore, after the video recording and storage are complete, a notification can be sent to the user, allowing them to view the video on the system. By viewing the screen recording, customers can gain a better understanding of their actions within the mini-program, improving the user experience.
[0059] Specifically, the mini-program can be built using Airtest (a cross-platform UI automation testing framework) or other automation testing tools; this embodiment does not limit this.
[0060] Specifically, in step S1025, the code of the specified function can be obtained by reverse lookup of the identifier of the collected specified function, and then the collected parameters corresponding to the specified function can be substituted into the code to achieve automatic execution of the specified code.
[0061] Specifically, in step S1025, due to reasons such as poor device performance, the system time when executing the specified function may be later than the corresponding system time collected. If the system time when executing the specified function is later than the corresponding system time collected, the subsequent specified function will automatically wait until the preceding specified function has finished executing. Only after the preceding specified function has finished executing will the subsequent specified function be executed.
[0062] In one optional implementation, step S101 specifically includes:
[0063] S1011. When performing the first read operation on the Key in the Storage data, record the Key in the Storage data.
[0064] Specifically, a key in Storage data can be read and written, with a read operation required before a write operation. A key typically appears multiple times in Storage data, resulting in multiple read and write operations. In this implementation, the key is only collected during the first read operation on the key in Storage data. This ensures that keys are not collected repeatedly or missed, reducing the amount of data collected and improving efficiency and accuracy.
[0065] In an optional implementation, step S102 further includes:
[0066] S1026. If a cross-page function exists among the specified functions, skip the cross-page function and directly execute the other specified functions that are executed after the cross-page function in the time sequence.
[0067] Among them, cross-page functions indicate that execution requires navigating from the target page to another page.
[0068] Specifically, because step S101 only collects data when the user is operating on the target page, if the user switches from the target page to another page via a cross-page function, performs operations on that page, and then switches back to the target page, a gap will occur when reconstructing the user behavior. By skipping the cross-page function and directly executing the subsequent specific function during user behavior reconstruction, this gap can be avoided.
[0069] In one optional implementation, step S1023 specifically includes:
[0070] S10231. Modify the Date object of the mini-program according to the runtime environment data.
[0071] Specifically, Date objects can be modified using a Proxy (network proxy) to simulate the system time and time zone when a user performs an operation.
[0072] S10232. Write Storage data and global variable data into the mini-program.
[0073] Example 2
[0074] This embodiment provides a system for restoring user behavior, such as... Figure 2 As shown, the restoration system 20 includes a data acquisition module 21 and a restoration module 22.
[0075] The data collection module is used to collect runtime environment data, Storage data generated by the mini-program, global variable data, and function data during the process of target users entering and leaving the target page of the mini-program.
[0076] The runtime environment data includes system time, time zone, and user screen size, etc., which are not limited in this embodiment. Global variable data includes the values of global variables that the target page depends on.
[0077] Specifically, the data collection module can collect data by including an SDK in the target page or by embedding tracking points. The specific data collection method can be determined based on the actual situation, and this embodiment does not impose any restrictions. The data collection module can also be used to match an identifier to the collected data, and then use the identifier as the primary key to store the data in the database, so that the collected data can be retrieved later by the identifier.
[0078] The restore module is used to restore user behavior based on runtime environment data, Storage data, global variable data, and function data.
[0079] This embodiment provides a user behavior reconstruction system. This system can reproduce the user's operation behavior in a mini-program by collecting only a small amount of data, so that merchants can understand the specific situation when the user operates in the mini-program.
[0080] In one optional implementation, the function data consists of the identifier of the specified function called by the mini-program and the parameters in the specified function; the specified function includes at least one of user operation functions, network request response functions and system functions, and different specified functions correspond one-to-one with different identifiers.
[0081] The user operations can be configured according to actual needs, generally including common operations such as clicking, swiping, and zooming; this embodiment does not impose any restrictions on these. System functions can be configured according to actual needs, generally including timer functions, message push functions, and Bluetooth functions; this embodiment does not impose any restrictions on these.
[0082] Specifically, when collecting function data, only the identifier corresponding to the specified function and the parameters in the specified function are collected, instead of the entire code of the specified function, thus reducing the amount of data collected. The type of identifier can be determined according to the actual situation, and this embodiment does not impose any restrictions on it.
[0083] In one alternative implementation, the restoration system further includes a code acquisition module.
[0084] The code collection module is used to collect the code of mini programs.
[0085] Specifically, because mini-programs are updated rapidly, the version of the mini-program used when a user performs an action may differ from the version on the system when the user's behavior is reconstructed. For example, a user might perform an action on a version 2.0 mini-program, but by the time the user's behavior is reconstructed, the mini-program on the system may have been updated to version 3.0. Generally, it's impossible to completely reconstruct user behavior in one version of a mini-program. To ensure that the version of the mini-program used for reconstructing user behavior matches the version used when the user performs the action, a code collection module is used to collect the mini-program's code. During the user behavior reconstruction process, the collected code is used to build the entry point of the development version of the mini-program used by the user during the action. Furthermore, the collected code can be stored in a code repository using the code version as the BuildID.
[0086] In one optional implementation, the restoration module is specifically used for: building the code to obtain the development version entry address of the mini-program; entering the mini-program according to the development version entry address; loading runtime environment data, Storage data, and global variable data; the target page unit is used in S1024 to enter the target page; and executing the specified functions sequentially according to the time order when collecting function data.
[0087] Specifically, if the data collected by the acquisition module is stored in the database using an identifier as the primary key, the acquired data can be retrieved using the identifier. If the code acquisition module stores the acquired code using the code version as the BuildID, the code can be retrieved from the code repository using the BuildID.
[0088] Specifically, the restore module can also be used for video recording, ending the recording after a specified function completes and storing the resulting video on the system server. Furthermore, after recording and storage, a notification can be sent to the user, allowing them to view the video on the system. By viewing the screen recording, customers can gain a better understanding of their actions within the mini-program, improving the user experience.
[0089] Specifically, the mini-program can be built using Airtest or other automated testing tools; this embodiment does not limit this.
[0090] Specifically, the restoration module can perform a reverse lookup on the identifier of the specified function to obtain the code of the specified function, and then substitute the collected parameters corresponding to the specified function into the code to achieve automatic execution of the specified code.
[0091] Specifically, due to factors such as poor device performance, the system time when the restoration module executes a specified function may be later than the corresponding system time collected. In cases where the system time when executing a specified function is later than the corresponding system time collected, subsequent specified functions will automatically wait until the preceding specified function has finished executing before proceeding.
[0092] In one alternative implementation, the acquisition module is specifically used to record the key in the storage data when performing the first read operation on the key in the storage data.
[0093] Specifically, a key in Storage data can be read and written, with a read operation required before a write operation. A key typically appears multiple times in Storage data, resulting in multiple read and write operations. In this implementation, the key is only collected during the first read operation on the key in Storage data. This ensures that keys are not collected repeatedly or missed, reducing the amount of data collected and improving efficiency and accuracy.
[0094] In one alternative implementation, the restore module is further used to skip cross-page functions in a specified function and directly execute other specified functions that are executed after the cross-page functions in the time sequence.
[0095] Among them, cross-page functions indicate that execution requires navigating from the target page to another page.
[0096] Specifically, because the data collection module only collects data when the user interacts on the target page, if the user switches from the target page to another page via a cross-page function, performs actions on that page, and then switches back to the target page, a gap will appear when reconstructing the user behavior. By skipping the cross-page function and directly executing the subsequent specific function during user behavior reconstruction, this gap can be avoided.
[0097] In one optional implementation, the restore module is further used to: modify the Date object of the mini-program according to the runtime environment data; and write the Storage data and global variable data into the mini-program.
[0098] Specifically, Date objects can be modified using a proxy to simulate the system time and time zone when a user performs an operation.
[0099] Example 3
[0100] Figure 3 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. It includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the method for restoring user behavior described in Embodiment 1 above. Figure 3 The electronic device 30 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0101] The electronic device 30 may be in the form of a general-purpose computing device, such as a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including memory 32 and processor 31).
[0102] Bus 33 includes a data bus, an address bus, and a control bus.
[0103] The memory 32 may include volatile memory, such as random access memory (RAM) 321 and / or cache memory 322, and may further include read-only memory (ROM) 323.
[0104] The memory 32 may also include a program / utility 325 having a set (at least one) of program modules 324, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0105] The processor 31 executes various functional applications and data processing by running computer programs stored in the memory 32, such as the user behavior restoration method of Embodiment 1 of the present invention.
[0106] Electronic device 30 can also communicate with one or more external devices 34 (e.g., keyboard, pointing device, etc.). This communication can be performed via input / output (I / O) interface 35. Furthermore, the model-generated device 30 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public network, such as the Internet) via network adapter 36. As shown, network adapter 36 communicates with other modules of the model-generated device 30 via bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the model-generated device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
[0107] It should be noted that although several units / modules or sub-units / modules of the electronic device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.
[0108] Example 4
[0109] The present invention also provides a computer-readable medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method for restoring user behavior as described in Embodiment 1 above.
[0110] The readable storage medium may be more specifically adopted, including but not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device, or any suitable combination thereof.
[0111] In a possible implementation, the present invention can also be implemented as a program product comprising program code, which, when the program product is run on a terminal device, is used to cause the terminal device to execute the method for restoring user behavior in Embodiment 1.
[0112] The program code for executing the present invention can be written in any combination of one or more programming languages. The program code can be executed entirely on the user device, partially on the user device, as a standalone software package, partially on the user device and partially on a remote device, or entirely on a remote device.
[0113] While specific embodiments of the present invention have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of the present invention is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but all such changes and modifications fall within the scope of protection of the present invention.
Claims
1. A method for reconstructing user behavior, characterized in that, The restoration method includes: During the process of a target user entering and leaving the target page of the mini-program, the runtime environment data of the mini-program, the Storage data generated by the mini-program, global variable data, and function data are collected. User behavior is reconstructed based on the runtime environment data, the Storage data, the global variable data, and the function data.
2. The method for reconstructing user behavior as described in claim 1, characterized in that, The function data consists of the identifier of the specified function called by the mini-program and the parameters in the specified function; the specified function includes at least one of user operation functions, network request response functions and system functions, and different specified functions correspond one-to-one with different identifiers.
3. The method for reconstructing user behavior as described in claim 2, characterized in that, The restoration method also includes: collecting the code of the mini-program.
4. The method for reconstructing user behavior as described in claim 3, characterized in that, The step of restoring user behavior based on the runtime environment data, the Storage data, the global variable data, and the function data specifically includes: The code is constructed to obtain the development version entry address of the mini-program; Enter the mini program using the development version entry address; Load the runtime environment data, the Storage data, and the global variable data; Access the target page; The specified functions are executed sequentially according to the time order in which the function data is collected.
5. The method for reconstructing user behavior as described in claim 1, characterized in that, The steps for collecting the Storage data generated by the mini-program specifically include: When performing the first read operation on the Key in the Storage data, the Key in the Storage data is recorded.
6. The method for reconstructing user behavior as described in claim 4, characterized in that, The step of restoring user behavior based on the runtime environment data, the Storage data, the global variable data, and the function data further includes: If a cross-page function exists among the specified functions, the cross-page function is skipped, and other specified functions whose time order follows the cross-page function are executed directly; the cross-page function indicates that the execution requires entering another page from the target page.
7. The method for reconstructing user behavior as described in claim 4, characterized in that, The step of loading the runtime environment data, the Storage data, and the global variable data specifically includes: Modify the Date object of the mini-program based on the runtime environment data; Write the Storage data and the global variable data into the mini-program.
8. A user behavior reconstruction system, characterized in that, The restoration system includes: The data collection module is used to collect the runtime environment data, Storage data generated by the mini-program, global variable data, and function data of the mini-program during the process of the target user entering the target page of the mini-program and leaving the target page. The restoration module is used to restore user behavior based on the runtime environment data, the Storage data, the global variable data, and the function data.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and for running on the processor, characterized in that, When the processor executes the computer program, it implements the method for restoring user behavior as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for restoring user behavior as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system for restoring user behaviors, electronic equipment and storage medium
CN111552872A
Method and device for recording webpage operation behaviors of user
CN113254320A