Webpage index generation method and device, electronic equipment and storage medium

By detecting webpage loading events and calculating the idle time of the main thread to generate webpage metrics, the problem of accurately measuring webpage performance in existing technologies is solved, thereby improving the accuracy of webpage optimization and user experience.

CN113849758BActive Publication Date: 2026-04-07BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-16
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately measure key performance indicators during webpage loading, impacting user experience and conversion rates.

Method used

By detecting webpage loading events, the system obtains the API loading completion time and the webpage loading completion time, calculates the target idle time period of the main thread, and generates webpage metrics to measure webpage performance.

Benefits of technology

It enables precise measurement of webpage performance, improving the accuracy of webpage optimization and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113849758B_ABST
    Figure CN113849758B_ABST
Patent Text Reader

Abstract

The present disclosure provides a webpage index generation method and device, electronic equipment and storage medium, relates to the field of computers, and in particular to the field of artificial intelligence technologies such as intelligent search. The specific implementation scheme is: in response to detecting a webpage loading event, loading a webpage corresponding to a target webpage address; obtaining a first time when an application programming interface (API) loading in the webpage is completed; obtaining a second time when the webpage loading is completed; obtaining a target idle time period of a main thread between the first time and the second time; and generating a webpage index corresponding to the webpage according to the target idle time period. Thus, the generated webpage index can more accurately measure the webpage performance, thereby making the webpage optimization more accurate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, specifically to the field of artificial intelligence technology such as intelligent search, and particularly to a method, apparatus, electronic device, and storage medium for generating web page metrics. Background Technology

[0002] Currently, webpage performance plays a crucial role in user satisfaction and retention, and can even affect conversion rates and business goals. Measuring webpage performance often relies on user-centric performance metrics. However, webpage loading is a process; there is no single "point in time" that can fully reflect webpage performance. Several key "points in time" can influence how users perceive a webpage as "fast" or "slow."

[0003] Among them, page loading speed and page response speed to user actions are important factors affecting page performance. Summary of the Invention

[0004] This disclosure provides a method, apparatus, device, and storage medium for generating web page metrics.

[0005] According to one aspect of this disclosure, a method for generating webpage metrics is provided, comprising:

[0006] In response to the detection of a webpage loading event, load the webpage corresponding to the target webpage address;

[0007] The first moment after the Application Programming Interface (API) of the webpage is loaded is obtained;

[0008] Obtain the second time when the webpage finishes loading;

[0009] Obtain the target idle time period of the main thread between the first time and the second time; and generate the webpage metrics corresponding to the webpage based on the target idle time period.

[0010] According to another aspect of this disclosure, a webpage metrics generation apparatus is provided, comprising:

[0011] The loading module is used to load the webpage corresponding to the target webpage address in response to the detection of a webpage loading event;

[0012] The first acquisition module is used to acquire the first moment when the application programming interface (API) in the webpage is loaded;

[0013] The second acquisition module is used to acquire the second time when the webpage finishes loading.

[0014] The third acquisition module is used to acquire the target idle time period of the main thread between the first time and the second time; and

[0015] The generation module is used to generate webpage metrics corresponding to the webpage based on the target idle time period.

[0016] According to another aspect of this disclosure, an electronic device is provided, comprising:

[0017] At least one processor; and

[0018] A memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores instructions that can be executed by the at least one processor, which, when executed, enable the at least one processor to perform the webpage metrics generation method described in one or another of the above embodiments.

[0020] According to another aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, on which a computer program is stored, the computer instructions being configured to cause the computer to perform the webpage index generation method described in one or more of the above embodiments.

[0021] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the webpage index generation method described in one or more of the above embodiments.

[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0023] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0024] Figure 1 This is a flowchart of a method for generating webpage metrics according to an embodiment of the present disclosure;

[0025] Figure 2 This is a schematic diagram of a webpage loading process according to an embodiment of the present disclosure;

[0026] Figure 3 This is a flowchart of a method for generating webpage metrics according to another embodiment of this disclosure;

[0027] Figure 4 This is a flowchart of a method for generating webpage metrics according to another embodiment of this disclosure;

[0028] Figure 5 This is a flowchart of a method for generating webpage metrics according to another embodiment of this disclosure;

[0029] Figure 6 This is a flowchart of a method for generating webpage metrics according to another embodiment of this disclosure;

[0030] Figure 7 This is a specific example diagram of a method for generating webpage metrics according to an embodiment of the present disclosure;

[0031] Figure 8 This is a block diagram of a webpage index generation apparatus according to an embodiment of the present disclosure; and

[0032] Figure 9 This is a block diagram of an electronic device used to implement the webpage index generation method of the embodiments of this disclosure. Detailed Implementation

[0033] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0034] The following description, with reference to the accompanying drawings, outlines a method, apparatus, electronic device, and storage medium for generating web page metrics according to embodiments of the present disclosure.

[0035] Intelligent search is a new generation of search engines that incorporates artificial intelligence technology. In addition to providing traditional functions such as fast retrieval and relevance ranking, it can also provide functions such as user role registration, automatic identification of user interests, semantic understanding of content, intelligent information filtering and push.

[0036] Artificial intelligence (AI) is the study of using computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies include computer vision, speech recognition, natural language processing, deep learning, big data processing, and knowledge graph technologies.

[0037] The webpage index generation method provided in this disclosure can be executed by an electronic device, such as a PC (Personal Computer), mobile phone, tablet computer, or server, etc., without any limitation.

[0038] In this embodiment of the disclosure, the electronic device may include a processing component, a storage component, and a driving component. Optionally, the driving component and the processing component may be integrated, the storage component may store an operating system, application programs, or other program modules, and the processing component implements the webpage indicator generation method provided in this embodiment of the disclosure by executing the application programs stored in the storage component.

[0039] Figure 1 This is a flowchart illustrating a method for generating web page metrics according to an embodiment of the present disclosure.

[0040] The webpage metric generation method of this disclosure embodiment can also be executed by the webpage metric generation device provided in this disclosure embodiment. The device can be configured in an electronic device to load the webpage corresponding to the target webpage address in response to the detection of a webpage loading event, and obtain the first time when the application programming interface (API) of the webpage is loaded and the second time when the webpage is loaded. Then, the target idle time period of the main thread is obtained between the first time and the second time, and the webpage metric corresponding to the webpage is generated according to the target idle time period. This allows for a more accurate measurement of webpage performance and makes webpage optimization more precise.

[0041] As one possible scenario, the webpage indicator generation method of this disclosure embodiment can also be executed on the server side, which can be a cloud server, and the webpage indicator generation method can be executed on the cloud server.

[0042] like Figure 1 As shown, the method for generating this webpage metric may include:

[0043] Step 101: In response to the detection of a webpage loading event, load the webpage corresponding to the target webpage address. The target webpage address can be a webpage address based on an HTTP (Hypertext Transfer Protocol) channel.

[0044] It should be noted that the webpage described in this embodiment can be a webpage loaded through a browser. The user (relevant personnel) can input (write) the target webpage address into the browser's address bar through an electronic device, so that the browser loads the webpage corresponding to the target webpage address.

[0045] In this embodiment of the disclosure, the electronic device can detect in real time whether a webpage loading event is triggered through a relevant API (Application Programming Interface), so that the electronic device can respond to the webpage loading event in a timely manner when it detects the webpage loading event.

[0046] Specifically, when an electronic device detects a webpage loading event through a relevant API, it can respond to the webpage loading event and load the webpage corresponding to the target webpage address.

[0047] As another possibility, users can also enter the target webpage address by clicking on a webpage link in the browser interface.

[0048] Step 102: Obtain the first moment when the Application Programming Interface (API) on the webpage finishes loading.

[0049] In this disclosure embodiment, see Figure 2 During the loading of the webpage corresponding to the aforementioned target webpage address, the webpage will go through a white screen, partial rendering, and finally complete loading and become interactive. During this process, the main document index.html can be loaded first. After the DOM (Document Object Model) nodes in the main document are ready, the DOMContentLoaded event (Document Object Model has been loaded) will be triggered. At this time, there may only be one DOM root element on the page, corresponding to the first vertical line in the waterfall layout. Figure 2 The first vertical line from left to right in the middle of the document (the onload event) can be triggered when all linked resources in the main document have finished loading, corresponding to the second vertical line in the waterfall layout. Figure 2 The second vertical line from left to right in the middle of the page indicates the start of the page rendering process. Then, the main JavaScript (scripting language) frame executes, triggering the loading of other resources such as interfaces, scripts, images, and styles, until all resources are loaded and the page is rendered. At this point, the user can interact with the page; for example, clicking a link will redirect the user.

[0050] In this embodiment, the moment when the application programming interface (API) of a webpage completes loading can be obtained through a data acquisition SDK (Software Development Kit). It should be noted that the data acquisition SDK described in this embodiment can be pre-installed in the browser and initialized when the browser begins loading the webpage.

[0051] Specifically, during the loading process of the aforementioned webpage, the electronic device can obtain the first moment when the application programming interface (API) of the webpage is loaded through the functions provided by the aforementioned data acquisition SDK.

[0052] It should be noted that the first time described in this embodiment can be the time after all the application programming interface (API) on the aforementioned webpage has been loaded.

[0053] Step 103: Obtain the second time after the webpage finishes loading.

[0054] In this embodiment of the disclosure, when all other types of resources, such as application programming interfaces (APIs), scripts, images, videos, and styles, have been loaded, that is, when all types of resources, such as XHR (XMLHttpRequest object, i.e., API interface), Script, IMG (image), and Stylesheet, have been loaded, the webpage loading process is complete, i.e., the webpage loading is complete.

[0055] Specifically, when the aforementioned webpage finishes loading, the electronic device can obtain the second time that the webpage has finished loading through the functions provided by the aforementioned data collection SDK.

[0056] Step 104: Obtain the target idle time period of the main thread between the first time and the second time. It should be noted that the main thread described in this embodiment can be the main thread of JS in the above-mentioned webpage, and the target idle time period described in this embodiment can be the first fixed time period without long tasks found between the first time and the second time (e.g., 500ms).

[0057] Specifically, after acquiring the first and second times mentioned above, the electronic device can obtain the target idle time period of the main thread from between the first and second times according to a preset acquisition strategy. The preset acquisition strategy can be calibrated according to actual conditions.

[0058] As a possible scenario, the electronic device can also obtain the target idle time period of the main thread from the first time and the second time mentioned above through the functions provided by the aforementioned acquisition SDK.

[0059] Step 105: Generate webpage metrics corresponding to the target idle time period.

[0060] It should be noted that the webpage metric described in this embodiment may be the Time To Interactive (TTI) metric. TTI can be a non-standardized Web (World Wide Web) performance metric that describes when a page or application contains useful content and when the main thread is idle and free to respond to user interactions.

[0061] In this embodiment of the disclosure, webpage metrics corresponding to a webpage can be generated according to a preset generation algorithm and a target idle time period. The preset generation algorithm can be calibrated according to actual conditions.

[0062] Specifically, after obtaining the target idle time period, the electronic device can generate webpage metrics (e.g., interactive time metrics) corresponding to the webpage based on a preset generation algorithm and the target idle time period.

[0063] As a possible scenario, electronic devices can also utilize the functions provided by the aforementioned data collection SDK to generate webpage metrics corresponding to the target idle time period.

[0064] In this embodiment, in response to the detection of a webpage loading event, the webpage corresponding to the target webpage address is first loaded, and the first time when the application programming interface (API) of the webpage completes loading and the second time when the webpage completes loading are obtained. Then, the target idle time period of the main thread is obtained between the first and second times, and finally, webpage metrics corresponding to the webpage are generated based on the target idle time period. Therefore, the generated webpage metrics can more accurately measure webpage performance, thereby making webpage optimization more precise.

[0065] To clearly illustrate the previous embodiment, in one embodiment of this disclosure, the method for generating the webpage indicator may further include determining that a webpage loading event has been detected if a webpage loading request sent by a user is received, wherein the webpage loading request includes a target webpage address.

[0066] In this embodiment of the disclosure, a user can create a page loading request using the functions provided by the browser's address bar (e.g., entering the target webpage address into the browser's address bar and triggering the loading function), and send the page loading request to the browser. When the electronic device receives the webpage loading request through the browser, it can determine that a webpage loading event has been detected. This enables timely response to the user's webpage loading request, improving the user experience.

[0067] Specifically, users can enter the target webpage address in the browser's address bar and trigger access. At this time, the electronic device can receive the webpage loading request through the browser and determine that the webpage loading event has been detected.

[0068] As another possibility, users can also access the target webpage by clicking a link in the browser interface. When the user clicks the link, the electronic device can receive the webpage loading request through the browser and determine that a webpage loading event has been detected.

[0069] Furthermore, in one embodiment of this disclosure, there may be multiple APIs, such as... Figure 3 As shown, obtaining the first moment when the Application Programming Interface (API) on a webpage finishes loading can include:

[0070] Step 301: Obtain the API loading time queue, which includes the loading completion time of each API among multiple APIs.

[0071] In this embodiment of the disclosure, during the API loading process, the aforementioned data collection SDK can sequentially obtain the loading completion time of each API that has been loaded, establish a correlation between the API and its corresponding loading completion time, and store this correlation in a queue. Based on this, an API loading time queue can be generated after all APIs have been loaded. The APIs and their corresponding loading completion times in this API loading time queue can be arranged according to the order in which they were loaded.

[0072] It should be noted that the API loading time queue described in this embodiment can be stored in the browser for easy retrieval and use.

[0073] Step 302: Obtain the API loading completion time corresponding to the tail of the API loading time queue, and use the API loading completion time as the first time.

[0074] Specifically, during the loading process of the aforementioned webpage, the electronic device can detect in real time whether an API loading time queue has been generated in the browser. When it is determined that an API loading time queue has been generated in the browser, the device can obtain the API loading time queue and the API loading completion time corresponding to the tail of the API loading time queue, and use the API loading completion time as the first time.

[0075] It should be noted that the API loading completion time described in this embodiment may refer to the loading end time in the API loading start and end time.

[0076] This allows for accurate determination of the first moment, providing a basis for generating webpage metrics.

[0077] In one embodiment of this disclosure, such as Figure 4 As shown, obtaining the second time after a webpage completes loading can include:

[0078] Step 401: If the webpage has not loaded data within the preset time period, obtain the current time. The preset time period can be specified according to actual conditions and needs; for example, it can be 300ms, 400ms, or 500ms, etc., without any limitations here.

[0079] Step 402: Use the current time as the second time.

[0080] Specifically, during the loading process of the aforementioned webpage, the electronic device can detect in real time whether the webpage has not loaded data within a preset time period. When it is detected that the webpage has not loaded data within the preset time period, it indicates that the webpage has been loaded. At this time, the electronic device can obtain the current time and use the current time as the second time.

[0081] Therefore, the second time can be accurately determined, providing a basis for the generation of webpage metrics.

[0082] In one embodiment of this disclosure, such as Figure 5 As shown, obtaining the target idle time period of the main thread between the first time and the second time can include:

[0083] Step 501: Obtain the idle time period of the main thread during the webpage loading process from the first time period and the second time period to generate an idle time period set.

[0084] In this embodiment of the disclosure, between the first time and the second time, there may be one or more Longtasks in the main thread, and a specific period without long tasks between the first time and the second time (e.g., a 500ms period without long tasks) can be used as an idle time period.

[0085] Tasks that take longer than 50ms can be classified as long tasks.

[0086] Specifically, after acquiring the first time and the second time, the electronic device can obtain the idle time period between the first time and the second time through the acquisition SDK and generate an idle time period set.

[0087] It should be noted that the specific period described in this embodiment can be calibrated according to actual conditions and needs, and no limitation is made here.

[0088] Step 502: Concentrate the idle time periods that are close to the first time period and use them as the target idle time periods.

[0089] Specifically, after obtaining the aforementioned set of idle time periods, the electronic device can use the idle time periods in the set that are close to the first time as the target idle time period, that is, the first specific period without long tasks (e.g., 500ms) found between the first time and the second time as the target idle time period.

[0090] Therefore, it is possible to accurately determine the target idle time period, providing a basis for the generation of web page metrics, and avoiding the problem of using the idle main thread during the page rendering process, before all API interface resources are loaded, as the interactive time (i.e., web page metrics) too early.

[0091] Furthermore, in one embodiment of this disclosure, such as Figure 6 As shown, obtaining the target idle time period of the main thread between the first time and the second time may also include:

[0092] Step 601: If the idle time period set is empty, then obtain the third time when the page jumps or the page is closed.

[0093] In this embodiment of the disclosure, after the webpage has finished loading, the user can close the loaded page using an electronic device, or operate the browser using an electronic device to redirect the page, for example, by clicking a redirect link on the page, or by entering a new address in the browser's address bar and triggering the loading function.

[0094] Specifically, after obtaining the aforementioned set of idle time periods, the electronic device can determine whether the set of idle time periods is empty through the relevant API. If it is, it can obtain the third time when the page jumps or the page is closed, that is, the current time when the page jumps or the page is closed.

[0095] Step 602: Retrieve the idle time period of the main thread during the webpage loading process from the first time and the third time to regenerate the idle time period set.

[0096] Specifically, after obtaining the aforementioned third time, the electronic device can use the aforementioned acquisition SDK to re-obtain the idle time period of the main thread during the webpage loading process between the first and third times, so as to regenerate the idle time period set.

[0097] This establishes a fallback mechanism for generating webpage metrics, thereby improving the recall rate of webpage metrics.

[0098] In one embodiment of this disclosure, generating webpage metrics corresponding to a webpage based on a target idle time period may include obtaining the start time of the target idle time period and using the start time as the webpage metrics.

[0099] Specifically, after obtaining the target idle time period, the electronic device can use the aforementioned data collection SDK to obtain the start time of the target idle time period and use this start time as a webpage metric. This allows for the generation of a reasonable webpage metric, making the measurement of webpage performance more accurate and enabling better webpage optimization.

[0100] To enable those skilled in the art to more clearly understand the method for generating webpage metrics according to the embodiments of this disclosure, see [link to relevant documentation]. Figure 7 When accessing a target webpage address, the SDK (e.g., a data collection SDK) can be initialized first. After the SDK is initialized, the loading time of the XHR interface (API interface) resource can be found ①, and the loading time of all types of resources (XHR, Script, IMG, Stylesheet) can be found ②. Finally, the first 500ms period of No Longtask can be found between ① and ②, and the starting point of this period can be used as the webpage indicator ③. If no 500ms period of No Longtask can be found between ① and ②, the time when the page redirects or closes can be found ④, and the first 500ms period of No Longtask can be found between ① and ④, and the starting point of this period can be used as the webpage indicator.

[0101] According to the webpage metric generation method of this disclosure, in response to the detection of a webpage loading event, the webpage corresponding to the target webpage address is loaded, and the first time when the application programming interface (API) of the webpage is loaded and the second time when the webpage is loaded are obtained. Then, the target idle time period of the main thread is obtained between the first time and the second time, and finally, the webpage metric corresponding to the webpage is generated based on the target idle time period. Therefore, the generated webpage metric can more accurately measure webpage performance, thereby making webpage optimization more precise.

[0102] Figure 8 This is a schematic diagram of a webpage index generation device provided in an embodiment of the present disclosure.

[0103] The webpage metrics generation device of this disclosure embodiment can be configured in an electronic device to load the webpage corresponding to the target webpage address in response to the detection of a webpage loading event, and obtain the first time when the application programming interface (API) of the webpage is loaded and the second time when the webpage is loaded. Then, the target idle time period of the main thread is obtained between the first time and the second time, and the webpage metrics corresponding to the webpage are generated based on the target idle time period. This enables more accurate measurement of webpage performance and makes webpage optimization more precise.

[0104] like Figure 8As shown, the webpage indicator generation device 800 may include: a loading module 810, a first acquisition module 820, a second acquisition module 830, a third acquisition module 840, and a generation module 850.

[0105] The loading module 810 is used to load the webpage corresponding to the target webpage address in response to the detection of a webpage loading event. The target webpage address can be a webpage address based on an HTTP channel.

[0106] It should be noted that the webpage described in this embodiment can be a webpage loaded through a browser. The user (relevant personnel) can input (write) the target webpage address into the browser's address bar through the loading module 810 so that the browser can load the webpage corresponding to the target webpage address.

[0107] In this embodiment of the disclosure, the loading module 810 can detect in real time whether a webpage loading event is triggered through a relevant API, so that when the loading module 810 detects a webpage loading event, it can respond to the webpage loading event in a timely manner.

[0108] Specifically, when the loading module 810 detects a webpage loading event through the relevant API, it can respond to the webpage loading event and load the webpage corresponding to the target webpage address.

[0109] As another possibility, users can also enter the target webpage address by clicking on a webpage link in the browser interface.

[0110] The first acquisition module 820 is used to acquire the first moment when the application programming interface (API) in the webpage is loaded.

[0111] In this disclosure embodiment, see Figure 2 During the loading of the webpage corresponding to the aforementioned target webpage address, the webpage will go through a white screen, partial rendering, and finally complete loading and become interactive. During this process, the main document index.html can be loaded first. After the DOM nodes in the main document are ready, the DOMContentLoaded (Document Object Model has been loaded) event will be triggered. At this time, there may only be one DOM root element on the page, corresponding to the first vertical line in the waterfall layout. Figure 2 The first vertical line from left to right in the middle of the document (the onload event) can be triggered when all linked resources in the main document have finished loading, corresponding to the second vertical line in the waterfall layout. Figure 2 The second vertical line from left to right in the middle of the page indicates the start of the page rendering process. Then, the main JavaScript framework can execute, triggering the loading of other types of resources such as APIs, scripts, images, and styles, until all resources are loaded and the page is rendered. At this point, the user can interact with the webpage; for example, clicking a link on the webpage will redirect the user.

[0112] In this embodiment, the first acquisition module 820 can obtain the first moment when the application programming interface (API) of a webpage completes loading via the acquisition SDK. It should be noted that the acquisition SDK described in this embodiment can be pre-installed in the browser and initialized when the browser begins loading the webpage.

[0113] Specifically, during the loading process of the aforementioned webpage, the first acquisition module 820 can obtain the first moment when the application programming interface (API) of the webpage is loaded through the functions provided by the aforementioned acquisition SDK.

[0114] It should be noted that the first time described in this embodiment can be the time after all the application programming interface (API) on the aforementioned webpage has been loaded.

[0115] The second acquisition module 830 is used to acquire the second time when the webpage finishes loading.

[0116] In this embodiment of the disclosure, when all other types of resources, such as application programming interfaces (APIs), scripts, images, videos, and styles, have been loaded, that is, when all types of resources, such as XHR (XMLHttpRequest object, i.e., API interface), Script, IMG (image), and Stylesheet, have been loaded, the webpage loading process is complete, i.e., the webpage loading is complete.

[0117] Specifically, when the webpage finishes loading, the second acquisition module 830 can obtain the second time when the webpage finishes loading through the functions provided by the acquisition SDK.

[0118] The third acquisition module 840 is used to acquire the target idle time period of the main thread from the first time and the second time. It should be noted that the main thread described in this embodiment can be the main thread of JS in the above-mentioned webpage, and the target idle time period described in this embodiment can be the first fixed time period without long tasks found between the first time and the second time (e.g., 500ms).

[0119] Specifically, after the second acquisition module 830 acquires the aforementioned second time, the third acquisition module 840 can acquire the target idle time period of the main thread from between the first and second times according to a preset acquisition strategy. The preset acquisition strategy can be customized based on actual circumstances.

[0120] As a possible scenario, the third acquisition module 840 can also acquire the target idle time period of the main thread from the first time and the second time mentioned above through the functions provided by the acquisition SDK.

[0121] The generation module 850 is used to generate webpage metrics corresponding to the target idle time period.

[0122] In this embodiment of the disclosure, the generation module 850 can generate webpage metrics corresponding to the webpage according to a preset generation algorithm and a target idle time period. The preset generation algorithm can be calibrated according to actual conditions.

[0123] Specifically, after the third acquisition module 840 acquires the target idle time period, the generation module 850 can generate webpage metrics corresponding to the webpage according to the preset generation algorithm and the target idle time period.

[0124] As a possible scenario, the generation module 850 can also generate webpage metrics corresponding to the webpage based on the target idle time period using the functions provided by the aforementioned collection SDK.

[0125] In this embodiment, the loading module responds to the detection of a webpage loading event by loading the webpage corresponding to the target webpage address. The first acquisition module obtains the first time when the application programming interface (API) of the webpage is loaded, and the second acquisition module obtains the second time when the webpage is loaded. Then, the third acquisition module obtains the target idle time period of the main thread between the first and second times. The generation module generates webpage metrics corresponding to the webpage based on the target idle time period, thereby enabling more accurate measurement of webpage performance and making webpage optimization more precise.

[0126] In one embodiment of this disclosure, such as Figure 8 As shown, the webpage indicator generation device 800 may further include: a determination module 860, configured to determine that a webpage loading event has been detected if a webpage loading request sent by a user is received, wherein the webpage loading request includes a target webpage address.

[0127] In one embodiment of this disclosure, there are multiple APIs. The first acquisition module 820 is specifically used to: acquire an API loading time queue, wherein the API loading time queue includes the loading completion time corresponding to each API among the multiple APIs; acquire the API loading completion time corresponding to the tail of the API loading time queue, and use the API loading completion time as the first time.

[0128] In one embodiment of this disclosure, the second acquisition module 830 is specifically used to: if the webpage has not loaded data within a preset time period, acquire the current time; and use the current time as the second time.

[0129] In one embodiment of this disclosure, the third acquisition module 840 is specifically used to: acquire the idle time period of the main thread during the webpage loading process from between the first time and the second time, so as to generate an idle time period set; and take the idle time period in the idle time period set that is close to the first time as the target idle time period.

[0130] In one embodiment of this disclosure, the generation module 850 is specifically used to: obtain the start time of the target idle time period and use the start time as a webpage indicator.

[0131] In one embodiment of this disclosure, the third acquisition module 840 is further configured to: if the idle time period set is empty, acquire the third time when the page jumps or the page is closed; and reacquire the idle time period of the main thread during the webpage loading process from between the first time and the third time, so as to regenerate the idle time period set.

[0132] It should be noted that the foregoing explanation of the method embodiment for generating web page metrics also applies to the web page metric generation apparatus of this embodiment, and will not be repeated here.

[0133] The webpage metric generation apparatus of this embodiment responds to a detected webpage loading event by loading a webpage corresponding to a target webpage address via a loading module. It then acquires the first time the application programming interface (API) of the webpage completes loading via a first acquisition module and the second time the webpage completes loading via a second acquisition module. A third acquisition module then acquires the target idle time period of the main thread between the first and second times. Finally, a generation module generates webpage metrics corresponding to the webpage based on the target idle time period. Therefore, the generated webpage metrics can more accurately measure webpage performance, leading to more precise webpage optimization.

[0134] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0135] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0136] Figure 9A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0137] like Figure 9 As shown, device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 902 or a computer program loaded from storage unit 908 into random access memory (RAM) 903. RAM 903 may also store various programs and data required for the operation of device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904.

[0138] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0139] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as the method for generating web page metrics. For example, in some embodiments, the method for generating web page metrics may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of the method for generating web page metrics described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the method for generating web page metrics by any other suitable means (e.g., by means of firmware).

[0140] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0141] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0142] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0143] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0144] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.

[0145] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.

[0146] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0147] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for generating webpage metrics, comprising: In response to the detection of a webpage loading event, load the webpage corresponding to the target webpage address; Get the first moment when the application programming interface (API) of the webpage finishes loading; Obtain the second time when the webpage finishes loading; From the first time and the second time, obtain the idle time period of the main thread during the webpage loading process to generate an idle time period set; The idle time periods are concentrated into the idle time periods that are close to the first time period, and these are taken as the target idle time periods; as well as Generate webpage metrics corresponding to the webpage based on the target idle time period, wherein the webpage metrics include interactive time metrics. The target idle time period includes the first specific period between the first time and the second time when there are no long tasks, and the long tasks include tasks longer than 50ms.

2. The method according to claim 1, further comprising: If a webpage loading request is received from a user, it is determined that the webpage loading event has been detected, wherein the webpage loading request includes the target webpage address.

3. The method according to claim 1, wherein, The APIs are multiple, and obtaining the first moment when the application programming interface API in the webpage is loaded includes: Obtain the API loading time queue, wherein the API loading time queue includes the loading completion time corresponding to each of the multiple APIs; Obtain the API loading completion time corresponding to the tail of the API loading time queue, and use the API loading completion time as the first time.

4. The method according to claim 1, wherein, The step of obtaining the second time when the webpage has finished loading includes: If the webpage has not loaded data within the preset time period, then obtain the current time; The current time is taken as the second time.

5. The method according to claim 1, wherein, The step of generating webpage metrics corresponding to the webpage based on the target idle time period includes: Obtain the start time of the target idle time period and use the start time as the webpage metric.

6. The method according to claim 1, wherein, The step of obtaining the target idle time period of the main thread between the first time and the second time further includes: If the set of idle time periods is empty, then obtain the third time when the page jumps or the page is closed; Between the first time and the third time, the idle time period of the main thread during the webpage loading process is retrieved again to regenerate the idle time period set.

7. A webpage metrics generation apparatus, comprising: The loading module is used to load the webpage corresponding to the target webpage address in response to the detection of a webpage loading event; The first acquisition module is used to acquire the first moment when the application programming interface (API) in the webpage is loaded; The second acquisition module is used to acquire the second time when the webpage finishes loading. The third acquisition module is specifically used to acquire the idle time period of the main thread during the webpage loading process from the first time and the second time, so as to generate an idle time period set; The idle time periods are concentrated into the idle time periods that are close to the first time period, and these are taken as the target idle time periods; as well as The generation module is used to generate web page metrics corresponding to the web page based on the target idle time period, and the web page metrics include interactive time metrics. The target idle time period includes the first specific period between the first time and the second time when there are no long tasks, and the long tasks include tasks longer than 50ms.

8. The apparatus according to claim 7, further comprising: The determination module is configured to determine that a webpage loading event has been detected if a webpage loading request sent by a user is received, wherein the webpage loading request includes the target webpage address.

9. The apparatus according to claim 7, wherein, There are multiple APIs, and the first acquisition module is specifically used for: Obtain the API loading time queue, wherein the API loading time queue includes the loading completion time corresponding to each of the multiple APIs; Obtain the API loading completion time corresponding to the tail of the API loading time queue, and use the API loading completion time as the first time.

10. The apparatus according to claim 7, wherein, The second acquisition module is specifically used for: If the webpage has not loaded data within the preset time period, then obtain the current time; The current time is taken as the second time.

11. The apparatus according to claim 7, wherein, The generation module is specifically used for: Obtain the start time of the target idle time period and use the start time as the webpage metric.

12. The apparatus according to claim 7, wherein, The third acquisition module is also used for: If the set of idle time periods is empty, then obtain the third time when the page jumps or the page is closed; Between the first time and the third time, the idle time period of the main thread during the webpage loading process is retrieved again to regenerate the idle time period set.

13. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the webpage metric generation method according to any one of claims 1-6.

14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method for generating webpage metrics according to any one of claims 1-6.

15. A computer program product comprising a computer program that, when executed by a processor, implements the steps of the method for generating web page metrics according to any one of claims 1-6.

Citation Information

Patent Citations

  • Webpage performance evaluation method and device, server and storage medium

    CN110737591A