Data collection method and device
By introducing data collection component binding events and life cycle methods into the WeChat mini program, record data is generated and processed, solving the problem of global monitoring of user behavior data in the WeChat mini program, achieving accurate determination of cheating behavior, and meeting the anti-cheating requirements need.
Patent Information
- Application Number
- CN202010047444.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-16
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2040-01-16
AI Technical Summary
The existing technology lacks a method for globally monitoring user behavior data in WeChat mini programs, and the anti-cheating determination method relies on a large amount of data support, which is difficult to adapt to the characteristics of WeChat mini programs.
By introducing the data collection component, wrapping the area to be monitored on the target program page, binding events and life cycle methods, generating record data, and using script files for data processing and encrypted upload, the detection of cheating behavior is achieved.
It realizes global monitoring of user behavior in WeChat mini programs and flexible monitoring range selection, and can accurately determine cheating behavior based on multiple or single user behavior data to meet anti-cheating needs.
Smart Images

Figure CN113127851B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data collection method and device. Background Art
[0002] WeChat Mini Program (abbreviated as Mini Program, English name Mini Program) is an application that can be used without downloading and installing. In actual applications, it is necessary to monitor, collect and analyze the user behavior data occurring in WeChat Mini Program to realize various functions, but the prior art lacks a method for globally monitoring and collecting user behavior data in WeChat Mini Program. In addition, there is an anti-cheating demand in WeChat Mini Program. In the prior art, cheating behavior is generally determined by using page browsing time, IP (Internet Protocol) portraits, and Cookie files. For example, when the page browsing time is too long or too short, the click behavior is concentrated in the same local area network, or there are too many click behaviors corresponding to the same Cookie file, cheating behavior can be determined. This judgment method requires a lot of data support and is not suitable for WeChat Mini Program. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a data collection method and device, which can realize global monitoring of user behavior data in a target program and can flexibly select a region to be monitored on a target program page.
[0004] To achieve the above objective, according to one aspect of the present invention, a data collection method is provided.
[0005] The data collection method of an embodiment of the present invention includes: introducing a preset data collection component into a target program; using the data collection component to wrap the area to be monitored of the target program page, so that the data collection method included in the data collection component is bound to the event or life cycle method of the area to be monitored; when any event or any life cycle method of the area to be monitored is triggered, generating record data using the data collection method bound to the event or the life cycle method; wherein the record data includes the time information and / or coordinate information of the event being triggered, or the time information of the life cycle method being triggered.
[0006] Optionally, the target program includes a WeChat applet; and introducing a preset data collection component into the target program includes: declaring a reference to the data collection component in a configuration file of the target program, and setting a tag name corresponding to the data collection component.
[0007] Optionally, using the data collection component to wrap the area to be monitored of the target program page includes: placing the page code of the area to be monitored between a start tag and an end tag named with the tag name.
[0008] Optionally, the events or life cycle methods of the area to be monitored are triggered by user behaviors, and the user behaviors include: click behaviors, sliding behaviors, entering page behaviors and / or leaving page behaviors; the events of the area to be monitored include touch start events, touch move events and / or touch end events, and the life cycle methods of the area to be monitored include entering page methods and / or leaving page methods; wherein, the click behavior triggers the touch start event and the touch end event, and generates click data; the click data includes the record data generated when the touch start event and the touch end event are triggered; the sliding behavior triggers the touch start event, the touch move event and the touch end event, and generates sliding data; the sliding data includes the record data generated when the touch start event, the touch move event and the touch end event are triggered; the entering page behavior triggers the entering page method, and generates the entering page data; the entering page data includes the record data generated when the entering page method is triggered; the leaving page behavior triggers the leaving page method, and generates the leaving page data; the leaving page data includes the record data generated when the leaving page method is triggered.
[0009] Optionally, two record data in any click data have the same coordinate information; and the method further includes: executing the following steps through the script file included in the data collection component: subtracting the time information of two record data in any click data to obtain the click duration information; forming click statistical data with the click duration information and the coordinate information of the record data in the click data; selecting part of the record data as samples at equal intervals in ascending or descending order of time information from any sliding data, and replacing the time information in any sample with the duration information of adjacent sampling points; wherein the samples formed after the replacement constitute sliding statistical data, and the duration information of adjacent sampling points is the time information difference between any sample and the previous sample of the sample.
[0010] Optionally, the method further includes: executing the following steps through the script file: determining the verification information code from the area to be monitored, encrypting the data to be uploaded and the verification information code using the key provided by the server to form encrypted data; wherein the data to be uploaded includes user behavior data and / or statistical data, the user behavior data includes click data, sliding data, entry page data and / or exit page data, and the statistical data includes click statistical data, sliding statistical data and / or data formed by processing entry page data and exit page data; uploading the encrypted data to the server.
[0011] Optionally, the user behavior data or statistical data in the encrypted data is used to perform cheating behavior determination according to the following steps: when the click duration information in any click statistical data is not within a preset first range, the user behavior corresponding to the click statistical data is determined to be cheating behavior; when the sum of the duration information of adjacent sampling points of the sample in any sliding statistical data is not within a preset second range, the user behavior corresponding to the sliding statistical data is determined to be cheating behavior; in any sliding statistical data, the number of samples whose Euclidean distance to the previous sample is greater than a preset distance is determined; when the number is greater than a preset first threshold, the user behavior corresponding to the sliding statistical data is determined to be cheating behavior; the sliding trajectory is determined according to the coordinate information of the sample in any sliding statistical data; when the sliding trajectory does not meet the preset rules, the sliding statistical data is determined to be cheating behavior. The corresponding user behavior is cheating; when it is determined that the change amplitude of the duration information of adjacent sampling points of each sample in any sliding statistical data is less than a preset second threshold, the user behavior corresponding to the sliding statistical data is judged to be cheating; when it is determined by using the coordinate information of the sample that there is a sample that is out of the display screen range in any sliding statistical data, the user behavior corresponding to the sliding statistical data is judged to be cheating; determine the number of click data corresponding to the same monitored area as the entry page data within a preset time window based on any entry page data; when the number is greater than a preset third threshold, the user behavior corresponding to the entry page data and the click data is judged to be cheating; wherein the time window starts from the time information in the entry page data, and the duration of the time window is the preset first duration.
[0012] To achieve the above objective, according to another aspect of the present invention, a data collection device is provided.
[0013] The data collection device of an embodiment of the present invention may include: an introduction unit, used to introduce a preset data collection component into a target program; a binding unit, used to wrap the area to be monitored of the target program page with the data collection component, so that the data collection method included in the data collection component is bound to the event or life cycle method of the area to be monitored; a record generation unit, used to: when any event or any life cycle method of the area to be monitored is triggered, generate record data using the data collection method bound to the event or the life cycle method; wherein the record data includes the time information and / or coordinate information of the event being triggered, or the time information of the life cycle method being triggered.
[0014] To achieve the above objective, according to another aspect of the present invention, an electronic device is provided.
[0015] An electronic device of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the data collection method provided by the present invention.
[0016] To achieve the above objective, according to yet another aspect of the present invention, a computer-readable storage medium is provided.
[0017] A computer-readable storage medium of the present invention stores a computer program, which implements the data collection method provided by the present invention when executed by a processor.
[0018] According to the technical solution of the present invention, one embodiment of the above invention has the following advantages or beneficial effects: by encapsulating the preset data collection method as a data collection component and introducing it into the target program, the data collection component is used to wrap the area to be monitored of the target program page, so that the data collection method is bound to the event or life cycle method of the area to be monitored. When the user behavior occurs in the area to be monitored, the corresponding event or life cycle method is triggered, so that the bound data collection method is executed to generate the record data corresponding to the user behavior. In this way, the global monitoring of user behavior in the target program can be realized, and the monitoring range (i.e., the area to be monitored) can be flexibly selected as needed. The above method can be applied to applications installed on various terminals, and is particularly suitable for WeChat applet. Since there is no concept of document and window in WeChat applet, the global monitoring of user behavior becomes a difficult problem to solve, and the above method can solve this problem. In addition, the above data collection component also includes a script file for reporting data, which can be automatically processed, encrypted and uploaded after the user behavior data is generated. The uploaded user behavior data can be used to realize cheating behavior judgment with the help of the specific strategy provided by the present invention. For example, when the duration of the click behavior is not within the preset first range, the total duration of the sliding behavior is not within the preset second range, or the position jump of adjacent sampling points of the sliding behavior is large, it can be determined as cheating behavior. Through the above settings, the present invention can accurately identify cheating behaviors based on multiple user behavior data, and can also roughly identify cheating behaviors based on a single user behavior data, meeting the anti-cheating needs of various applications, especially WeChat applets.
[0019] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0021] Figure 1Schematic diagram of the main steps of the data collection method in an embodiment of the present invention;
[0022] Figure 2 is a schematic diagram of specific execution steps of the data collection method in an embodiment of the present invention;
[0023] Figure 3 is a schematic diagram of interaction between a client and a data analysis server in an embodiment of the present invention;
[0024] Figure 4 is a schematic diagram of a specific implementation of the data collection method in an embodiment of the present invention;
[0025] Figure 5 is a schematic diagram of components of a data collection device in an embodiment of the present invention;
[0026] Figure 6 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0027] Figure 7 It is a schematic diagram of the structure of an electronic device used to implement the data collection method in the embodiment of the present invention. DETAILED DESCRIPTION
[0028] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0029] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.
[0030] Figure 1 Schematic diagram of main steps of the method according to an embodiment of the present invention.
[0031] like Figure 1 As shown, the data collection method of the embodiment of the present invention can be specifically performed according to the following steps:
[0032] Step S101: Introduce a preset data collection component into the target program.
[0033] The data collection method of the embodiment of the present invention can collect user behavior data in the target program. Generally, the target program can be an application installed on various electronic devices such as PC (personal computer), mobile smart terminal (such as smart phone) or various operating systems such as Windows, Android, iOS. Preferably, the present invention is suitable for user behavior data collection in WeChat applet set in mobile smart terminal. The following will mainly take the target program as WeChat applet as an example for explanation.
[0034] In WeChat applet, user behavior can include click behavior, sliding behavior, page entry behavior and page exit behavior, and user behavior can trigger events or life cycle methods in the page. The above events are the communication methods from the view layer to the logic layer in WeChat applet, and can include touch start event (touchstart), touch move event (touchmove) and touch end event (touchend); the above life cycle method refers to the life cycle callback function of the WeChat applet page, which can include page entry method (onShow) and page exit method (onHide or onUnload). Specifically, a click behavior includes two instantaneous actions of touch start and touch end, and these two instantaneous actions trigger touch start event and touch end event respectively. A sliding behavior includes three actions of touch start, touch move and touch end, among which touch start and touch end are instantaneous actions, touch move is a continuous action, and touch start, touch move and touch end trigger touch start event, touch move event and touch end event respectively. The page entry behavior can trigger the page entry method, and the page exit behavior can trigger the page exit method. It can be understood that the above user behaviors can be behaviors of real users or behaviors formed by using programs or automatic devices. The cheating behaviors to be explained later include the latter user behaviors.
[0035] In this step, a data collection method for collecting user behavior data and generating record data may be pre-written. Generally, the above-mentioned record data is a component of the user behavior data, and one user behavior data may include one or more record data. Exemplarily, the data collection method may include a method for collecting time information, a method for collecting coordinate information, and a method for collecting time information and coordinate information at the same time. The above-mentioned time information may be a specific moment, and the coordinate information may be the coordinate value on the screen plane of the electronic device where the target program is located. In addition, a script file such as a JS (JavaScript) file for uploading user behavior data may also be pre-written.
[0036] In actual applications, the data collection method and script file can be encapsulated into a component (hereinafter referred to as the data collection component) and introduced into the target program. Specifically, the data collection component can be referenced and declared in the configuration file of the target program, and the label name corresponding to the data collection component can be set. For example, in the WeChat applet, the following code can be written in the JSON (JavaScript Object Notation, JS object tag) configuration file of the page to implement the reference declaration of the data collection component:
[0037] "usingComponents":{
[0038] "weixinBehavior":"wxCheatingDeath"
[0039] }
[0040] Among them, usingComponents is the field in the configuration file used to introduce the data collection component, wxCheatingDeath is the name of the data collection component, and weixinBehavior is the label name set for the data collection component.
[0041] In an embodiment of the present invention, the data collection component can be downloaded and introduced into the target program through the NPM (Node Package Manager, a package manager of Node.js, Node.js is a script running on the server side) package. In actual applications, the developer packages the latest version of the data collection component and publishes it to the NPM platform. The client downloads the corresponding NPM package from the NPM platform and rebuilds it to obtain the latest version of the data collection component. In this way, the introduction of the data collection component into the target program can be easily realized. In addition, the data collection component can also be packaged into a plug-in or the like and provided to the client, and the present invention is not limited to this.
[0042] Step S102: Use a data collection component to wrap the area to be monitored of the target program page, so that the data collection method included in the data collection component is bound to the event or life cycle method of the area to be monitored.
[0043] In this step, the area to be monitored can be any area of any page of the target program. The scope of the area to be monitored can include the entire page, or only any part of the page, such as a control, a paragraph of text, or an image in the page. Preferably, in an embodiment of the present invention, the page code of the area to be monitored (in the WeChat applet, the page code is WXML code, WXML represents WeChat markup language) can be placed between the start tag and the end tag named with the above tag name, so that the data collection component wraps the area to be monitored. In the above example, the start tag named with the tag name weixinBehavior is<weixinBehavi or> , the end tag is, the start tag and the end tag form a tag pair. In this way, the data collection method included in the data collection component can be bound to the event or life cycle method of the area to be monitored. It can be understood that the above-mentioned package in the embodiment of the present invention refers to the scope of action of the data collection component covering the area to be monitored, that is, the data collection method and script file encapsulated in the data collection component can act on the elements in the page to be monitored. The above placing the page code of the area to be monitored between the tag pairs is one of the ways to achieve the above-mentioned package. In an embodiment of the present invention, the touch start event, the touch move event and the touch end event can be bound to the method of collecting time information and coordinate information at the same time, and the enter page method and the leave page method can be bound to the method of collecting time information. After executing the binding, the data collection method can be automatically executed after the corresponding event or life cycle method of the area to be monitored is triggered, thereby realizing the user data collection of the area to be monitored.
[0044] Step S103: When any event or any life cycle method of the area to be monitored is triggered, record data is generated using the data collection method bound to the event or the life cycle method.
[0045] Taking WeChat applet as an example, if the user behavior is a click, the touch start event and the touch end event are triggered, and the data collection method bound to these two events is immediately triggered, thereby generating two records, one of which includes the time information and coordinate information of the touch start event being triggered, and the other includes the time information and coordinate information of the touch end event being triggered. It can be understood that the time information in the two records is at different moments, and the difference between the two is the click duration information; the coordinate information in the two records is the same coordinate value. These two records constitute a click data. If the user behavior is a slide, the touch start event, the touch move event and the touch end event are triggered, thereby generating more than three records, the first of which includes the time information and coordinate information of the touch start event being triggered, the last record includes the time information and coordinate information of the touch end event being triggered, and the remaining records include multiple time information of the touch move event being triggered and the corresponding coordinate information (the first record and the last record above can be determined in sequence according to the time information in the record). The above record data constitutes a slide data.
[0046] For example, if the sliding data is [100, (10, 10)], [110, (11, 11)], [120, (12, 12)], [130, (13, 13)], [140, (14, 14)], [150, (15, 15)], where the three-digit number is the time information (the unit can be ms) and the two-digit number is the coordinate information (the unit can be pixel), then the first record data is generated by triggering the touch start event, the last record data is generated by triggering the touch end event, and the remaining record data is generated by triggering the touch move event. It can be understood that the sliding trajectory can be determined by the coordinate information in the sliding data.
[0047] If the user behavior is to enter the page, the method of entering the page is triggered, and the data collection method bound to the method of entering the page is immediately triggered, thereby generating a record data, which includes the time information when the method of entering the page is triggered, and the record data can form the data of entering the page. Afterwards, when the user leaves the page, the method of leaving the page is triggered, and the data collection method bound to the method of leaving the page is immediately triggered, thereby generating a record data, which includes the time information when the method of leaving the page is triggered, and the record data can form the data of leaving the page. It can be understood that the difference in time information between the two records is the length of time the user stays on the page. In an embodiment of the present invention, the above-mentioned click data, sliding data, page entry data and page exit data are all user behavior data.
[0048] As a preferred solution, after the user behavior data is generated, the script file in the data collection component can be used to process the user behavior data and upload it. Taking click data and sliding data as an example, after the click data is generated, the script file can be used to subtract the time information of the two recorded data in the click data to obtain the click duration information, and the click duration information and the coordinate information of the recorded data in the click data are combined into click statistics. After the sliding data is generated, the script file can be used to select part of the recorded data from the sliding data at equal intervals in ascending or descending order of the time information as samples, and replace the time information in any sample with the duration information of the adjacent sampling points, so as to obtain sliding statistics. Among them, the duration information of the adjacent sampling points is the difference in time information between any sample and the previous sample of the sample, and the duration information of the adjacent sampling points of the first sample is its original time information.
[0049] For example, if the sliding data is [100, (10, 10)], [110, (11, 11)], [120, (12, 12)], [130, (13, 13)], [140, (14, 14)], [150, (15, 15)], if the samples are selected at a sampling rate of 1 / 2, the following samples can be selected: [100, (10, 10)], [120, (12, 12)], [140, (14, 14)], at this time, the time information of each sample can be replaced by the duration information of the adjacent sampling points, and finally the following sliding statistics data are obtained: [100, (10, 10)], [20, (12, 12)], [20, (14, 14)].
[0050] Similarly, the script file can also be used to process the page entry data and page exit data, for example, the time information in the corresponding page entry data and page exit data can be subtracted to obtain the page stay time. Click statistics, sliding statistics, and data formed by processing page entry data and page exit data are collectively referred to as statistical data.
[0051] After obtaining the user behavior data or statistical data, the user behavior data and / or statistical data (hereinafter referred to as the data to be uploaded) can be encrypted and uploaded to the server using a script file. In practical applications, the server can be a business server that supports WeChat applets, or it can be a data analysis server that is different from the business server. The latter case is described below. Specifically, after obtaining the data to be uploaded, the script file can be used to first determine the verification information code from the area to be monitored. For example, when a user clicks on an image in the area to be monitored, multiple characters can be selected from the link address of the image according to a preset strategy to form a verification information code. Afterwards, the key provided by the server (which can be a business server or a data analysis server) is used to encrypt the data to be uploaded and the verification information code to form encrypted data, and finally the encrypted data is uploaded to the data analysis server using a script file. Figure 2 It is a schematic diagram of the specific execution steps of the data collection method in an embodiment of the present invention, which shows the steps of encapsulating the data collection component, introducing the data collection component in the target program, using the data collection component to wrap the area to be monitored, triggering events or life cycle methods, generating record data, processing the record data and reporting it.
[0052] After that, the data analysis server uses the key it has to decrypt the received encrypted data to obtain user behavior data or statistical data, and then various services can be performed based on the user behavior data or statistical data, such as making a click heat map. In an embodiment of the present invention, the data analysis server can perform cheating behavior determination based on the user behavior data or statistical data. Generally, there is an obvious statistical difference between the cheating behavior generated by the program or automatic device and the normal user behavior, so the overall distribution range of the normal user behavior can be determined first, and then the behavior that deviates from the range can be determined as cheating behavior. Specifically, if the click duration information in a certain click statistical data is not in the preset first range, it means that the click duration is too large or too small, and the user behavior corresponding to the click statistical data can be determined to be cheating behavior. If the sum of the duration information of adjacent sampling points of a sample in a certain sliding statistical data (which corresponds to the sliding duration) is not in the preset second range, it means that the sliding duration is too large or too small, and the user behavior corresponding to the sliding statistical data can be determined to be cheating behavior. When judging a certain sliding statistical data, first determine the number of samples in the sliding statistical data whose Euclidean distance with the previous sample is greater than a preset distance. If the number is greater than a preset first threshold, it means that there are a large number of jumping samples, and then determine that the user behavior corresponding to the sliding statistical data is cheating behavior.
[0053] In an embodiment of the present invention, there is also the following cheating behavior determination strategy: when determining a certain sliding statistical data, first determine the sliding trajectory based on the coordinate information of the sample in the sliding statistical data. If the sliding trajectory does not meet the preset rules (the preset rules are the rules followed by the sliding trajectory generated by normal user behavior, for example, the preset rules are: the sliding trajectory is a straight line or an approximate straight line, and the approximate straight line can be quantified according to specific conditions), then determine that the user behavior corresponding to the sliding statistical data is cheating. If it is determined that the change amplitude of the duration information of adjacent sampling points of each sample in a certain sliding statistical data (the change amplitude refers to the difference between the maximum and minimum values of the duration information of adjacent sampling points in samples other than the first sample) is less than the preset second threshold, it means that the regularity of the time information of each sample is strong, and at this time, it can be determined that the user behavior corresponding to the sliding statistical data is cheating. If it is determined by using the coordinate information of the sample that there are samples that are out of the display screen range in a certain sliding statistical data, then determine that the user behavior corresponding to the sliding statistical data is cheating. In addition, when judging the entry page data and click data generated for a certain monitored area, first determine the number of click data existing within a preset time window based on the entry page data (the time window starts from the time information in the entry page data, and the duration of the time window is the preset first duration). If the number is greater than the preset third threshold, it means that a large number of clicks occur in a short time after entering the page. At this time, it can be determined that the user behavior corresponding to the entry page data and the click data is cheating behavior. Figure 3 1 is a schematic diagram of the interaction between the client and the data analysis server in an embodiment of the present invention, which shows the interaction steps between the client where the target program is located and the data analysis server. Since the above steps have been explained above, they will not be repeated here.
[0054] According to the above strategy, cheating behavior can be roughly determined based on one piece of user behavior data or statistical data, and cheating behavior can be accurately determined based on multiple pieces of user behavior data or statistical data, thereby providing strong support for anti-cheating in CPC (pay-per-click advertising) and other businesses. The above cheating behavior determination strategy is only an example, and other cheating behavior determination strategies can be formulated according to needs in actual applications. Figure 4 Schematic diagram of a specific implementation of the data collection method in an embodiment of the present invention. Figure 4 As shown, the WeChat applet set on the client runs with the support of the business server, and the data collection component is downloaded to the client in the form of an NPM package and introduced into the WeChat applet while wrapping the monitored area of the WeChat applet page. When the user performs user behavior in the WeChat applet, the data collection method is triggered to generate user behavior data and send it to the data analysis server using a script file. The data analysis server can perform cheating behavior judgment based on the user behavior data.
[0055] In the technical solution of the embodiment of the present invention, by encapsulating the preset data collection method as a data collection component and introducing it into the target program, the data collection component is used to wrap the area to be monitored of the target program page, so that the data collection method is bound to the event or life cycle method of the area to be monitored. When the user behavior occurs in the area to be monitored, the corresponding event or life cycle method is triggered, so that the bound data collection method is executed to generate the record data corresponding to the user behavior. In this way, the global monitoring of user behavior in the target program can be realized, and the monitoring range can be flexibly selected as needed. The above method can be applied to applications installed on various terminals, especially WeChat applets. Since there is no concept of document and window in WeChat applets, the global monitoring of user behavior becomes a difficult problem to solve, and the above method can solve this problem. In addition, the above data collection component also includes a script file for reporting data, which can be automatically processed, encrypted and uploaded after the user behavior data is generated. The uploaded user behavior data can be used to realize the cheating behavior judgment with the help of the specific strategy provided by the present invention. For example, when the duration of the click behavior is not in the preset first range, the total duration of the sliding behavior is not in the preset second range, or the position jump of the adjacent sampling points of the sliding behavior is large, it can be determined as cheating behavior. Through the above settings, the present invention can accurately identify cheating behaviors based on multiple user behavior data, and can also roughly identify cheating behaviors based on a single user behavior data, thereby meeting the anti-cheating needs of various applications, especially WeChat applets.
[0056] It should be noted that, for the convenience of description, the aforementioned method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the present invention is not limited by the described action sequence, and some steps can actually be performed in other sequences or simultaneously. In addition, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily necessary to implement the present invention.
[0057] In order to better implement the above-mentioned solution of the embodiment of the present invention, relevant devices for implementing the above-mentioned solution are also provided below.
[0058] See also Figure 5 As shown, the data collection device 500 provided in the embodiment of the present invention may include: an introduction unit 501, a binding unit 502 and a record generation unit 503.
[0059] Among them, the introduction unit 501 can be used to introduce a preset data collection component into the target program; the binding unit 502 can be used to use the data collection component to wrap the monitored area of the target program page, so that the data collection method included in the data collection component is bound to the event or life cycle method of the monitored area; the record generation unit 503 can be used to: when any event or any life cycle method of the monitored area is triggered, generate record data using the data collection method bound to the event or the life cycle method; wherein the record data includes the time information and / or coordinate information of the event being triggered, or the time information of the life cycle method being triggered.
[0060] In an embodiment of the present invention, the target program includes a WeChat applet; the introduction unit 501 can be further used to: declare a reference to the data collection component in a configuration file of the target program, and set a tag name corresponding to the data collection component.
[0061] In practical applications, the binding unit 502 may be further used to: place the page code of the area to be monitored between the start tag and the end tag named with the tag name.
[0062] In a specific application, the events or life cycle methods of the area to be monitored are triggered by user behaviors, and the user behaviors include: click behaviors, sliding behaviors, entering page behaviors and / or leaving page behaviors; the events of the area to be monitored include touch start events, touch move events and / or touch end events, and the life cycle methods of the area to be monitored include entering page methods and / or leaving page methods; wherein, the click behavior triggers the touch start event and the touch end event to generate click data; the click data includes the record data generated when the touch start event and the touch end event are triggered; the sliding behavior triggers the touch start event, the touch move event and the touch end event to generate sliding data; the sliding data includes the record data generated when the touch start event, the touch move event and the touch end event are triggered; the entering page behavior triggers the entering page method to generate entering page data; the entering page data includes the record data generated when the entering page method is triggered; the leaving page behavior triggers the leaving page method to generate leaving page data; the leaving page data includes the record data generated when the leaving page method is triggered.
[0063] In some embodiments, two record data in any click data have the same coordinate information; the device 500 may further include a processing upload unit, which is used to: perform the following steps through the script file included in the data collection component: subtract the time information of two record data in any click data to obtain the click duration information; form click statistical data with the click duration information and the coordinate information of the record data in the click data; select part of the record data as samples at equal intervals in ascending or descending order of time information from any sliding data, and replace the time information in any sample with the duration information of adjacent sampling points; wherein the samples formed after the replacement constitute sliding statistical data, and the duration information of adjacent sampling points is the time information difference between any sample and the previous sample of the sample.
[0064] As a preferred solution, the processing and uploading unit can be further used to: determine the verification information code from the area to be monitored, and use the key provided by the server to encrypt the data to be uploaded and the verification information code to form encrypted data; wherein the data to be uploaded includes user behavior data and / or statistical data, the user behavior data includes click data, sliding data, entry page data and / or exit page data, and the statistical data includes click statistical data, sliding statistical data and / or data formed by processing entry page data and exit page data; and upload the encrypted data to the server.
[0065] In addition, in an embodiment of the present invention, the user behavior data or statistical data in the encrypted data is used to perform cheating behavior determination according to the following steps: when the click duration information in any click statistical data is not within a preset first range, the user behavior corresponding to the click statistical data is determined to be cheating behavior; when the sum of the duration information of adjacent sampling points of the sample in any sliding statistical data is not within a preset second range, the user behavior corresponding to the sliding statistical data is determined to be cheating behavior; in any sliding statistical data, the number of samples whose Euclidean distance to the previous sample is greater than a preset distance is determined; when the number is greater than a preset first threshold, the user behavior corresponding to the sliding statistical data is determined to be cheating behavior; the sliding trajectory is determined according to the coordinate information of the sample in any sliding statistical data; when the sliding trajectory does not meet the preset rules, the sliding statistics is determined to be cheating behavior. The user behavior corresponding to the sliding statistical data is cheating; when it is determined that the change amplitude of the duration information of adjacent sampling points of each sample in any sliding statistical data is less than a preset second threshold, the user behavior corresponding to the sliding statistical data is judged to be cheating; when it is determined by using the coordinate information of the sample that there is a sample that is out of the display screen range in any sliding statistical data, the user behavior corresponding to the sliding statistical data is judged to be cheating; determine the number of click data corresponding to the same monitored area as the entry page data within a preset time window based on any entry page data; when the number is greater than a preset third threshold, determine that the entry page data and the user behavior corresponding to the click data are cheating; wherein the time window starts from the time information in the entry page data, and the duration of the time window is the preset first duration.
[0066] In the technical solution of the embodiment of the present invention, by encapsulating the preset data collection method as a data collection component and introducing it into the target program, the data collection component is used to wrap the area to be monitored of the target program page, so that the data collection method is bound to the event or life cycle method of the area to be monitored. When the user behavior occurs in the area to be monitored, the corresponding event or life cycle method is triggered, so that the bound data collection method is executed to generate the record data corresponding to the user behavior. In this way, the global monitoring of user behavior in the target program can be realized, and the monitoring range can be flexibly selected as needed. The above method can be applied to applications installed on various terminals, especially WeChat applets. Since there is no concept of document and window in WeChat applets, the global monitoring of user behavior becomes a difficult problem to solve, and the above method can solve this problem. In addition, the above data collection component also includes a script file for reporting data, which can be automatically processed, encrypted and uploaded after the user behavior data is generated. The uploaded user behavior data can be used to realize the cheating behavior judgment with the help of the specific strategy provided by the present invention. For example, when the duration of the click behavior is not in the preset first range, the total duration of the sliding behavior is not in the preset second range, or the position jump of the adjacent sampling points of the sliding behavior is large, it can be determined as cheating behavior. Through the above settings, the present invention can accurately identify cheating behaviors based on multiple user behavior data, and can also roughly identify cheating behaviors based on a single user behavior data, thereby meeting the anti-cheating needs of various applications, especially WeChat applets.
[0067] Figure 6 An exemplary system architecture 600 is shown to which the data collection method or user data collection device according to the embodiment of the present invention can be applied.
[0068] like Figure 6 As shown, the system architecture 600 may include terminal devices 601, 602, 603, a network 604 and a server 605 (this architecture is only an example, and the components included in the specific architecture may be adjusted according to the specific application). The network 604 is used to provide a medium for a communication link between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables.
[0069] The user can use the terminal devices 601, 602, 603 to interact with the server 605 through the network 604 to receive or send messages, etc. Various client applications can be installed on the terminal devices 601, 602, 603, such as WeChat applets (only as an example).
[0070] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.
[0071] The server 605 may be a server that provides various services, such as a business server that provides support for WeChat applets operated by users using terminal devices 601, 602, and 603 (for example only). The business server may process the received page access request and feed back the processing result (for example, the page to be accessed - for example only) to the terminal devices 601, 602, and 603.
[0072] It should be noted that the data collection method provided in the embodiment of the present invention is generally executed by the terminal devices 601 , 602 , and 603 , and accordingly, the data collection device is generally disposed in the terminal devices 601 , 602 , and 603 .
[0073] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0074] The present invention also provides an electronic device. The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the user data collection method provided by the present invention.
[0075] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of an electronic device suitable for implementing an embodiment of the present invention. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0076] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the computer system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0077] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read therefrom is installed into the storage section 708 as needed.
[0078] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, the embodiments of the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the main step diagram. In the above embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit 701, the above functions defined in the system of the present invention are executed.
[0079] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0080] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0081] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be provided in a processor, for example, may be described as: a processor including an introduction unit, a binding unit, and a record generation unit. The names of these units do not, in some cases, constitute limitations on the units themselves, for example, the introduction unit may also be described as a "unit that provides a data collection component to a binding unit".
[0082] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the device, the steps executed by the device include: introducing a preset data collection component in the target program; using the data collection component to wrap the monitored area of the target program page, so that the data collection method included in the data collection component is bound to the event or life cycle method of the monitored area; when any event or any life cycle method of the monitored area is triggered, the data collection method bound to the event or the life cycle method is used to generate record data; wherein the record data includes the time information and / or coordinate information of the event being triggered, or the time information of the life cycle method being triggered.
[0083] In the technical solution of the embodiment of the present invention, by encapsulating the preset data collection method as a data collection component and introducing it into the target program, the data collection component is used to wrap the area to be monitored of the target program page, so that the data collection method is bound to the event or life cycle method of the area to be monitored. When the user behavior occurs in the area to be monitored, the corresponding event or life cycle method is triggered, so that the bound data collection method is executed to generate the record data corresponding to the user behavior. In this way, the global monitoring of user behavior in the target program can be realized, and the monitoring range can be flexibly selected as needed. The above method can be applied to applications installed on various terminals, especially WeChat applets. Since there is no concept of document and window in WeChat applets, the global monitoring of user behavior becomes a difficult problem to solve, and the above method can solve this problem. In addition, the above data collection component also includes a script file for reporting data, which can be automatically processed, encrypted and uploaded after the user behavior data is generated. The uploaded user behavior data can be used to realize the cheating behavior judgment with the help of the specific strategy provided by the present invention. For example, when the duration of the click behavior is not in the preset first range, the total duration of the sliding behavior is not in the preset second range, or the position jump of the adjacent sampling points of the sliding behavior is large, it can be determined as cheating behavior. Through the above settings, the present invention can accurately identify cheating behaviors based on multiple user behavior data, and can also roughly identify cheating behaviors based on a single user behavior data, thereby meeting the anti-cheating needs of various applications, especially WeChat applets.
[0084] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A data collection method, It is characterized in that include: Introduce the preset data collection components into the target program; Use the data collection component to wrap the area to be monitored of the target program page, so that the data collection method included in the data collection component is bound to the event or life cycle method of the area to be monitored; When any event or any life cycle method of the monitored area is triggered, record data is generated using the data collection method bound to the event or the life cycle method; wherein the record data includes the time information and / or coordinate information of the event being triggered, or the time information of the life cycle method being triggered; The method of using the data collection component to wrap the area to be monitored of the target program page includes: placing the page code of the area to be monitored between a start tag and an end tag named with the tag name corresponding to the data collection component.
2. The data collection method according to claim 1, It is characterized in that Target programs include WeChat applets; And, introduce the preset data collection components into the target program, including: In the configuration file of the target program, a reference declaration is made to the data collection component, and a label name corresponding to the data collection component is set.
3. The data collection method according to claim 1, It is characterized in that The events or lifecycle methods of the area to be monitored are triggered by user behaviors, including: click behaviors, slide behaviors, page entry behaviors, and / or page exit behaviors; The events of the area to be monitored include touch start events, touch move events and / or touch end events, and the life cycle methods of the area to be monitored include enter page methods and / or leave page methods; wherein, The click behavior triggers a touch start event and a touch end event, generating click data; the click data includes the record data generated when the touch start event and the touch end event are triggered; The sliding behavior triggers a touch start event, a touch move event and a touch end event, and generates sliding data; the sliding data includes the record data generated when the touch start event, the touch move event and the touch end event are triggered; The page entry behavior triggers the page entry method, generating page entry data; the page entry data includes the record data generated when the page entry method is triggered; The leaving page behavior triggers the leaving page method, generating leaving page data; the leaving page data includes the record data generated when the leaving page method is triggered.
4. The data collection method according to claim 3, It is characterized in that The two record data in any click data have the same coordinate information; and the method further comprises: executing the following steps through a script file included in the data collection component: Subtract the time information of two recorded data in any click data to obtain the click duration information; combine the click duration information and the coordinate information of the recorded data in the click data to form click statistics data; Select part of the recorded data as samples at equal intervals in ascending or descending order of time information from any sliding data, and replace the time information in any sample with the duration information of adjacent sampling points; wherein the samples formed after the replacement constitute sliding statistical data, and the duration information of adjacent sampling points is the time information difference between any sample and the previous sample of the sample.
5. The data collection method according to claim 4, It is characterized in that The method further comprises: executing the following steps by means of the script file: Determine the verification information code from the area to be monitored, and use the key provided by the server to encrypt the data to be uploaded and the verification information code to form encrypted data; wherein the data to be uploaded includes user behavior data and / or statistical data, the user behavior data includes click data, sliding data, page entry data and / or page exit data, and the statistical data includes click statistical data, sliding statistical data and / or data formed by processing page entry data and page exit data; Upload the encrypted data to the server.
6. The data collection method according to claim 5, It is characterized in that The user behavior data or statistical data in the encrypted data is used to perform cheating behavior determination according to the following steps: When the click duration information in any click statistical data is not within the preset first range, it is determined that the user behavior corresponding to the click statistical data is a cheating behavior; When the sum of duration information of adjacent sampling points of samples in any sliding statistical data is not within the preset second range, it is determined that the user behavior corresponding to the sliding statistical data is a cheating behavior; Determine the number of samples whose Euclidean distance from a previous sample is greater than a preset distance in any sliding statistical data; when the number is greater than a preset first threshold, determine that the user behavior corresponding to the sliding statistical data is a cheating behavior; Determine the sliding trajectory according to the coordinate information of the sample in any sliding statistical data; When the sliding track does not conform to the preset rules, the user behavior corresponding to the sliding statistical data is determined to be cheating behavior; When it is determined that the change range of the duration information of adjacent sampling points of each sample in any sliding statistical data is less than a preset second threshold, it is determined that the user behavior corresponding to the sliding statistical data is a cheating behavior; When it is determined by using the coordinate information of the sample that there is a sample out of the range of the display screen in any sliding statistical data, it is determined that the user behavior corresponding to the sliding statistical data is a cheating behavior; Determine the number of click data corresponding to the same area to be monitored as the entry page data and existing within a preset time window based on any entry page data; When the number is greater than a preset third threshold, it is determined that the user behavior corresponding to the entry page data and the click data is cheating behavior; wherein, the time window starts from the time information in the entry page data, and the duration of the time window is a preset first duration.
7. A data collection device, It is characterized in that include: An introduction unit, used for introducing a preset data collection component into a target program; A binding unit, used to wrap the area to be monitored of the target program page with the data collection component, so that the data collection method included in the data collection component is bound to the event or life cycle method of the area to be monitored; A record generation unit, used for: when any event or any life cycle method of the monitored area is triggered, generating record data by using the data collection method bound to the event or the life cycle method; wherein the record data includes the time information and / or coordinate information of the event being triggered, or the time information of the life cycle method being triggered; The binding unit is also used to: place the page code of the area to be monitored between the start tag and the end tag named with the tag name corresponding to the data collection component.
8. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
