Webpage page monitoring method and device, equipment and storage medium
By injecting JavaScript into the client browser program, the system monitors and uniformly formats performance anomaly data of web pages and browsers, solving the problem of low efficiency in web page monitoring and achieving efficient and accurate monitoring and optimization.
Patent Information
- Application Number
- CN202111078928.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-15
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2041-09-15
AI Technical Summary
Current technologies for monitoring web pages suffer from high repetition and low efficiency, resulting in poor monitoring performance.
JavaScript is injected into the client's browser program to monitor the browser and web page performance and abnormal data, and then sends the data to the server for analysis after standardizing the format.
By standardizing the data format, redundant monitoring is avoided, improving monitoring efficiency and the completeness and accuracy of data collection, and providing data support for optimizing web pages.
Smart Images

Figure CN113821406B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of computers, and in particular to a webpage page monitoring method and device, equipment and a storage medium. BACKGROUND
[0002] With the development of computer technology, application program developers will develop a large number of application programs (Application, APP for short), each APP has multiple web pages (H5 pages) developed by using HyperText Markup Language 5 (HTML5 for short), but because users will have more or less problems when experiencing H5 pages, therefore, it is necessary to monitor and optimize H5 pages.
[0003] In the prior art, when monitoring and optimizing H5 pages, each developer of H5 usually develops a function for monitoring the related performance and abnormalities of H5, and then reports the monitoring data of H5 developed by each developer to the respective server, and finally each developer optimizes the H5 page according to the data collected by the server corresponding to each developer. However, multiple H5 pages in an APP are developed by multiple developers, the monitoring standards of each developer are not consistent, and each developer can only obtain the monitoring data of the H5 page developed by himself, therefore, when monitoring H5 pages, each developer of H5 can only monitor the H5 page developed by himself, thereby causing the problem of repeated monitoring of pages, resulting in low efficiency of monitoring pages.
[0004] In summary, the prior art webpage page monitoring scheme has the problem of low efficiency of monitoring pages due to repeated monitoring of pages. SUMMARY
[0005] The embodiments of the present application provide a webpage page monitoring method, device, equipment and storage medium, which are used to solve the problem of low efficiency of monitoring pages in the prior art webpage page monitoring scheme due to repeated monitoring of pages.
[0006] In a first aspect, the embodiments of the present application provide a webpage page monitoring method applied to a client, the method comprising:
[0007] obtaining a touch instruction and obtaining a pre-set script based on the touch instruction, wherein the touch instruction is an instruction generated by detecting a click operation of a user on a webpage page on a terminal device;
[0008] adding the script to a browser program in the client;
[0009] The script-based monitoring of the browser in the client obtains monitoring data.
[0010] The server is sent the monitoring data.
[0011] In one embodiment, the script-based monitoring of the browser in the client obtains monitoring data, including:
[0012] The script-based monitoring of the browser in the client obtains first performance data and first exception data of the browser.
[0013] The script-based monitoring of the browser in the client obtains second performance data and second exception data of a web page running on the browser.
[0014] The monitoring data includes the first performance data, the first exception data, the second performance data, and the second exception data.
[0015] In one embodiment, before the server is sent the monitoring data, the method further includes:
[0016] The format of the monitoring data is adjusted to obtain monitoring data of a unified format.
[0017] In a second aspect, an embodiment of the present application provides a method for monitoring a web page, applied to a server side, and the method includes:
[0018] The server receives monitoring data sent by a client, wherein the monitoring data is data obtained by a preset script monitoring a browser in the client.
[0019] The monitoring data is input into a data model for analysis and processing to obtain an analysis result, wherein the data model is a model for data analysis of the monitoring data, and is obtained by pre-training according to performance indexes and exception indexes of the browser.
[0020] In a third aspect, an embodiment of the present application provides a monitoring device for a web page, including:
[0021] A first obtaining module is configured to obtain a touch instruction and obtain a preset script based on the touch instruction, wherein the touch instruction is an instruction generated by detecting a click operation of a user on a web page on a terminal device.
[0022] An adding module is configured to add the script to a browser program in a client.
[0023] A second obtaining module is configured to obtain monitoring data by script-based monitoring of a browser in the client.
[0024] A sending module is configured to send the monitoring data to a server.
[0025] In a specific implementation, the second obtaining module comprises:
[0026] The first obtaining unit is configured to monitor a browser in the client based on the script, and obtain first performance data and first exception data of the browser.
[0027] The second obtaining unit is configured to monitor a web page running on the browser based on the script, and obtain second performance data and second exception data of the web page.
[0028] The monitoring data comprises the first performance data, the first exception data, the second performance data, and the second exception data.
[0029] In a fourth aspect, an embodiment of the present application provides a web page monitoring device, comprising:
[0030] The receiving module is configured to receive monitoring data sent by the client, wherein the monitoring data is obtained by monitoring the browser in the client by using the preset script.
[0031] The analysis module is configured to input the monitoring data into a data model for analysis and processing, and obtain an analysis result, wherein the data model is a model obtained by training the performance index and the exception index of the browser in advance, and is used for data analysis of the monitoring data.
[0032] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising:
[0033] The processor, the memory, and the interaction interface.
[0034] The memory is configured to store executable instructions of the processor.
[0035] The processor is configured to execute the executable instructions to perform the web page monitoring method of the first or second aspect.
[0036] In a sixth aspect, an embodiment of the present application provides a readable storage medium, which stores a computer program, and the computer program is executed by the processor to implement the web page monitoring method of the first or second aspect.
[0037] In a seventh aspect, an embodiment of the present application provides a computer program product, which comprises a computer program, and the computer program is executed by the processor to implement the web page monitoring method of the first or second aspect.
[0038] The method, device and equipment for monitoring a webpage page and the storage medium provided by the embodiment of the present application obtain a touch instruction, and obtain a pre-set script based on the touch instruction, wherein the touch instruction is an instruction generated by detecting a click operation of a user on a webpage page on a terminal device; the script is added to a browser program in a client; the browser in the client is monitored based on the script, monitoring data is obtained; and the monitoring data is sent to a server. By injecting the script into the browser program in the client, the browser in the client is enabled to increase the function of monitoring the performance and abnormality of the webpage page, so that the browser can monitor all running webpage pages, thereby avoiding the technical problem that the developers of each webpage page repeatedly monitor all webpage pages, and the technical effect of improving the efficiency of monitoring the webpage page is achieved. BRIEF DESCRIPTION OF DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0040] Figure 1 An application scenario diagram of the method for monitoring a webpage page provided by the embodiment of the present application;
[0041] Figure 2 A flowchart of the method for monitoring a webpage page provided by the embodiment of the present application;
[0042] Figure 3 A flowchart of the method for monitoring a webpage page provided by the embodiment of the present application;
[0043] Figure 4 A flowchart of the collection and reporting of performance data and abnormal data provided by the embodiment of the present application;
[0044] Figure 5 A structural diagram of the device for monitoring a webpage page provided by the embodiment of the present application;
[0045] Figure 6 A structural diagram of the device for monitoring a webpage page provided by the embodiment of the present application;
[0046] Figure 7 A structural diagram of an electronic device provided by the embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. All other embodiments made by those of ordinary skill in the art based on the teachings of the present embodiments belong to the scope of the present application.
[0048] The terms "first", "second", "third", "fourth" and the like in the description and claims of the present application and the above drawings, if any, are used to distinguish similar objects, and are not necessarily used to describe a particular sequential or chronological order. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0049] In view of the existing problems, the present application proposes a web page monitoring method. A script (JS script) code written in JavaScript programming language is injected into the browser (WebView, i.e. the built-in browser of the client) program of the client, so that the browser of the client can increase the function of monitoring the performance and exceptions of H5 pages, so that the browser of the client can accurately obtain the performance data and exception data of H5 pages, and then the performance data and exception data of the browser and the performance data and exception data of H5 pages obtained by the browser are all processed by the client to form a unified data format, which is convenient for subsequent optimization of web pages using these format unified data, so as to overcome the above problems that are prone to occur when monitoring web pages.
[0050] The inventor found that a JS script for monitoring the performance and exceptions of web pages can be written in advance, and then injected into the built-in browser of the client, so that the built-in browser of the client can increase the function of monitoring the performance and exceptions of web pages, and the format of the obtained monitoring data can be unified, so that the web pages can be monitored and optimized by the developers of the client, solving the problems in the prior art provided in the background. Based on the above inventive concept, the web page monitoring scheme in the present application is designed.
[0051] Firstly, the terms involved in the present application are explained.
[0052] WebView: the browser inside the application of IOS system and Android system, which can open web pages like the system browser.
[0053] JavaScript: a lightweight, interpreted or just-in-time compiled programming language with first-class functions.
[0054] Browser: an application used to retrieve, present, and traverse resources represented in the World Wide Web, including address bar, menu bar, tab, page window and status bar.
[0055] Figure 1 An application scenario diagram of the web page monitoring method provided by the embodiment of the present application is shown in Figure 1 As shown in the figure, in this scenario, three H5 pages are set in the client, and the pre-prepared JS script capable of monitoring the performance and abnormality of the H5 pages is injected into the browser of the client, the browser of the client can monitor the performance and abnormality of the browser, and can monitor the performance and abnormality of the three H5 pages through the injected JS script, so that the performance data and abnormality data of the H5 pages can be backflowed to the browser, so as to facilitate the browser to collect the performance data and abnormality data of the H5 pages and the performance data and abnormality data of the browser, after the browser obtains the performance data and abnormality data of the H5 pages and the browser (which can be collectively referred to as monitoring data), the monitoring data is distributed to the data archiving module in the client, the data archiving module classifies and reports the monitoring data, after the server end receives the monitoring data reported by the client, the monitoring data is stored, and the monitoring data is analyzed through the establishment of a data model, and the analysis result obtained finally can be used to build a front-end visualization system for monitoring the performance and abnormality of the web pages of the client in the future, and provide data support for guiding the optimization of the web pages.
[0056] Based on the scenario shown in Figure 1 In this scheme, the client is mainly used to monitor the browser abnormality occurred when the built-in browser runs the web page, and monitor the performance of the built-in browser when starting and running the web page, and monitor the performance and abnormality of the web page when running in the built-in browser through the JS script, and the client also classifies and arranges the monitoring data after obtaining the monitoring data, and unifies the format of the monitoring data; the server end is mainly used to store the monitoring data sent by the client, and establish a data model according to the performance index and monitoring index of the browser, and analyze the monitoring data through the data model.
[0057] In combination with the above scenario, the technical solution of the webpage page monitoring method provided by the present application is described in detail through several specific embodiments.
[0058] Figure 2 The flowchart of the webpage page monitoring method provided by the embodiment of the present application is shown in Figure 2 The webpage page monitoring method provided by the embodiment of the present application is applied to a client and includes the following steps.
[0059] S201: Obtain a touch instruction and obtain a pre-set script based on the touch instruction.
[0060] In this step, the touch instruction is an instruction generated by detecting a click operation of a user on a webpage page on a terminal device. When the user needs to open the webpage page, the user can select a corresponding client software on the terminal device and perform a click operation on the webpage page on the client software. After detecting the click operation, the client generates a touch instruction and then obtains a pre-set script based on the touch instruction.
[0061] In the above solution, the pre-set script is a code file for monitoring the performance and exceptions of the webpage page. After adding the script to the browser program, the script can monitor Ajax request exceptions by rewriting the XMLHttpRequest object, monitor JS business code exceptions and resource exceptions by listening to the global error event, monitor Promise business code exceptions by listening to the global unhandleRejection event, and monitor h5 page performance by obtaining the Performance performance-related application programming interface (API). In this way, the browser program can collect all the exception information and performance information through the script, and then send the collected information to the client through the script using the message channel.
[0062] S202: Add the script to the browser program in the client.
[0063] In this step, after obtaining the pre-set script, the script can be added to the browser program in the client. Since the pre-set script has the function of monitoring the performance and exceptions of the webpage page, after adding the script to the browser program, the browser of the client also has the function of monitoring the performance and exceptions of the webpage page of the client. In this way, the performance and exception conditions of all webpage pages of the client can be monitored in real time during the use of the webpage page by the user.
[0064] In the scheme, the developer of the client and the developer of the webpage page can not be the same, and the developer of each webpage page can also not be the same. When the user uses the webpage page, the developer of the client cannot view the use of the webpage page, and the developer of the webpage page can only see the use of the webpage page developed by himself. Therefore, the script that can monitor the performance and the exception of the webpage page and is set in advance can be injected into the browser of the client, and all webpage pages can be monitored directly through the browser of the client, so that the technical problem of repeated monitoring of the webpage page is avoided, and the technical effect of improving the efficiency of monitoring the webpage page is achieved.
[0065] S203: Based on the script, the browser in the client is monitored to obtain monitoring data.
[0066] In this step, after the script is added to the browser program of the client, the browser also has the function of monitoring the performance and the exception of the webpage page. Therefore, the webpage page running on the browser can be monitored directly through the browser to obtain the monitoring data of the performance and the exception of the webpage page and the browser.
[0067] In the scheme, since the webpage page is running on the browser, after the script is added to the browser program, the browser can monitor all webpage pages running on the browser. Therefore, even if the running webpage page has an exception, the browser can monitor the webpage page with the exception based on the script and collect the performance data and the exception data of the webpage page with the exception without omission, so that the technical problem of incomplete or inaccurate collection of exception data caused by the exception of the webpage page is avoided, and the technical effect of improving the completeness and the accuracy of the collected exception data is achieved.
[0068] S204: The monitoring data is sent to the server.
[0069] The webpage page monitoring method provided in the embodiment obtains a touch instruction, and obtains a script set in advance based on the touch instruction, wherein the touch instruction is an instruction generated by detecting a click operation of a user on a webpage page on a terminal device. The script is added to a browser program in a client. Based on the script, the browser in the client is monitored to obtain monitoring data. The monitoring data is sent to a server. By injecting the script into the browser program in the client, the browser in the client is enabled to have the function of monitoring the performance and the exception of the webpage page, so that the browser can monitor all running webpage pages, the problem of repeated monitoring of all webpage pages by the developer of each webpage page is avoided, the efficiency of monitoring the webpage page is improved, and the completeness and the accuracy of the collected exception data are also improved.
[0070] In one specific implementation, the method for monitoring the browser in the client based on the script, and obtaining the monitoring data, comprises: monitoring the browser in the client based on the script, and obtaining first performance data and first exception data of the browser; monitoring a web page running on the browser based on the script, and obtaining second performance data and second exception data of the web page; wherein the monitoring data comprises the first performance data, the first exception data, the second performance data and the second exception data.
[0071] In this scheme, since the web page is running on the browser, when the browser has an exception, the web page cannot run on the browser either. Therefore, in addition to monitoring the performance and exception of the web page, the performance and exception of the browser also need to be monitored, so that the monitoring data obtained includes not only the first performance data and the first exception data of the browser, but also the second performance data and the second exception data of the web page.
[0072] In the above scheme, the first performance data of the monitored browser refers to the performance data such as memory consumption and power consumption of the browser of the client when starting and running the web page; the first exception data of the monitored browser refers to the exception data of the exception behavior of the browser of the client when supporting the running of the web page; the second performance data of the monitored web page refers to the performance data such as the whole page time, user operable time and white screen time of the web page when running on the browser of the client; and the second exception data of the monitored web page refers to the exception data of the exception behavior such as network request exception, resource loading exception and js script loading exception of the web page when running on the browser of the client.
[0073] In one specific implementation, before sending the monitoring data to the server, the method further comprises: adjusting the format of the monitoring data to obtain the monitoring data with unified format.
[0074] In this scheme, the obtained monitoring data is very important data, and the analysis result obtained by the server analyzing the monitoring data can be used as a reference standard for subsequent optimization of the web page. Therefore, before sending the monitoring data to the server, the format of the monitoring data needs to be unified.
[0075] In other words, when monitoring browsers and web pages to obtain the browser's first performance data and first abnormal data, and the web page's second performance data and second abnormal data, the formats of these data may differ. For example, the first and second performance data may be in text format, while the first and second abnormal data may be in compressed binary format. If monitoring data with different formats is uploaded to the server, the server needs to store the monitoring data according to the format separately and then perform data analysis and processing on each separately. This undoubtedly increases the server's workload and is prone to errors in the analysis results due to the different monitoring data formats. Therefore, after obtaining the monitoring data, the client needs to unify the format of the monitoring data before uploading it to the server for processing. This can effectively improve the efficiency and accuracy of the server in processing monitoring data.
[0076] In one specific implementation, the script is written in the scripting language JavaScript.
[0077] In this solution, since JavaScript is an event-driven scripting language, it can respond to user input without going through a server. For example, when accessing a webpage, JavaScript can directly respond to events such as clicking, moving the mouse up and down, or moving the window. Therefore, a JavaScript script can be pre-set and then injected into the client's browser program. In this way, when the user uses the webpage, the performance and anomalies of the webpage can be monitored based on the user's actions.
[0078] Furthermore, since the JavaScript scripting language is not dependent on the operating system and only requires browser support, scripts written in JavaScript can be used on any machine with a browser that supports the JavaScript scripting language, thereby reducing the burden on the server.
[0079] Figure 3 The flowchart of Embodiment 2 of the webpage monitoring method provided by the present invention is as follows: Figure 3 As shown, the monitoring method for this webpage is applied on the server side and includes the following steps:
[0080] S301: Receives monitoring data sent by the client.
[0081] In this step, the monitoring data is obtained by the preset script monitoring the browser in the client, and the monitoring data includes the first performance data and the first exception data of the browser, and the second performance data and the second exception data of the webpage page.
[0082] S302: input the monitoring data into the data model for analysis and processing to obtain an analysis result.
[0083] In this step, after the server receives the monitoring data in a unified format sent by the client, the monitoring data can be stored first, and then a data model for data analysis of the monitoring data is established according to the performance index and the exception index of the browser, and the stored monitoring data is input into the data model for analysis and processing, so as to obtain an analysis result, which can be used as a reference standard for subsequent optimization of the webpage page.
[0084] In this scheme, the performance index and the exception index of the browser include the performance index and the exception index of the browser itself, and also include the performance index and the exception index of the webpage page.
[0085] The webpage page monitoring method provided in this embodiment receives the monitoring data obtained by the preset script monitoring the browser in the client and sent by the client, and inputs the monitoring data into the data model for analysis and processing to obtain an analysis result, so that the analysis result can be used as a data reference standard for subsequent establishment of a front-end visual system for monitoring the performance and the exception of the webpage page, and the analysis result can provide data support for subsequent guidance of optimization of the webpage page, thereby improving the efficiency of monitoring the webpage page.
[0086] Figure 4 The flowchart for collecting and reporting the performance data and the exception data provided in this embodiment is shown in FIG. 1. Figure 4 The specific implementation process of collecting and reporting the performance data and the exception data is as follows.
[0087] S401: a user opens a webpage page.
[0088] In this step, the user opens a client application APP through a terminal device, and operates a webpage page (H5 page) on the APP.
[0089] S402: read a JS script for monitoring the exception and the performance of the webpage page.
[0090] In this step, the prerequisite for reading the JS script is to respond to the operation of the user opening the webpage page.
[0091] S403: inject the JS script into a browser program of the APP.
[0092] In this step, the browser (built-in browser) of the APP does not originally have the function of monitoring the performance and exceptions of the web page, but the JS script can be used to monitor the web page exceptions and performance, so if it is necessary to monitor the performance and exceptions of the web page through the built-in browser, the JS script can be injected into the browser program of the APP, so that the built-in browser can have the function of monitoring the performance and exceptions of the web page.
[0093] S404: Collect the performance data and exception data of the web page.
[0094] In this step, the built-in browser injected with the JS script can monitor the performance and exceptions of the web page, so as to collect the performance data and exception data of the web page in the web page.
[0095] S405: The performance data and exception data of the web page are returned to the APP browser for collection.
[0096] In this step, after the browser collects the performance data and exception data of the web page, the web page needs to return the performance data and exception data of the web page to the APP built-in browser, so as to facilitate the collection of the APP built-in browser.
[0097] S406: Collect the performance data and exception data of the browser.
[0098] In this step, since the web page is running on the APP built-in browser, the performance data and exception data of the browser also need to be collected.
[0099] S407: Format the collected data and report to the server.
[0100] In this step, the collected performance data and exception data of the web page, and the performance data and exception data of the browser, the data formats of these data may be different, so the data formats of these data can be unified first, and then the data with unified format is reported to the server.
[0101] S408: Data storage.
[0102] In this step, after the server receives the data sent by the client, the data is stored, and then the data is analyzed by the pre-trained data model.
[0103] In the process of collecting and reporting performance data and abnormal data, after the user clicks to open a certain H5 page, the APP reads the JS script prepared in advance for monitoring the performance and abnormality of the H5 page, and injects the script into the built-in browser of the APP, automatically starts the function of monitoring the H5 page after the H5 page starts running, then collects the performance data and abnormal data of the H5 page, and returns them to the built-in browser of the APP, and collects the performance data and abnormal data of the built-in browser, and the built-in browser of the APP sends all the collected data to the APP data archiving module after sorting, formats the data uniformly, and reports to the server, and finally the server stores the reported data.
[0104] The monitoring method of the web page of the embodiment of the application can solve the problem of repeated development of abnormal and performance monitoring systems by developers of various web pages, and can formulate unified abnormal and performance standards for web pages, avoid the problem that the developers of the client and the developers of the web pages are different, the developers of each web page may also be different, and the standards for judging the performance indicators and abnormal indicators of the browser or the web page by each developer are also different, and can report all the abnormal and performance data of the web pages through the client, ensure that all the abnormal and performance data can be accurately and completely reported, facilitate the client to view the running performance and abnormal conditions of all the web pages, and finally improve the efficiency of monitoring the web pages.
[0105] In general, the technical solution provided by the application is an implementation technical method for ensuring the efficiency and accuracy of web page monitoring.
[0106] Figure 5 The structural schematic diagram of the monitoring device for the web page according to Embodiment One of the application is shown in Figure 5 As shown in the figure, the monitoring device 50 for the web page comprises:
[0107] The first acquisition module 51 is configured to receive a touch instruction and acquire a pre-set script based on the touch instruction, wherein the touch instruction is an instruction generated by detecting the clicking operation of the user on the web page of the terminal device;
[0108] The adding module 52 is configured to add the script to the browser program in the client;
[0109] The second acquisition module 53 is configured to monitor the browser in the client based on the script and acquire monitoring data;
[0110] The sending module 54 is configured to send the monitoring data to the server.
[0111] Optionally, the second obtaining module 53 comprises: a first obtaining unit, configured to obtain first performance data and first exception data of a browser in the client based on a script monitoring the browser; and a second obtaining unit, configured to obtain second performance data and second exception data of a web page running on the browser based on the script monitoring the web page.
[0112] Optionally, the apparatus further comprises an adjusting module, configured to adjust the format of the monitoring data to obtain monitoring data with unified format.
[0113] The web page monitoring apparatus provided in this embodiment is used to execute the technical solution of the client in any of the foregoing method embodiments, and has similar implementation principles and technical effects, which will not be described here again.
[0114] Figure 6 A structural diagram of a second embodiment of the web page monitoring apparatus provided in this embodiment is shown in FIG. 6. Figure 6 As shown in FIG. 6, the web page monitoring apparatus 60 comprises:
[0115] a receiving module 61, configured to receive monitoring data sent by a client, wherein the monitoring data is data obtained by a preset script monitoring a browser in the client;
[0116] an analyzing module 62, configured to input the monitoring data into a data model for analysis and processing to obtain an analysis result, wherein the data model is a model obtained by pre-training according to performance indexes and exception indexes of the browser, and is a model for data analysis of the monitoring data.
[0117] The web page monitoring apparatus provided in this embodiment is used to execute the technical solution of the server in any of the foregoing method embodiments, and has similar implementation principles and technical effects, which will not be described here again.
[0118] Figure 7 A structural diagram of an electronic device provided in this embodiment is shown in FIG. 7. Figure 7 As shown in FIG. 7, the electronic device 700 comprises:
[0119] a processor 711, a memory 712, and an interactive interface 713;
[0120] The memory 712 is configured to store executable instructions of the processor 711.
[0121] The processor 711 is configured to execute the technical solution of any of the execution subjects in the foregoing web page monitoring method by executing the executable instructions.
[0122] Optionally, the memory 712 can be independent or integrated with the processor 711.
[0123] Optionally, when the memory 712 is a device independent of the processor 711, the electronic device 700 can further include:
[0124] a bus for connecting the above-mentioned devices.
[0125] The electronic device is used to execute the technical solution of any execution subject provided by any of the preceding method embodiments, and the implementation principle and technical effects are similar to those in the preceding method embodiments, which will not be described here again.
[0126] The embodiment of the present application further provides a readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the webpage page monitoring method provided by any of the preceding embodiments.
[0127] The embodiment of the present application further provides a computer program product, which includes a computer program, and the computer program is executed by a processor to implement the webpage page monitoring method provided by any of the preceding method embodiments.
[0128] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The above-mentioned program can be stored in a computer readable storage medium. The program is executed to perform the steps of the above-mentioned method embodiments; and the above-mentioned storage medium includes ROM, RAM, magnetic disc or optical disc and various storage medium capable of storing program codes.
[0129] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the above-mentioned embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the above-mentioned embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method of monitoring a web page, characterized by, The method applied to a client comprises: obtaining a touch instruction and obtaining a preset script based on the touch instruction, wherein the touch instruction is an instruction generated by detecting a click operation of a user on a webpage on a terminal device; wherein the preset script is a code file for monitoring performance and exceptions of the webpage, the script monitors Ajax request exceptions by rewriting an XMLHttpRequest object, monitors JS business code exceptions and resource exceptions by listening to a global error event, monitors Promise business code exceptions by listening to a global unhandleRejection event, and monitors h5 page performance by obtaining a Performance performance-related application programming interface; adding the script to a browser program in the client; monitoring the browser in the client based on the script and obtaining monitoring data; sending the monitoring data to a server; the monitoring the browser in the client based on the script and obtaining the monitoring data comprises: monitoring the browser in the client based on the script and obtaining first performance data and first exception data of the browser; wherein the first performance data comprises memory and power consumed by the browser of the client when starting and running the webpage; and the first exception data comprises exception data of browser abnormal behaviors occurring when the browser of the client supports the webpage to run; monitoring the webpage running on the browser based on the script and obtaining second performance data and second exception data of the webpage; wherein the second performance data comprises whole-page time, user operable time, and white screen time of the webpage when running on the browser of the client; and the second exception data comprises network request exception, resource loading exception, and js script loading exception occurring when the webpage runs on the browser of the client. The monitoring data comprises the first performance data, the first exception data, the second performance data, and the second exception data.
2. The method of claim 1, wherein, Before the sending the monitoring data to the server, the method further comprises: adjusting a format of the monitoring data to obtain the monitoring data with a unified format.
3. A method of monitoring a web page, characterized by, The method applied to a server comprises: The monitoring data sent by the client is received, wherein the monitoring data is data obtained by monitoring the browser in the client by a preset script; the monitoring data includes first performance data, first exception data, second performance data, and second exception data; the first performance data includes memory and power consumed by the browser in the client when starting and running a webpage; the first exception data includes exception data of abnormal behavior of the browser when supporting the webpage to run; the second performance data includes whole-page time, user operable time, and white screen time of the webpage when running on the browser in the client; and the second exception data includes network request exception, resource loading exception, and js script loading exception when monitoring the webpage to run on the browser in the client; wherein the preset script is a code file for monitoring performance and exception of the webpage, the script monitors Ajax request exception by rewriting an XMLHttpRequest object, monitors JS business code exception and resource exception by listening to a global error event, monitors Promise business code exception by listening to a global unhandleRejection event, and monitors h5 page performance by obtaining a Performance performance-related application program interface. The monitoring data is input into a data model for analysis and processing to obtain an analysis result, wherein the data model is a model obtained by pre-training according to performance indexes and exception indexes of the browser, and the model is used for data analysis of the monitoring data.
4. A monitoring apparatus of a web page, characterized by comprising: The method comprises the following steps: a first obtaining module is configured to obtain a touch instruction and a preset script based on the touch instruction, wherein the touch instruction is an instruction generated by detecting a click operation of a user on a webpage in a terminal device; and the preset script is a code file for monitoring performance and exception of the webpage, the script monitors Ajax request exception by rewriting an XMLHttpRequest object, monitors JS business code exception and resource exception by listening to a global error event, monitors Promise business code exception by listening to a global unhandleRejection event, and monitors h5 page performance by obtaining a Performance performance-related application program interface; an adding module is configured to add the script to a browser program in a client; a second obtaining module is configured to monitor the browser in the client based on the script and obtain monitoring data; a sending module is configured to send the monitoring data to a server; and the second obtaining module comprises: The first obtaining unit is configured to monitor the browser in the client based on the script, and obtain first performance data and first exception data of the browser; the first performance data includes memory and power consumed by the browser in the client when starting up and running a web page; the first exception data includes exception data of abnormal browser behaviors occurring when the browser supports the web page to run; The second obtaining unit is configured to monitor the web page running on the browser based on the script, and obtain second performance data and second exception data of the web page; the second performance data includes whole-page time, user operable time and white screen time of the web page when running on the browser in the client; the second exception data includes network request exception, resource loading exception and js script loading exception occurring when the web page runs on the browser in the client. The monitoring data includes the first performance data, the first exception data, the second performance data and the second exception data.
5. A monitoring apparatus of a web page, characterized by comprising: The receiving module is configured to receive monitoring data sent by a client, wherein the monitoring data is obtained by monitoring a browser in the client by a preset script; the monitoring data includes first performance data, first exception data, second performance data and second exception data; the first performance data includes memory and power consumed by the browser in the client when starting up and running a web page; the first exception data includes exception data of abnormal browser behaviors occurring when the browser supports the web page to run; the second performance data includes whole-page time, user operable time and white screen time of the web page when running on the browser in the client; the second exception data includes network request exception, resource loading exception and js script loading exception occurring when the web page runs on the browser in the client; the preset script is a code file for monitoring performance and exceptions of the web page, and the script monitors Ajax request exception by rewriting an XMLHttpRequest object, monitors JS business code exception and resource exception by listening to a global error event, monitors Promise business code exception by listening to a global unhandleRejection event, and monitors h5 page performance by obtaining a Performance performance-related application program interface. The analysis module is configured to input the monitoring data into a data model for analysis and processing, and obtain an analysis result, wherein the data model is a model for data analysis of the monitoring data, which is obtained by pre-training according to performance indexes and exception indexes of the browser. The processor, the memory and the interaction interface are included.
6. An electronic device, comprising: The memory is configured to store executable instructions of the processor. The processor is configured to execute the executable instructions to perform the method for monitoring a web page according to any one of claims 1 to 3. 7. A readable storage medium, having stored thereon a computer program, characterized in that, The computer program is executed by a processor to implement the webpage page monitoring method in any one of claims 1 to 3.
8. A computer program product, characterised in that, The computer program is executed by a processor to implement the webpage page monitoring method in any one of claims 1 to 3.
Citation Information
Patent Citations
Data acquisition method, apparatus, computer equipment and system
CN109145182A
Method and system for monitoring real user experience at browser side in real time
CN113010371A