Statistical method and device for page loading time, equipment and storage medium
By monitoring the client click event and interface request status in real time, and calculating the page loading time with native click and feedback time, the problem of statistical inaccuracy in the existing technology is solved, the statistical accuracy of page loading and jumping time is improved, and the user experience is enhanced.
Patent Information
- Application Number
- CN202510450387.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-07-29
AI Technical Summary
The existing page loading time statistics method has low accuracy and cannot accurately reflect the waiting time of users when actually using the page. Especially in the financial field, traditional methods fail to calculate dynamic data loading time.
Monitor the client's click events in real time, obtain the native click time, detect the status of all interface requests in the page, calculate the feedback time of the target page, and generate the target page when the interface request is completed, calculate the page loading time through the native click time and feedback time, and listen to the page jump event to calculate the jump time.
It improves the statistical accuracy of page loading time, enhances the user experience, accelerates page loading through parallel processing interface requests, accurately calculates page loading and jumping time, and makes up for the problem of statistical inaccuracy in the prior art.
Smart Images

Figure CN120386947A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and particularly to a method, device, equipment, and storage medium for statistically analyzing page loading time. Background Art
[0002] In the rapidly developing Internet field today, the optimization of user experience has become a key point pursued by major platforms. Among them, the page loading time, as an important factor directly affecting user perception, its accurate statistics and evaluation are particularly important. Traditional page loading time statistical methods mainly rely on statistics such as the first packet time (i.e., the time when the user first receives the server response data packet) and the DMO (Document Object Model) loading duration. To a certain extent, these indicators can reflect the download and rendering speed of page resources, but there is a problem of low statistical accuracy.
[0003] Specifically, traditional statistical methods often only focus on the completion of page resource downloads and the end time of page rendering, but ignore the actual situation that users need to wait for service interface data to be returned to operate normally during actual use. In addition, additional operation times such as authentication are not included in the statistical scope. These omissions result in the inability of traditional statistical methods to comprehensively and accurately reflect the true situation of page loading, thus affecting the accurate evaluation and optimization of user experience.
[0004] In summary, the existing page loading time statistical methods have the technical problem of low statistical accuracy and cannot accurately reflect the waiting time of users when actually using the page.
[0005] For example, in the financial field, assume that a user opens the "Account Overview" page of a mobile banking application, which displays the user's account balance, recent transaction records, and possible investment product recommendations. Traditional page loading time statistics may record the time from when the user clicks the "Account Overview" button to when the page DOM is fully loaded, including the download of all static resources (such as HTML, CSS, JavaScript files) and page rendering. However, traditional statistical methods may only calculate until the static resources are loaded, and cannot calculate the dynamic data loading time of the account balance and transaction records in the account overview page, resulting in low accuracy in statistically analyzing the page loading time. Summary of the Invention
[0006] The purpose of the embodiments of this application is to propose a method, device, equipment, and storage medium for statistically analyzing page loading time, and its main purpose is to improve the accuracy of statistically analyzing page loading time.
[0007] In a first aspect, to solve the above technical problems, an embodiment of the present application provides a method for counting page loading time, adopting the following technical solutions:
[0008] Monitor the click events of the client in real time. When a click event of the client is detected, obtain the native click time corresponding to the click event;
[0009] Detect the status of all interface requests in the page corresponding to the click event. When the status of all the interface requests is loaded, obtain the target page;
[0010] Obtain the feedback time of the target page fed back to the client, and calculate the page loading time of the target page according to the native click time and the feedback time;
[0011] When a jump event of the target page is detected, obtain the event type of the jump event, and calculate the page jump time of the jump event according to the event type.
[0012] In a second aspect, to solve the above technical problems, an embodiment of the present application further provides a device for counting page loading time, adopting the following technical solutions:
[0013] A native time generation module for monitoring the click events of the client in real time. When a click event of the client is detected, obtain the native click time corresponding to the click event;
[0014] A page generation module for detecting the status of all interface requests in the page corresponding to the click event. When the status of all the interface requests is loaded, obtain the target page;
[0015] A loading time calculation module for obtaining the feedback time of the target page fed back to the client, and calculating the page loading time of the target page according to the native click time and the feedback time;
[0016] A jump time calculation module for obtaining the event type of the jump event when a jump event of the target page is detected, and calculating the page jump time of the jump event according to the event type.
[0017] In a third aspect, to solve the above technical problems, an embodiment of the present application further provides a computer device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for counting page loading time as described above.
[0018] Fourthly, to solve the above technical problems, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which when executed by a processor implements the method for statistically calculating the page loading time as described above.
[0019] Compared with the prior art, the embodiments of the present application mainly have the following beneficial effects:
[0020] The click events of the client are monitored in real time. When the click event of the client is detected, the native click time corresponding to the click event is obtained. By obtaining the native click time corresponding to the click event from the occurrence of the click event, the real sensory time of the user can be accurately obtained, and the statistical accuracy of the page loading time is improved.
[0021] By detecting the status of all request interfaces in the page corresponding to the click event, when the status of all interface requests is loaded, the target page is obtained, and multiple interface requests can be processed in parallel, improving the page loading speed and thus enhancing the user experience.
[0022] The page loading time is accurately calculated through the native click time and the feedback time, avoiding the time that may be missing in the statistical calculation of the page loading time, accurately calculating the real sensory time of the user, and improving the statistical accuracy of the page loading time.
[0023] By calculating the page loading time when the page jumps, the statistical accuracy of the page jump time can be improved, and it also makes up for the problem of poor statistical accuracy caused by the inability to statistically calculate the page jump time in the prior art, improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] To more clearly illustrate the solutions in the present application, the following will briefly introduce the drawings required for the description of the embodiments of the present application. Obviously, the following drawings are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0025] Figure 1 is an exemplary system architecture diagram to which the present application can be applied;
[0026] Figure 2 is a flowchart of an embodiment of the method for statistically calculating the page loading time according to the present application;
[0027] Figure 3 is a schematic structural diagram of an embodiment of the device for statistically calculating the page loading time according to the present application;
[0028] Figure 4 is a schematic structural diagram of an embodiment of the device according to the present application. Detailed implementation manners
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field to which this application belongs; the terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above drawings are intended to cover non-exclusive inclusion. The terms "first", "second", etc. in the specification and claims of this application or the above drawings are used to distinguish different objects and not to describe a specific order.
[0030] Reference to "embodiment" herein means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0031] To enable those skilled in the technical field to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0032] As Figure 1 shown, the system architecture 100 may include a terminal device 101, a network 102, and a server 103. The terminal device 101 may be a laptop computer 1011, a tablet computer 1012, or a mobile phone 1013. The network 102 is a medium for providing a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0033] The user may use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications may be installed on the terminal device 101, such as a web browser application, a shopping application, a search application, an instant messaging tool, an email client, a social platform software, etc.
[0034] The terminal device 101 can be various electronic devices with a display screen and supporting web browsing. In addition to the laptop 1011, tablet computer 1012, or mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer, a desktop computer, and the like.
[0035] The server 103 can be a server that provides various services, such as a background server that supports the pages displayed on the terminal device 101.
[0036] It should be noted that the method for statistically calculating the page loading time provided in the embodiments of the present application is generally executed by the server / terminal device. Correspondingly, the device for statistically calculating the page loading time is generally set in the server / terminal device.
[0037] It should be understood that Figure 1 the numbers of the terminal devices, networks, and servers in
[0038] Continue to refer to Figure 2 , which shows a flowchart of an embodiment of the method for statistically calculating the page loading time according to the present application. According to different requirements, the order of the steps in this flowchart can be changed, and some steps can be omitted. The method for statistically calculating the page loading time provided in the embodiments of the present application can be applied to any scenario that requires statistical calculation of the page loading time, and then the method for statistically calculating the page loading time can be applied to the products in these scenarios. The method for statistically calculating the page loading time includes the following steps:
[0039] Step S201: Monitor the click event of the client in real time. When the click event of the client is detected, obtain the native click time corresponding to the click event.
[0040] In this embodiment, the electronic device on which the method for statistically calculating the page loading time runs (such as Figure 1The server / terminal device shown can obtain the initial claim settlement service information, slot information, etc. through a wired connection method or a wireless connection method. It should be noted that the above wireless connection method can include, but is not limited to, 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other currently known or future-developed wireless connection methods.
[0041] In this embodiment, the above client refers to a web browser, a mobile application, etc.; the above click event refers to opening a web page, jumping to a web page, etc.; the native click time refers to the timestamp of the user's click when the click event occurs; a preset event monitoring module is constructed, and the event monitoring module is configured in the client. By continuously listening to the user operations of the client through this event monitoring module, when it is detected that a predefined click event occurs, the current timestamp is obtained from the system clock or a high-precision timer, etc., and the obtained current timestamp is used as the native click time corresponding to the click event, and the click event and the corresponding native click time are recorded.
[0042] In a feasible example A in the financial field, a certain securities company needs to count the page loading time when a user clicks on its official website. The user enters the official website address of the securities company in the browser. When the user clicks the loading button, the occurrence of the click event is monitored through a preset event monitoring module, and the timestamp corresponding to the occurrence of the click event is obtained, and this timestamp is used as the original click time corresponding to the click event.
[0043] In this embodiment, the click events of the client are monitored in real time. When it is detected that the click event of the client occurs, the native click time corresponding to the click event is obtained. By obtaining the native click time corresponding to the click event from the moment when the click event occurs, the real sensory time of the user can be accurately obtained, and the statistical accuracy of the page loading time is improved.
[0044] Step S202: Detect the status of all interface requests in the page corresponding to the click event. When the status of all the interface requests is loaded, the target page is obtained.
[0045] In this embodiment, after it is detected that the user triggers a click event on the client, all interface requests associated with the click event are identified. The interface request refers to a loading request for generating all blocks in the page corresponding to the click event. For example, in the official website page of a securities company, the loading requests for interface requests such as the fund block and the wealth management block; when it is detected that the status of all the monitored interface requests is loaded, the target page corresponding to the click event is generated at this time.
[0046] In one embodiment, detecting the status of all interface requests corresponding to the click event, and when the status of all the interface requests is loaded, obtaining the target page, including:
[0047] Determining the interface requests to be initiated according to the click event;
[0048] For each initiated interface request, using the corresponding monitoring mechanism to monitor the status of the interface request;
[0049] When it is monitored that the status of each interface request is loaded, assembling the content of each interface request to obtain the target page.
[0050] In this embodiment, when the click event triggered by the client is detected in step S201 (such as clicking a button, link, etc.), according to the event object of the click event triggered by the client (such as the link to jump to the official website of the securities company, the click element ID of a certain block in the official website link, etc.), the interface requests to be sent to the server are determined from the preset interface mapping table. For each determined interface request, a request is initiated through the asynchronous request mechanism of JavaScript, and a corresponding monitoring mechanism is set for each request. The monitoring mechanism can be based on Promise, or can use callback functions or event listeners to monitor the status of the corresponding interface request in real time (such as loading, loading completed, loading failed, etc.); when the corresponding monitoring mechanisms all detect that the status of the corresponding interface requests are all loaded, the data returned by the loaded interface requests is inserted into the DOM structure of the page to generate the target page.
[0051] In this embodiment, by monitoring the status of the interface requests in real time, the page can be generated immediately when the interface requests are loaded. And through the asynchronous request mechanism, multiple interface requests can be loaded simultaneously, improving the response speed of the page, thereby reducing the waiting time of the user; it is set that the final target page can only be formed when all interface requests are loaded, avoiding the inconsistency of the target page and ensuring that the data displayed on the page is accurate, not only improving the user experience, but also ensuring the consistency and accuracy of the page.
[0052] In another embodiment, the determining the interface requests to be initiated according to the click event includes:
[0053] Obtaining the event object of the click event, extracting the event information included in the event object and the event type corresponding to the event information to obtain an event information set;
[0054] According to the event type, splitting the event information set into a static event information set and a dynamic event information set;
[0055] Determine a first set of interface requests from a preset interface mapping table according to the set of static event information;
[0056] Analyze the dynamic data in the set of dynamic event information, and according to the dynamic data, process the dynamic data by using a corresponding mapping method to generate a processing result, and construct a second set of interface requests according to the processing result;
[0057] Merge the first set of interface requests and the second set of interface requests to determine the interface requests that need to be initiated.
[0058] In this embodiment, the above-mentioned set of static event information refers to information that does not change when a click event occurs, such as the home page button, financial management button, etc. on the official website of a securities company; the above-mentioned set of dynamic event information refers to information that may change when a click event occurs. The dynamic information is usually different results generated by user input, time relationship influence, external data, etc., and may be different each time a click event occurs. For example, the increase and decrease data of each stock on the official website of a securities company, the news information on the community page, etc.; the above-mentioned preset interface mapping table stores the mapping relationships of each interface corresponding to the static event information; the above-mentioned corresponding mapping method refers to rule mapping and algorithm calculation. The rule mapping refers to a method of mapping dynamic event information to a specific interface request, and different interface requests are selected according to the value of the dynamic information; the algorithm calculation is to process the dynamic event information through an algorithm and construct an interface request according to the calculation result.
[0059] In this embodiment, when a click event is monitored to occur, obtain the event object of the click event (such as jumping to the official website of a securities company), traverse each attribute of the event object, extract the event information contained therein, classify the extracted event information according to its nature (static event information or dynamic event information), and integrate the classified event information to obtain a set of static event information and a set of dynamic event information. For the set of static event information, use the mapping relationship in the preset interface mapping table to determine the interface request corresponding to each static event information in the set of static event information to obtain a first set of interface requests; for each dynamic event information in the set of dynamic event information, parse the dynamic data of the dynamic event information through a preset parsing method, and select a corresponding mapping method according to the business logic of the dynamic data to process the dynamic data. The mapping method refers to the above-mentioned rule mapping (such as selecting different interface requests according to the value of the dynamic data) or algorithm calculation (such as processing the dynamic data through an algorithm and generating an interface request according to the calculation interface). Finally, generate the interface request corresponding to each dynamic event information, summarize the interface requests corresponding to each dynamic event information to obtain a second set of interface requests; merge the first set of interface requests and the second set of interface requests to determine the set of interface requests that need to be initiated for the click event.
[0060] In this embodiment, by dividing the event information into static and dynamic parts and processing them simultaneously, different click events can be flexibly applied, and the page loading speed can be improved. Moreover, when new interface requirements emerge, there is no need to make large-scale modifications to the entire system, and only the interface mapping method needs to be updated, which improves the flexibility of page loading.
[0061] Continuing with the above-mentioned feasible example A, after the user clicks the loading button on the official website of the securities company, the status of all block interface requests in the official website page is detected. When all block request interfaces are loaded, the official website page is generated.
[0062] In this embodiment, by detecting the status of all request interfaces in the page corresponding to the click event, when the status of all interface requests is loaded, the target page is obtained, which can process multiple interface requests in parallel, improve the page loading speed, and thus improve the user experience.
[0063] Step S203: Obtain the feedback time of the target page fed back to the client, and calculate the page loading time of the target page according to the native click time and the feedback time.
[0064] In this embodiment, the feedback time refers to the time point when the target page generated in step S202 is fed back to the client; obtain the feedback time of the target page fed back to the client, and calculate the page loading time of the target page according to the native click time and the feedback time.
[0065] In one embodiment, calculating the loading time of the target page according to the native click time and the feedback time includes:
[0066] Taking the native click time as the client timestamp to obtain the first client timestamp;
[0067] Obtaining the timestamp corresponding to the click event to obtain the first server timestamp;
[0068] Comparing the difference between the first client timestamp and the first server timestamp to obtain the network latency time;
[0069] Comparing the difference between the feedback time and the native click time to obtain the initial page loading time;
[0070] Subtracting twice the network latency time from the initial page loading time to obtain the page loading time of the target page.
[0071] In this embodiment, when the client triggers a click event, the click event triggered by the client is responded to, and this time point is recorded as the timestamp of the first server. The timestamp of the first server represents the moment when the server starts to process the click event trigger. By comparing the difference between the first client time and the first server time, the network latency time is obtained. When the client receives the target page, the timestamp at this time is recorded, and this timestamp is used as the feedback time. Next, by comparing the difference between the native click time and the feedback time, the initial loading time is obtained. The initial loading time includes the total time of links such as network latency time and server processing time. Since network latency is two-way (client-server, server-client), when calculating the loading time of the target page, twice the network latency time needs to be subtracted from the initial loading time, and finally the page loading time of the target page is obtained.
[0072] In this embodiment, by subtracting twice the network latency time from the initial loading time, the loading time can be calculated more accurately, the accuracy of loading time calculation can be improved, and further the accuracy of page loading statistics can be improved; and the accurate page loading time helps to identify performance bottlenecks and provide directions for improvement.
[0073] In another embodiment, after subtracting twice the network latency time from the initial page loading time to obtain the page loading time of the target page, the method further includes:
[0074] Presetting a network latency time threshold and a page loading time threshold;
[0075] Comparing the network latency time with the network latency time threshold. When the network latency time is greater than the network latency time threshold, a prompt report is generated and the prompt report is fed back to the client;
[0076] Comparing the page loading time with the page loading time threshold. When the page loading time is greater than the page loading time threshold, a page performance optimization process is triggered, and the page loading time is reduced through the page performance optimization process.
[0077] In this embodiment, the network delay time threshold refers to the network delay time within the acceptable range of users. The specific setting method can be based on historical data, industry standards, etc. to set the network evaluation threshold. For example, when opening the official website of a securities company, a network delay within 100 milliseconds is acceptable to users. Therefore, the network delay time threshold can be set at 100 milliseconds. The page loading time threshold refers to the page loading time acceptable to users. The specific setting method can be to collect the feedback of volunteers, etc. Compare the obtained network delay time with the network delay time threshold. When the network delay time is less than or equal to the network delay time threshold, it is determined that the network environment is good at this time. When the network delay time is greater than the network delay time threshold, a prompt message is generated to prompt the user that the current network environment is poor. Compare the obtained page loading time with the page loading time threshold. When the page loading time is less than or equal to the page loading time threshold, it is determined that the page loading time is normal at this time. When the page loading time is greater than the page loading time threshold, a performance optimization process is triggered. The performance optimization process includes client optimization methods and server optimization methods to reduce the page loading time through the performance optimization process.
[0078] In this embodiment, by comparing the calculated network delay time and page loading time with the corresponding pre-settings and adopting corresponding methods for optimization or prompting according to the comparison results, the problem can be timely discovered and optimized, improving the user experience and reducing the user's waiting time.
[0079] In another embodiment, triggering the page performance optimization process and reducing the page loading time through the page performance optimization process includes:
[0080] Identifying the type of performance bottleneck of the page loading time;
[0081] When the type of performance bottleneck is that the client rendering time is too long, the page loading time is reduced by optimizing the front-end code and reducing the page resource loading;
[0082] When the type of performance bottleneck is that the server processing time is too long, the page loading time is reduced by optimizing the server code.
[0083] In this embodiment, by querying the server log, the time of the server request and the resource occupancy are obtained from the server log. If the time of the server request exceeds the preset server request time threshold, it is determined that the performance bottleneck type is that the server processing time is too long. When the server processing time is too long, the load balancing technology is used to distribute to multiple servers, and multiple task queues are synchronously processed asynchronously to reduce the page loading time, and a warning message is generated after the processing is completed to remind the maintenance personnel to expand the hardware (such as increasing the server CPU, memory, storage device, etc.); if the time of the server request does not exceed the preset server request time threshold, it is determined that the performance bottleneck type is that the client rendering time is too long, and the page loading time is reduced by optimizing the front-end code and reducing the page resource loading. The optimization of the front-end code refers to code splitting and lazy loading. The code splitting and lazy loading means splitting the code into smaller modules and using the lazy loading technology to reduce the initial loading time; the reduction of the page resource loading refers to compressing and merging resources. The compressing and merging of resources means adjusting the picture format and size and compressing resources such as pictures to reduce the client rendering time, thereby reducing the page loading time.
[0084] In this embodiment, by identifying the performance bottleneck type and adopting corresponding performance optimization methods for different performance bottleneck types for optimization, the page loading time is reduced, the resource utilization rate is improved, and thus the user experience is improved.
[0085] Continuing with the above-mentioned feasible example A, when the target page is received in the client used by the user, the timestamp at this time is recorded and used as the feedback time. The time when the server responds to the user's click on the official website link is obtained. According to the difference between the time when the user clicks on the official website link and the time when the server responds to the user's click on the official website link, the network delay time is calculated. The difference between the above-mentioned native click event and the feedback time is used to obtain the initial page loading time, and then the initial page loading time is subtracted by the two network delay times to finally obtain the page loading time of the securities official website page.
[0086] In this embodiment, the page loading time is accurately calculated through the native click time and the feedback time, avoiding the possible missing time in the statistics of the page loading time, accurately calculating the user's real perception time, and improving the accuracy of the statistics of the page loading time.
[0087] Step S204: When a jump event occurs on the target page is monitored, obtain the event type of the jump event, and calculate the page jump time of the jump event according to the event type.
[0088] In this embodiment, a preset event listening mechanism is used to listen for jump events on the target page. When a jump event occurs on the target page, the event type of the jump event is determined. The event types include same-page jump events and different-page jump events. For example, in a securities official website, there are a home page, a stock details page, a transaction record page, etc. Jumping from the home page to the stock details page is a different-page jump event, and switching from the first stock details to the second stock details on the stock details page is a same-page jump event. The page jump times of the jump events are calculated respectively.
[0089] In one embodiment, obtaining the event type of the jump event and calculating the jump time of the jump event according to the event type includes:
[0090] When the jump event occurs, record the timestamp to obtain the jump request timestamp;
[0091] Judge the event type of the jump event according to the predefined event type mapping table;
[0092] Determine the jump completion condition for the jump to be completed according to the event type;
[0093] When the jump completion condition is reached, record the timestamp to obtain the jump completion timestamp;
[0094] Calculate the page loading time of the jump event according to the jump request timestamp and the jump completion timestamp.
[0095] In this embodiment, the predefined event mapping table is a data structure used to map event identifiers (such as event names, etc.) to corresponding event type descriptions. Among them, the predefined event mapping table includes event identifiers, event types, and jump completion conditions. The event identifier is a unique string or symbol used to identify a specific event, such as the event identifier for same-page jumps and the event identifier for different-page jumps in this application; the event type is associated with the event identifier, including same-page jumps and different-page jumps; the jump completion condition is additional information associated with the event type used to determine how to judge whether the jump time has been completed. For example, the completion condition for a different-page jump event is that the DOM of the new page is fully loaded and rendered. When a jump event is detected, respond to the request of the jump event and record the timestamp corresponding to the request of the jump event to obtain the jump request timestamp; and determine the event type of the jump event according to the predefined event mapping table and determine the jump completion condition of the jump event according to the predefined event mapping table. When it is detected that the jump completion condition has been met, record the timestamp when the jump completion condition is met to obtain the jump completion timestamp, and calculate the page loading time of the jump event according to the jump request timestamp and the jump completion timestamp.
[0096] In this embodiment, by recording the page loading times of same-page jumps and cross-page jumps, the problem of missing loading time statistics for page jump events in the prior art is solved, the diversity of loading time statistics is improved, and thus the diversity of page statistics is enhanced. This also provides a basis for subsequent optimization directions and improves the user experience.
[0097] Continuing with the above-mentioned feasible Example A, when the user switches from the home page to the stock details page on the securities official website page, when it is detected that the user clicks the switch button, the timestamp at this time is obtained, and the event type of the jump event and the corresponding jump completion condition are determined according to the predefined event mapping table. When the jump completion condition is met, the timestamp at this time is recorded, and the page loading time for the user to switch from the home page to the stock details page is calculated based on the two recorded timestamps.
[0098] In this embodiment, by calculating the page loading time during page jumps, the statistical accuracy of page jump times can be improved, and the problem of poor statistical accuracy caused by the inability to statistically analyze page jump times in the prior art is also remedied, enhancing the user experience.
[0099] It should be emphasized that to further ensure the privacy and security of the above-mentioned page loading times, etc., the above-mentioned page loading times, etc. can also be stored in a node of a blockchain.
[0100] The blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. A blockchain, essentially a decentralized database, is a string of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer, etc.
[0101] The embodiments of this application can obtain and process relevant data based on artificial intelligence technologies. Among them, artificial intelligence (AI) is to use a digital computer or a machine controlled by a digital computer to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use the knowledge to obtain the best results in theory, methods, technologies, and application systems.
[0102] The basic technologies of artificial intelligence generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation / interaction systems, and mechatronics. The software technologies of artificial intelligence mainly include several major directions such as computer vision technology, robotics, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0103] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disc, a Read-Only Memory (ROM), or a Random Access Memory (RAM), etc.
[0104] It should be understood that although the steps in the flowchart of the accompanying drawings are shown in sequence according to the indication of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings can include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same moment, but can be executed at different moments, and their execution order is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.
[0105] Further reference Figure 3 to Figure 2 As an implementation of the method shown above, an embodiment of a statistical device for page loading time is provided in this application. This device embodiment corresponds to the method embodiment shown in Figure 2 and this device can be specifically applied to various computer devices.
[0106] As Figure 3 shown, the statistical device 300 for page loading time described in this embodiment includes: a native time generation module 301, a page generation module 302, a loading time calculation module 303, and a jump time calculation module 304. Among them:
[0107] The native time generation module 301 is used to monitor the click events of the client in real time. When the click event of the client is detected, the native click time corresponding to the click event is obtained;
[0108] The page generation module 302 is used to detect the status of all interface requests in the page corresponding to the click event. When the status of all the interface requests is loaded, the target page is obtained.
[0109] In one embodiment, the page generation module further includes:
[0110] The request initiation sub-module is used to determine the interface requests to be initiated according to the click event.
[0111] The status monitoring sub-module is used to monitor the status of each initiated interface request by using the corresponding monitoring mechanism.
[0112] The content assembly sub-module is used to assemble the content of each interface request when it is detected that the status of each interface request is loaded, and obtain the target page.
[0113] In another embodiment, the request initiation sub-module further includes:
[0114] The event information extraction sub-unit is used to obtain the event object of the click event, extract the event information contained in the event object and the event type corresponding to the event information, and obtain the event information set.
[0115] The event information splitting sub-unit is used to split the event information set into a static event information set and a dynamic event information set according to the event type.
[0116] The first interface request determination sub-unit is used to determine the first interface request set from a preset interface mapping table according to the static event information set.
[0117] The second interface request determination sub-unit is used to parse the dynamic data in the dynamic event information set, process the dynamic data by using the corresponding mapping method according to the dynamic data, generate a processing result, and construct a second interface request set according to the processing result.
[0118] The interface request merging sub-unit is used to merge the first interface request set and the second interface request set to determine the interface requests to be initiated.
[0119] The loading time calculation module 303 is used to obtain the feedback time of the target page fed back to the client, and calculate the page loading time of the target page according to the native click time and the feedback time.
[0120] In one embodiment, the loading time calculation module includes:
[0121] The first timestamp acquisition sub-module is used to use the native click time as the client timestamp to obtain the first client timestamp.
[0122] A second timestamp acquisition sub-module, configured to acquire a timestamp corresponding to the click event to obtain a first server timestamp;
[0123] A network latency calculation sub-module, configured to compare the difference between the first client timestamp and the first server timestamp to obtain a network latency time;
[0124] A first loading time calculation sub-module, configured to compare the difference between the feedback time and the native click time to obtain an initial page loading time;
[0125] A second loading time calculation sub-module, configured to subtract twice the network latency time from the initial page loading time to obtain the page loading time of the target page.
[0126] In another embodiment, the loading time calculation module further includes:
[0127] A threshold setting sub-module, configured to preset a network latency time threshold and a page loading time threshold;
[0128] A first comparison sub-module, configured to compare the network latency time with the network latency time threshold. When the network latency time is greater than the network latency time threshold, generate a prompt report and feedback the prompt report to the client;
[0129] A second comparison sub-module, configured to compare the page loading time with the page loading time threshold. When the page loading time is greater than the page loading time threshold, trigger a page performance optimization process to reduce the page loading time through the page performance optimization process.
[0130] In another embodiment, the second comparison sub-module includes:
[0131] A bottleneck type identification sub-unit, configured to identify the performance bottleneck type of the page loading time;
[0132] A first optimization sub-unit, configured to, when the performance bottleneck type is that the client rendering time is too long, reduce the page loading time by optimizing the front-end code and reducing the page resource loading;
[0133] A second optimization sub-unit, configured to, when the performance bottleneck type is that the server processing time is too long, reduce the page loading time by optimizing the server code.
[0134] A jump time calculation module 304, configured to, when a jump event occurs on the target page, acquire the event type of the jump event and calculate the page jump time of the jump event according to the event type.
[0135] In one embodiment, the jump event calculation module includes:
[0136] A first jump timestamp acquisition sub-module, configured to record a timestamp when the jump event occurs, so as to obtain a jump request timestamp;
[0137] A jump event type acquisition sub-module, configured to determine the event type of the jump event according to a predefined event type mapping table;
[0138] A jump completion condition acquisition sub-module, configured to determine a jump completion condition for jump completion according to the event type;
[0139] A second jump timestamp acquisition sub-module, configured to record a timestamp when the jump completion condition is reached, so as to obtain a jump completion timestamp;
[0140] A jump page loading time acquisition sub-module, configured to calculate the page loading time of the jump event according to the jump request timestamp and the jump completion timestamp.
[0141] In this embodiment, the click events of the client are monitored in real time. When it is monitored that the click event of the client occurs, the native click time corresponding to the click event is obtained. By obtaining the native click time corresponding to the click event from the occurrence of the click event, the real sensory time of the user can be accurately obtained, and the statistical accuracy of the page loading time is improved.
[0142] By detecting the status of all request interfaces in the page corresponding to the click event, when the status of all interface requests is loaded, the target page is obtained, and multiple interface requests can be processed in parallel, so as to improve the page loading speed and further improve the user experience.
[0143] Through the native click time and the feedback time, the page loading time is accurately calculated, avoiding the possible missing time in the statistics of the page loading time, accurately calculating the real sensory time of the user, and improving the statistical accuracy of the page loading time.
[0144] By calculating the page loading time during page jump, the statistical accuracy of the page jump time can be improved, and the problem of poor statistical accuracy caused by the inability to statistically calculate the page jump time in the prior art is also compensated, improving the user experience.
[0145] To solve the above technical problems, an embodiment of the present application further provides a device (computer device). Specifically, please refer to Figure 4 , Figure 4 which is the basic structural block diagram of the computer device in this embodiment.
[0146] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are communicatively connected to each other via a system bus. It should be noted that only the computer device 4 with a memory 41, a processor 42, and a network interface 43 is shown in the figure. However, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Among them, those skilled in the art of the present technology can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0147] The computer device can be a computing device such as a desktop computer, a notebook, a palm computer, and a cloud server. The computer device can interact with the user through a keyboard, a mouse, a remote control, a touchpad, or a voice control device, etc.
[0148] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit and the external storage device of the computer device 4. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for the statistical method of page loading time, etc. In addition, the memory 41 can also be used to temporarily store various data that have been output or will be output.
[0149] In some embodiments, the processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the computer-readable instructions stored in the memory 41 or process data, such as running the computer-readable instructions of the statistical method for the page loading time.
[0150] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0151] During the implementation of the electronic device of the present application, the click events of the client are monitored in real time. When the click events of the client are detected, the native click time corresponding to the click events is obtained. By obtaining the native click time corresponding to the click events from the occurrence of the click events, the real sensory time of the user can be accurately obtained, and the statistical accuracy of the page loading time is improved.
[0152] By detecting the status of all request interfaces in the page corresponding to the click event, when the status of all interface requests is loaded, the target page is obtained, and multiple interface requests can be processed in parallel, improving the page loading speed and thus improving the user experience.
[0153] Through the native click time and the feedback time, the page loading time is accurately calculated, avoiding the possible missing time in the statistical page loading time, accurately calculating the real sensory time of the user, and improving the statistical accuracy of the page loading time.
[0154] By calculating the page loading time when the page jumps, the statistical accuracy of the page jump time can be improved, and it also makes up for the problem of poor statistical accuracy caused by the inability to count the page jump time in the prior art, improving the user experience.
[0155] The present application also provides another implementation manner, that is, to provide a storage medium (computer-readable storage medium). The computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor, so that the at least one processor executes the steps of the statistical method for the page loading time as described above.
[0156] During the implementation of the computer-readable storage medium of the present application, the click events of the client are monitored in real time. When a click event of the client is detected, the native click time corresponding to the click event is obtained. By obtaining the native click time corresponding to the click event from the occurrence of the click event, the real sensory time of the user can be accurately obtained, and the statistical accuracy of the page loading time is improved.
[0157] By detecting the status of all request interfaces in the page corresponding to the click event, when the status of all interface requests is loaded, the target page is obtained. Multiple interface requests can be processed in parallel, the page loading speed is increased, and thus the user experience is improved.
[0158] Through the native click time and the feedback time, the page loading time is accurately calculated, avoiding the time that may be missing during the statistics of the page loading time, accurately calculating the real sensory time of the user, and improving the statistical accuracy of the page loading time.
[0159] By calculating the page loading time when the page jumps, the statistical accuracy of the page jump time can be improved, and the problem of poor statistical accuracy caused by the inability to count the page jump time in the prior art is also made up for, improving the user experience.
[0160] The non-company software tools or components that appear in the embodiments of the present application are only for illustrative introduction and do not represent actual use.
[0161] Through the description of the above implementation manners, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation manner. Based on such an understanding, the technical solution of the present application, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc), including several instructions for causing a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in the various embodiments of the present application.
[0162] Obviously, the embodiments described above are only a part of the embodiments of this application, rather than all of them. The preferred embodiments of this application are given in the accompanying drawings, but they do not limit the patent scope of this application. This application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosed content of this application more thorough and comprehensive. Although this application has been described in detail with reference to the foregoing embodiments, for those skilled in the art, they can still modify the technical solutions described in the foregoing specific embodiments, or perform equivalent replacements for some of the technical features. Any equivalent structures made by using the content of this application's specification and drawings, directly or indirectly applied in other related technical fields, are equally within the scope of patent protection of this application.
Claims
1. A method for statistically calculating page loading time, characterized in that, The method includes: Real-time monitoring of click events on the client side. When a click event on the client side is detected, obtain the native click time corresponding to the click event; Detect the status of all interface requests in the page corresponding to the click event. When the status of all interface requests is loaded, obtain the target page; Obtain the feedback time of the target page fed back to the client side, and calculate the page loading time of the target page according to the native click time and the feedback time; When a jump event occurs on the target page is monitored, obtain the event type of the jump event, and calculate the page jump time of the jump event according to the event type.
2. The statistical method for page loading time according to claim 1, wherein The step of detecting the status of all interface requests in the page corresponding to the click event and obtaining the target page when the status of all interface requests is loaded includes: Determine the interface requests to be initiated according to the click event; For each initiated interface request, use the corresponding monitoring mechanism to monitor the status of the interface request; When it is monitored that the status of each interface request is loaded, assemble the content of each interface request to obtain the target page.
3. The statistical method for page loading time according to claim 2, wherein The step of determining the interface requests to be initiated according to the click event includes: Obtain the event object of the click event, extract the event information contained in the event object and the event type corresponding to the event information to obtain an event information set; According to the event type, split the event information set into a static event information set and a dynamic event information set; According to the static event information set, determine a first set of interface requests from a preset interface mapping table; Parse the dynamic data in the dynamic event information set, process the dynamic data using the corresponding mapping method according to the dynamic data to generate a processing result, and construct a second set of interface requests according to the processing result; Merge the first set of interface requests and the second set of interface requests to determine the interface requests to be initiated.
4. The statistical method for page loading time according to claim 1, wherein, The step of calculating the loading time of the target page according to the native click time and the feedback time includes: Use the native click time as the client timestamp to obtain a first client timestamp; Obtain the timestamp corresponding to the click event response to obtain a first server timestamp; Compare the difference between the first client timestamp and the first server timestamp to obtain the network latency time; Compare the difference between the feedback time and the native click time to obtain the initial page loading time; Subtract twice the network latency time from the initial page loading time to obtain the page loading time of the target page.
5. The statistical method for page loading time according to claim 4, characterized in that, After subtracting twice the network latency time from the initial page loading time to obtain the page loading time of the target page, the method further includes: Preset a network latency time threshold and a page loading time threshold in advance; Compare the network latency time with the network latency time threshold. When the network latency time is greater than the network latency time threshold, generate a prompt report and feedback the prompt report to the client side; Compare the page loading time with the page loading time threshold. When the page loading time is greater than the page loading time threshold, trigger a page performance optimization process to reduce the page loading time through the page performance optimization process.
6. The statistical method for page loading time according to claim 5, characterized in that, The triggering of the page performance optimization process and reducing the page loading time through the page performance optimization process includes: Identifying the type of performance bottleneck of the page loading time; When the type of performance bottleneck is that the client rendering time is too long, reduce the page loading time by optimizing the front-end code and reducing the loading of page resources; When the type of performance bottleneck is that the server processing time is too long, reduce the page loading time by optimizing the server code.
7. The statistical method for page loading time according to claim 1, wherein The obtaining of the event type of the jump event and calculating the jump time of the jump event according to the event type includes: When the jump event occurs, record the timestamp to obtain the jump request timestamp; Judge the event type of the jump event according to the predefined event type mapping table; Determine the jump completion condition for the jump to be completed according to the event type; When the jump completion condition is reached, record the timestamp to obtain the jump completion timestamp; Calculate the page loading time of the jump event according to the jump request timestamp and the jump completion timestamp.
8. A statistical device for page loading time, characterized in that The device includes: A native time generation module for real-time monitoring of click events on the client side. When it detects that a click event on the client side occurs, obtain the native click time corresponding to the click event; A page generation module for detecting the status of all interface requests in the page corresponding to the click event. When the status of all the interface requests is loaded, obtain the target page; A loading time calculation module for obtaining the feedback time of the target page fed back to the client side and calculating the page loading time of the target page according to the native click time and the feedback time; A jump time calculation module for, when it detects that a jump event occurs on the target page, obtaining the event type of the jump event and calculating the page jump time of the jump event according to the event type.
9. A computer device, characterized in that, The computer device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor. The instructions are executed by the at least one processor so that the at least one processor can execute the statistical method of the page loading time as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the statistical method of the page loading time as described in any one of claims 1 to 7.