Front-end buried point data reporting optimization method and optimization system
By performing trend analysis and delayed reporting on API requests, the pressure on network bandwidth caused by front-end buried data reporting is resolved, user experience is optimized, and efficient data transmission and loss protection are achieved.
Patent Information
- Application Number
- CN202210223037.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-03-07
AI Technical Summary
Front-end buried data reporting puts pressure on network bandwidth, affecting user experience, and frequent network link establishment affects data transmission efficiency.
By performing trend analysis on API requests, the tracking data stored in sessionStorage is uploaded to the backend when the request frequency is lower than the threshold. The data transmission is monitored before the interface is refreshed or closed, and the window's beforeunload event is used to capture unreported data. The event listening methods of different API types are combined to obtain the initiation time and delay the reporting of data.
It reduces network congestion, optimizes user experience, prevents data loss, realizes data compression reporting, and improves data transmission efficiency.
Smart Images

Figure CN114595119B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data compression, in particular to a front-end point-in-time data reporting optimization method and system. BACKGROUND
[0002] Front-end performance monitoring technology is a technology that relies on front-end probes to report page access, response speed, resource loading, network requests and other monitoring indicators. The probe first listens to certain events of the page, then converts the events into monitoring indicators, and finally reports the indicators to the server. With the development of digitization and informatization, front-end business has become increasingly complex, resulting in a large number of real-time data types collected by monitoring probes. Frequent establishment of network links between the front-end and the back-end for a large amount of data transmission puts a great pressure on network bandwidth and seriously affects user experience.
[0003] How to optimize point-in-time data reporting is a technical problem to be solved. SUMMARY
[0004] The technical task of the present application is to provide a front-end point-in-time data reporting optimization method and system to solve the technical problem of how to optimize point-in-time data reporting in view of the above shortcomings.
[0005] In the first aspect, the front-end point-in-time data reporting optimization method of the present application reports the real-time acquired point-in-time data to the back-end in time for point-in-time data that needs to be fed back immediately, and temporarily stores the acquired point-in-time data in sessionStorage for point-in-time data that does not need to be fed back immediately.
[0006] The point-in-time data stored in sessionStorage is uploaded to the back-end when the frequency of API requests is lower than a threshold value through trend analysis of API requests.
[0007] Based on the beforeunload event of window according to the w3c standard, whether the user interface is refreshed or closed is captured, the transmission of point-in-time data is monitored before the interface is refreshed or closed, and the unreported point-in-time data is reported to the back-end.
[0008] As a preferred embodiment, the API request is captured in real time and the initiation time of the API request is acquired before the trend analysis of the API request.
[0009] The trend analysis of the API request includes the following operations:
[0010] Three variables, previousData, currentData and tempObject, are added in the global variable, tempObject as a temporary object, has two attributes, createTime and count, respectively, createTime represents the earliest API request start time, count represents the number of API requests counted up to the latest time, currentData object represents the number of API requests counted at present, previousData represents the number of API requests counted in the past time;
[0011] Initially, the count attributes of previousData and currentData are both 0, when the API request is initiated for the first time in the current front end, the API request initiation time is obtained, and the initiation time is assigned to the createTime attribute of tempData, and the value of the count attribute of tempData becomes 1;
[0012] For the API request initiated later, the API request initiation time is subtracted from the createTime attribute in tempData, when the obtained time difference is less than or equal to the first preset value, tempData.count = tempData.count + 1 is executed, when the obtained time difference is greater than the first preset value and less than or equal to the second preset value, the value of currentData is copied to previousData, then the value of tempData.count is copied to currentData, and the value of tempData.count is cleared to 0, the createTime of tempData is increased by the first preset value on the basis of the original; When the obtained time difference is greater than the second preset value, the count attribute values of currentData and previousData are both cleared to 0, the createTime attribute of tempData is set to the API request time, and the count attribute is set to 1;
[0013] When the API request is analyzed, a timer is set, and the previousData and currentData in the global variable are looped to listen to the previousData and currentData in the global variable, when currentData is less than or equal to the first preset value and currentData is less than previousData, it indicates that the trend of the current API request is decreasing, and the frequency of the current API request does not exceed the predetermined frequency threshold, and is in an infrequent state.
[0014] As a preferred, the API request type includes XMLHttpRequest type and Fetch type;
[0015] For the XMLHttpRequest type API request, the onreadystatechange method of the event is listened to, and when it is triggered, the readyState of the request is captured as 1, that is, the sending method has been called, and the request is being sent. At this time, the initiation time of the current API request can be obtained;
[0016] For the Fetch type API request, the get method is reconstructed to obtain the initiation time of the current API request.
[0017] Preferably, the embedded data that needs immediate feedback includes page data and error alarm data.
[0018] The embedded data that does not need immediate feedback includes interface user access data.
[0019] Preferably, for the embedded data that does not need immediate feedback, the obtained embedded data is temporarily stored in a key corresponding to a value in sessionStorage.
[0020] Preferably, the embedded data is integrated into an array at the last embedded data time, and is uniformly reported to the backend.
[0021] In the second aspect, the optimization system for front-end embedded data reporting of the present application, by executing the optimization method for embedded data reporting of any one of the first aspect, selectively delays the reporting of the embedded data, the system comprises:
[0022] An embedded data analysis module, the data analysis module is used for statistical analysis of the embedded data, and judges whether the embedded data needs immediate feedback;
[0023] An embedded data processing module, for the embedded data that needs immediate feedback, the embedded data processing module is used for timely reporting of the embedded data to the backend, and for the embedded data that does not need immediate feedback, the embedded data processing module is used for temporarily storing the obtained embedded data in sessionStorage;
[0024] An API request analysis module, the API request analysis module is used for trend analysis of API requests;
[0025] An embedded data delay reporting module, the embedded data delay reporting module is used for uploading the embedded data stored in sessionStorage to the backend when the API request frequency is lower than the threshold value; and is used for capturing whether the user interface is refreshed or closed based on the beforeunload event of the w3c standard window, monitoring the transmission of the embedded data before the interface is refreshed or closed, and reporting the unreported embedded data to the backend.
[0026] As preferred, the API request analysis module is configured to analyze the trend of API requests by the following steps:
[0027] Three variables, previousData, currentData and tempObject, are added in the global variable, tempObject is a temporary object, and has two attributes, createTime and count, respectively, createTime represents the earliest API request start time, count represents the number of API requests counted up to the latest time, currentData object represents the number of API requests counted, and previousData represents the number of API requests counted in the previous period of time;
[0028] Initially, the count attributes of previousData and currentData are both 0, when the API request is first initiated by the front end, the API request initiation time is obtained, and the initiation time is assigned to the createTime attribute of tempData, and the value of the count attribute of tempData is changed to 1;
[0029] For the API requests initiated later, the API request initiation time is subtracted from the createTime attribute in tempData, when the obtained time difference is less than or equal to the first preset value, tempData.count = tempData.count+1 is executed, when the obtained time difference is greater than the first preset value and less than or equal to the second preset value, the value of currentData is copied to previousData, then the value of tempData.count is copied to currentData, and the value of tempData.count is cleared to 0, the createTime of tempData is increased by the first preset value based on the original; when the obtained time difference is greater than the second preset value, the count attributes of currentData and previousData are both cleared to 0, the createTime attribute of tempData is set to the API request time, and the count attribute is set to 1.
[0030] As preferred, the API request analysis module is configured to analyze the trend of API requests by the following steps:
[0031] It is also used to set a timer when performing trend analysis on API requests, and cyclically monitor previousData and currentData in the global variables. When currentData is less than or equal to the first preset value and currentData is less than previousData, it indicates that the trend of the current API request is decreasing, and the frequency of the current API request does not exceed the predetermined frequency threshold and is in an infrequent state.
[0032] Preferably, the API request type includes XMLHttpRequest type and Fetch type;
[0033] For XMLHttpRequest type API requests, the tracking data delay reporting module is used to monitor the onreadystatechange method of the event. When it is triggered, it captures the readyState of the request as 1, that is, the send method has been called and the request is being sent. At this time, the initiation time of the current API request can be obtained;
[0034] For Fetch-type API requests, the tracking data delay reporting module is used to obtain the initiation time of the current API request by reconstructing its get method;
[0035] The buried point data processing module is used to integrate the reported buried point data into an array and report it to the back end in a unified manner.
[0036] The optimization method and system for front-end buried point data reporting of the present invention have the following advantages:
[0037] 1. Analyze the acquired tracking data. Temporarily store tracking data that does not require timely feedback in sessionStorage. Perform trend analysis on API requests. When the API request frequency falls below a threshold, upload the tracking data stored in sessionStorage to the backend. This method achieves delayed reporting of tracking data, reduces network congestion caused by tracking data reporting and other issues such as interface freezes, thereby optimizing the user experience.
[0038] 2. When reporting tracking data, the tracking data is integrated into an array and reported to the backend in a unified manner. This achieves data compression reporting, reduces network congestion caused by tracking data reporting and other issues such as interface freezes, thereby optimizing the user experience.
[0039] 3. When the buried data is reported with a delay, use the addEventListener method of the window object to monitor the beforeunload event of the page. When this event is monitored, perform the reporting operation on the unreported data, effectively preventing the loss of buried data. BRIEF DESCRIPTION OF DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0041] The present application will be further described below in conjunction with the drawings.
[0042] Figure 1 A flowchart of the optimization method for front-end buried point data reporting of the embodiment 1. DETAILED DESCRIPTION
[0043] The present application will be further described below in conjunction with the drawings and specific embodiments, so that those skilled in the art can better understand the present application and implement it. However, the embodiments are not intended to limit the present application, and the technical features in the embodiments and the embodiments can be combined with each other without conflict.
[0044] The present application provides an optimization method and optimization system for front-end buried point data reporting, which is used to solve the technical problem of how to optimize the buried point data reporting.
[0045] Embodiment 1:
[0046] The optimization method for front-end buried point data reporting of the present application timely reports the real-time acquired buried point data to the backend for the buried point data that needs to be immediately fed back, and temporarily stores the acquired buried point data in the sessionStorage for the buried point data that does not need to be immediately fed back; performs trend analysis on the API request, uploads the buried point data stored in the sessionStorage to the backend in the case that the API request frequency is lower than the threshold value; based on the beforeunload event of the window of the w3c standard, captures whether the user interface is refreshed or closed, monitors the transmission of the buried point data before the interface is refreshed or closed, and reports the unreported buried point data to the backend.
[0047] In this embodiment, the API request is analyzed for trend, including the following operations: adding three variables in the global variable, previousData, currentData and tempObject, tempObject as a temporary object, respectively having two attributes createTime and count, createTime indicating the earliest API request start time, count indicating the number of API requests counted up to the latest time, currentData object indicating the number of API requests counted currently, previousData indicating the number of API requests counted in the previous period; initially, the count attributes of previousData and currentData are both 0, when the API request is initiated for the first time in the current terminal, the API request initiation time is obtained, and the initiation time is assigned to the createTime attribute of tempData, and the value of the count attribute of tempData is changed to 1; for the API request initiated subsequently, the API request initiation time is subtracted from the createTime attribute in tempData, when the obtained time difference is less than or equal to the first preset value, tempData.count is executed. = tempData.count + 1, when the obtained time difference is greater than the first preset value and less than or equal to the second preset value, the value of currentData is copied to previousData, then the value of tempData.count is copied to currentData, and the value of tempData.count is cleared to 0, and the createTime of tempData is increased by the first preset value on the basis of the original; when the obtained time difference is greater than the second preset value, the values of currentData and previousData are both cleared to 0, the createTime attribute of tempData is set to the API request time, and the count attribute is set to 1; and so on.
[0048] Before analyzing the trend of the API request in this embodiment, the API request is captured in real time, and the API request initiation time is obtained; when analyzing the trend of the API request, a timer is set, and the previousData and currentData in the global variable are cyclically monitored, when currentData is less than or equal to the first preset value and currentData is less than previousData, it indicates that the trend of the current API request is decreasing, and the frequency of the current API request does not exceed the predetermined frequency threshold, and is in an infrequent state.
[0049] In view of the API request type including XMLHttpRequest type and Fetch type; in the embodiment, for the XMLHttpRequest type API request, the onreadystatechange method of the event is listened to, when it is triggered, the readyState of the request is captured as 1, that is, the sending method has been called, the request is being sent, at this time, the initiation time of the current API request can be obtained; for the Fetch type API request, the get method thereof is reconstructed to obtain the initiation time of the current API request.
[0050] The delay reporting of the buried point data, if the interface is closed or the interface is refreshed, the data is lost. For the interface closing or refreshing, the addEventListener method of the window object can be used to listen to the beforeunload event of the page. This is because when the browser window is closed or refreshed, the beforeunload event is triggered. When the event is listened to, the unreported data is executed to report, so that the data loss can be effectively prevented.
[0051] As the optimization and improvement of the embodiment, the reported data is integrated, if the backend interface is adapted, the reported data can be integrated and reported by the front end, the buried point data is integrated into an array and uniformly reported, and the number of request interfaces is reduced.
[0052] The method of the embodiment is for the real-time reporting of the front-end buried point probe data, and the reporting of the buried point data is optimized under the condition that the web page and the backend server cause pressure to the buried point. Based on the above method, the specific operation is:
[0053] (1) Capture API request: the main API request type of the front end is divided into two types of XMLHttpRequest and Fetch type, for the XMLHttpRequest type request, the onreadystatechange method of the event is listened to, when it is triggered, the readyState of the request is captured as 1, that is, the sending method has been called, the request is being sent. At this time, the request initiation time can be obtained. For the fetch type request, the get method thereof is reconstructed to obtain the initiation time of the request;
[0054] (2) When the buried point data is reported, different measures are adopted for different scenes and data types, for example, page abnormal data and error alarm data, which need to be fed back in time, such data is not processed and is immediately reported. The data with low real-time requirement can be stored in the sessionStorage in a key corresponding to the value, and the data is read and reported later;
[0055] (3) API request trend analysis, add three variables in global variables, previousData, currentData and tempObject. tempObject as a temporary object, respectively have two attributes createTime and count respectively indicate the earliest api request start time and the latest time statistics of api request times. currentData object represents the statistical number of current api request, previousData represents the statistical number of api request in the previous period. Initially, the count attributes of previousData and currentData are 0, when the front end initiates the back end request for the first time, get the request initiation time, and assign the time to the createTime attribute of tempData, and the value of the count attribute of tempData is 1. When the subsequent request is initiated, when the time difference obtained by subtracting the createTime attribute in tempData from the request initiation time is less than or equal to 10 seconds, execute tempData.count = tempData.count + 1, when the time difference is greater than 10 seconds and less than or equal to 20 seconds, copy the value of currentData to previousData, then copy the value of tempData.count to currentData, and clear the value of tempData.count to 0, tempData.createTime increases by 10 seconds on the basis of the original. When the time difference is greater than 20 seconds, the values of currentData and previousData are cleared to 0, the createTime attribute of tempData is set to the api request time, and the count attribute is set to 1. In this way;
[0056] (4) Establish a data reporting model to calculate the trend of network requests. Data reporting should be selected when the network request frequency is low to report the buried point data. Reduce the impact on the original program bandwidth. Based on step (3), set the timer to cyclically monitor previousData and currentData in global variables, when currentData is less than or equal to 10 and currentData is less than previousData, it indicates that the current API request trend is declining, and the current API request frequency does not exceed once per second, in the infrequent state. At this time, read the api data waiting to be reported in sessionStorage, and perform reporting;
[0057] (5) Report data integration, if the back-end interface adaptation, the front-end can report data integration after reporting, and integrate the point data into an array, and report uniformly, so as to reduce the number of request interfaces;
[0058] (6) Delayed reporting of point data, if the interface is closed or refreshed, the data is lost, which is the primary pain point to be solved by the application. For interface closing or refreshing, the addEventListener method of the window object can be used to listen to the beforeunload event of the page. This is because when the browser window is closed or refreshed, the beforeunload event is triggered. When the event is detected, the unreported data is executed to report the operation, so that the data loss can be effectively prevented.
[0059] The method adopts delayed reporting and data compression reporting. The network congestion caused by point data reporting is reduced, and the interface lagging and other problems are caused, and the user experience is optimized.
[0060] Embodiment 2:
[0061] The front-end point data reporting optimization system of the application comprises a point data analysis module, a point data processing module, an API request analysis module and a point data delay reporting module. The data analysis module is used for statistical analysis of point data and determination of whether the point data needs to be immediately fed back. The point data processing module is used for timely reporting of the real-time acquired point data to the back-end for the point data needing to be immediately fed back. The point data processing module is used for temporarily storing the acquired point data in the sessionStorage for the point data not needing to be immediately fed back. The API request analysis module is used for trend analysis of API requests. The point data delay reporting module is used for uploading the point data stored in the sessionStorage to the back-end when the API request frequency is lower than a threshold value. The point data delay reporting module is also used for capturing whether the user interface is refreshed or closed based on the beforeunload event of the window of the w3c standard, monitoring the transmission of the point data before the interface is refreshed or closed, and reporting the unreported point data to the back-end.
[0062] The API request analysis module is used for trend analysis of API requests by the following steps:
[0063] (1) Add three variables in the global variable, previousData, currentData and tempObject, tempObject as a temporary object, respectively have two attributes createTime and count, createTime indicates the earliest API request start time, count indicates the number of API requests up to the latest time statistics, currentData object indicates the number of API requests, previousData indicates the number of API requests in the previous time;
[0064] (2) Initially, the count attributes of previousData and currentData are 0, when the front end initiates an API request for the first time, the API request initiation time is obtained, and the initiation time is assigned to the createTime attribute of tempData, and the value of the count attribute of tempData is changed to 1;
[0065] (3) For the API request initiated later, subtract the createTime attribute in tempData from the API request initiation time, when the obtained time difference is less than or equal to the first preset value (such as 10 seconds), execute tempData.count = tempData.count + 1, when the obtained time difference is greater than the first preset value (such as 10 seconds) and less than or equal to the second preset value (such as 20 seconds), copy the value of currentData to previousData, then copy the value of tempData.count to currentData, and clear the value of tempData.count to 0, tempData.createTime is increased by the first preset value (such as 10 seconds) based on the original; When the obtained time difference is greater than the second preset value (such as 20 seconds), the values of currentData and previousData are cleared to 0, the createTime attribute of tempData is set to the API request time, and the count attribute is set to 1. In turn.
[0066] The delay reporting module of the buried point data is used to capture API requests in real time and obtain the initiation time of the API request; and is used to set a timer when performing trend analysis on the API request, and to loop listen to previousData and currentData in the global variable, when currentData is less than or equal to the first preset value and currentData is less than previousData, it indicates that the trend of the current API request is decreasing, and the frequency of the current API request does not exceed the predetermined frequency threshold, and is in an infrequent state.
[0067] The API request type includes XMLHttpRequest type and Fetch type; for the API request of XMLHttpRequest type, the burying point data delay reporting module is used for capturing the request readyState as 1, i.e. the sending method has been called and the request is being sent, through listening to the onreadystatechange method of the event after triggering, and the initiation time of the current API request can be obtained at this time; for the API request of Fetch type, the burying point data delay reporting module is used for obtaining the initiation time of the current API request through reconstructing the get method.
[0068] The burying point data processing module is used for integrating the reported burying point data into an array and uniformly reporting to the backend.
[0069] The system of the embodiment can execute the optimization method of the front-end burying point data reporting disclosed in embodiment 1.
[0070] The above has disclosed and explained the present application in detail through the drawings and preferred embodiments, however, the present application is not limited to these disclosed embodiments, and based on the above multiple embodiments, those skilled in the art can know that the code review means in the above different embodiments can be combined to obtain more embodiments of the present application, and these embodiments are also within the protection scope of the present application.
Claims
1. The optimization method for front-end buried point data reporting is characterized by For buried data that require immediate feedback, the real-time buried data will be reported to the backend in a timely manner. When reporting the buried data, the buried data will be integrated into an array and reported to the backend uniformly. For buried data that do not require immediate feedback, the acquired buried data will be temporarily stored in sessionStorage. The buried data that require immediate feedback include page data and error alarm data, and the buried data that do not require immediate feedback include interface user access data. For buried data that do not require immediate feedback, the acquired buried data will be temporarily stored in the value corresponding to a key in sessionStorage. Capture API requests in real time, obtain the initiation time of API requests, perform trend analysis on API requests, and upload the tracking data stored in sessionStorage to the backend when the API request frequency is lower than the threshold. The API request types include XMLHttpRequest and Fetch. For XMLHttpRequest type API requests, by monitoring the onreadystatechange method of the event, when it is triggered, the readyState of the request is captured as 1, that is, the send method has been called and the request is being sent. At this time, the initiation time of the current API request can be obtained; for Fetch type API requests, by reconstructing its get method, the initiation time of the current API request can be obtained; Based on the W3C standard window beforeunload event, it captures whether the user interface is refreshed or closed. Before the interface is refreshed or closed, it monitors the transmission of tracking data and reports unreported tracking data to the backend. Perform trend analysis on API requests, including the following operations: Add three variables to the global variable, namely previousData, currentData, and tempObject. tempObject is a temporary object with two properties: createTime and count. createTime indicates the start time of the earliest API request, and count indicates the number of API requests counted up to the latest time. The currentData object indicates the number of current API requests, and previousData indicates the number of API requests counted some time ago. Initially, the count attributes of previousData and currentData are both 0. When the front-end initiates an API request for the first time, it obtains the API request initiation time and assigns the initiation time to the createTime attribute of tempData. The value of the count attribute of tempData also changes to 1. For the API request initiated later, the createTime attribute in tempData is subtracted from the time when the API request was initiated. When the obtained time difference is less than or equal to the first preset value, tempData.count = tempData.count + 1 is executed. When the obtained time difference is greater than the first preset value and less than or equal to the second preset value, the value of currentData is copied to previousData, and then the count value of tempData is copied to currentData. The count value of tempData is cleared to 0, and the createTime of tempData is increased by the first preset value on the original basis. When the obtained time difference is greater than the second preset value, the count attribute values of currentData and previousData are both cleared to 0, the createTime attribute of tempData is set to the time of the API request, and the count attribute is set to 1. When performing trend analysis on API requests, a timer is set to cyclically monitor previousData and currentData in the global variables. When currentData is less than or equal to the first preset value and currentData is less than previousData, it indicates that the trend of the current API request is decreasing, and the frequency of the current API request does not exceed the predetermined frequency threshold and is in an infrequent state.
2. The optimization system for front-end buried point data reporting is characterized by By executing the method for optimizing the reporting of buried point data according to claim 1, the buried point data is selectively delayed for reporting, and the system includes: A data analysis module for performing statistical analysis on the buried data to determine whether immediate feedback is required. The embedded point data processing module is used to report the embedded point data acquired in real time to the backend in a timely manner for embedded point data that requires immediate feedback. For embedded point data that does not require immediate feedback, the embedded point data processing module is used to temporarily store the acquired embedded point data in sessionStorage; An API request analysis module, which is used to perform trend analysis on API requests; A delayed reporting module for buried data, which is used to capture API requests in real time and obtain the initiation time of API requests, and to upload the buried data stored in sessionStorage to the backend when the frequency of API requests is lower than the threshold; and to capture whether the user interface is refreshed or closed based on the beforeunload event of the window of the w3c standard, and to monitor the transmission of buried data before the interface is refreshed or closed, and to report the unreported buried data to the backend; and to set a timer when performing trend analysis on API requests, and cyclically monitor previousData and currentData in the global variables. When currentData is less than or equal to the first preset value and currentData is less than previousData, it indicates that the trend of the current API request is declining, and the frequency of the current API request does not exceed the predetermined frequency threshold and is in an infrequent state; The API request analysis module is used to perform trend analysis on API requests through the following steps: Add three variables to the global variable, namely previousData, currentData, and tempObject. tempObject is a temporary object with two properties: createTime and count. createTime indicates the start time of the earliest API request, and count indicates the number of API requests counted up to the latest time. The currentData object indicates the number of current API requests, and previousData indicates the number of API requests counted some time ago. Initially, the count attributes of previousData and currentData are both 0. When the front-end initiates an API request for the first time, it obtains the API request initiation time and assigns the initiation time to the createTime attribute of tempData. The value of the count attribute of tempData also changes to 1. For the API request initiated later, the createTime attribute in tempData is subtracted from the time when the API request was initiated. When the obtained time difference is less than or equal to the first preset value, tempData.count = tempData.count + 1 is executed. When the obtained time difference is greater than the first preset value and less than or equal to the second preset value, the value of currentData is copied to previousData, and then the count value of tempData is copied to currentData. The count value of tempData is cleared to 0, and the createTime of tempData is increased by the first preset value on the original basis. When the obtained time difference is greater than the second preset value, the count attribute values of currentData and previousData are both cleared to 0, the createTime attribute of tempData is set to the time of the API request, and the count attribute is set to 1. The API request types include XMLHttpRequest type and Fetch type; For XMLHttpRequest type API requests, the tracking data delay reporting module is used to monitor the onreadystatechange method of the event. When it is triggered, it captures the readyState of the request as 1, that is, the send method has been called and the request is being sent. At this time, the initiation time of the current API request can be obtained; For Fetch-type API requests, the tracking data delay reporting module is used to obtain the initiation time of the current API request by reconstructing its get method; The buried point data processing module is used to integrate the reported buried point data into an array and report it to the back end in a unified manner.
Citation Information
Patent Citations
Burial point information reporting method and device and electronic equipment
CN113162982A
Burying point data processing method and device and electronic equipment
CN113472858A