First screen time reporting method and device, computer equipment and storage medium
By using the target monitoring script to obtain and screening elemental node changes in the target application, determine the first screen time of the target element text node, and match the time resource list to obtain the first screen loading status information, solving the first screen time collection in the existing technology, Methods single and inaccurate problems have achieved more accurate and intuitive first screen loading status monitoring and reporting.
Patent Information
- Application Number
- CN202411584694.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-01-28
AI Technical Summary
The method for collecting first-screen time in the prior art is relatively single and inaccurate enough, which affects the real-time monitoring of user-side performance and loading speed.
By providing target monitoring scripts to target applications, obtaining the first screen information, including elemental node changes, screening element text nodes, generating element text nodes list, determining the target element text node, and obtaining its first screen time. The screen loads status information and reports to the server.
It improves the calculation accuracy of the first screen time and the accuracy of the report, and can clearly and intuitively understand the status of the first screen loading process, thereby improving the quality of network service.
Smart Images

Figure CN119377055A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet application technology, and in particular to a first screen time reporting method, device, computer equipment and storage medium. Background Art
[0002] As business grows rapidly, the channels for Internet products to obtain traffic are becoming more and more diverse. One backend is connected to multiple frontends such as IOS, Android, official accounts, mobile Web, and even mini-programs. Real-time data such as page views, real-time traffic, and user browsing behavior are crucial to service decisions.
[0003] The loading speed and performance of front-end applications affect the actual user experience and business conversion, and have become one of the important indicators of user experience. It is necessary to collect and monitor the performance and loading speed of the user end in real time. In the existing technology, the collection of first screen time is mainly achieved by monitoring the loading time of elements in the page through the application monitoring module. The method is relatively simple, and the first screen time collected by this solution is not accurate enough. Summary of the invention
[0004] Based on this, it is necessary to provide a first screen time reporting method, device, computer equipment and storage medium that can improve the quality of network services in response to the above technical problems.
[0005] In order to solve the above technical problems, in the first aspect, a method for reporting the first screen time is provided, and the method includes:
[0006] Provide a target monitoring script to the target application to obtain the first screen information through the target monitoring script, and the first screen information includes element node change information;
[0007] Filter element text nodes based on element node change information, and generate an element text node list based on the element text nodes;
[0008] Determine the target element text node based on the preset method and the element text node and obtain the first screen time corresponding to the target element text node;
[0009] Get the time resource list, match the element text node list and the time resource list, get the first screen loading status information, and report the first screen information, element node change information and first screen loading status information to the server.
[0010] In one embodiment, obtaining the home screen information through the target monitoring script includes:
[0011] Based on the target monitoring script, the page hiding, page interaction, routing status, target monitor and target storage of the target page are monitored to obtain the corresponding page hiding information, page interaction information, page routing information, element node information and target storage information.
[0012] In one embodiment, filtering element text nodes based on element node change information includes:
[0013] Obtain element node change information, and extract element nodes and node attributes corresponding to the element nodes from the element node change information;
[0014] Classify element nodes according to their corresponding node attributes;
[0015] Get the target node attribute type, and use the element node of the target node attribute type as the element text node to be selected;
[0016] Get the position information of the text node of the element to be selected;
[0017] Based on the position information of the element text node to be selected, determining whether the position of the element text node to be selected is within a preset loading range;
[0018] The element text node to be selected whose position is within a preset loading range is used as the element text node.
[0019] In one embodiment, determining a target element text node based on a preset method and an element text node and obtaining a first screen time corresponding to the target element text node includes:
[0020] Obtain the text type and display position information corresponding to the element text node;
[0021] Dividing the element text node into a plurality of element areas according to the text type and display position information corresponding to the element text node;
[0022] Obtaining a loading order for each element region, and determining a target element region according to the loading order for each element region;
[0023] The loading time of the first element text node loaded and the loading time of the target element area are obtained, and the first screen time corresponding to the target element text node is determined according to the loading time of the first element text node loaded and the loading time of the target element area.
[0024] In one embodiment, the method further comprises:
[0025] In response to the user entering the target page, obtaining the interaction time corresponding to the target page;
[0026] In response to obtaining the interaction duration corresponding to the target page, determining whether a preset reporting time can be obtained;
[0027] In response to obtaining the preset reporting time, determining whether the interaction duration corresponding to the target page exceeds the preset reporting time;
[0028] If the interaction time corresponding to the target page exceeds the preset reporting time, start the timer, calculate the first screen time corresponding to the target page and report it;
[0029] In response to not obtaining the preset reporting time, a default time is set. When the interaction time corresponding to the target page exceeds the preset default time, the timer is started to calculate the first screen time corresponding to the target page and report it.
[0030] In one embodiment, obtaining a time resource list, matching the element text node list and the time resource list, and obtaining the first screen loading status information includes:
[0031] Obtain a time resource list, the time resource list includes each element node label of the target page, each element node label of the target page includes a loading address and loading duration of each element node of the target page;
[0032] Obtaining an element text node list, the element text node list includes each element text node label of the target page, each element text node label of the target page includes a loading address, loading duration, and a loaded element node list of each element text node of the target page;
[0033] Match each element node tag of the target page and each element text node tag of the target page to obtain the first screen loading status information.
[0034] In one embodiment, the method further comprises:
[0035] In response to monitoring the page hiding of the target page, a target event is triggered, the page hiding information corresponding to the target page is obtained, and the page hiding information is stored in a local memory and reported with a delay.
[0036] In order to solve the above technical problem, in a second aspect, a first screen time reporting device is provided, the device comprising:
[0037] An acquisition module is used to provide a target monitoring script to a target application, so as to obtain the first screen information through the target monitoring script, and the first screen information includes element node change information;
[0038] A screening module is used to screen element text nodes based on element node change information and generate an element text node list based on the element text nodes;
[0039] A determination module, used to determine a target element text node based on a preset method and an element text node and obtain a first screen time corresponding to the target element text node;
[0040] The reporting module is used to obtain the time resource list, match the element text node list and the time resource list, obtain the first screen loading status information, and report the first screen information, element node change information and first screen loading status information to the server.
[0041] In order to solve the above technical problem, a third aspect provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: the processor implements the steps of the above first aspect method when executing the computer program.
[0042] In order to solve the above technical problems, in a fourth aspect, the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method of the above first aspect are implemented.
[0043] Different from the prior art, the present application provides a target monitoring script to the target application, so as to obtain the first screen information through the target monitoring script, and the first screen information includes the element node change information; the element text node is screened based on the element node change information, and the element text node list is generated according to the element text node; the target element text node is determined based on the preset method and the element text node and the first screen time corresponding to the target element text node is obtained; the time resource list is obtained, the element text node list and the time resource list are matched to obtain the first screen loading status information, and the first screen information, the element node change information and the first screen loading status information are reported to the server. In this way, the loading time of the target element text node is used as the first screen time, and the time resource list is matched with the element text node list, and the first screen loading status information is obtained and reported, so that the status of the first screen loading process can be clearly and intuitively understood, and the quality of network services can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a schematic diagram of element nodes in the first screen in the prior art;
[0045] Figure 2 A schematic diagram of a process of reporting first screen time in an embodiment;
[0046] Figure 3 It is a flowchart of a method for reporting first screen time in another embodiment;
[0047] Figure 4 It is a structural block diagram of a first screen time reporting device in an embodiment;
[0048] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0050] In the early timestamp calculation scheme, developers used manual timestamps. Developers would record a timestamp at the page header, and then add a timestamp after the DOM node (element node) of the first screen, and calculate the difference as the first screen time. This scheme relies on developers to insert timestamp recording code at a specific location. This is easily affected by human factors, resulting in inaccurate or missing records. With the development of technology, the front end is basically a single-page application, and this scheme cannot accurately collect single-page application data.
[0051] In the prior art, the standard tool library web-vitals provided by Google is used for calculation. It is more convenient to use API statistics. It calculates the time it takes for the largest content element (such as pictures, text blocks, videos, etc.) on the page to be drawn within the viewport. The limitation is that the largest content is not necessarily the most important content for users. Figure 1 As shown, Figure 1 The B element is the largest block element in the first screen. The first screen time calculated by the LCP solution is the loading time of the B element. However, in actual applications, the B element is not necessarily the last element loaded in the first screen. Therefore, only obtaining the loading time of the B element cannot accurately obtain the first screen time.
[0052] This application provides a first screen time reporting method, which aims to monitor and optimize the loading process of a web page in real time, help developers monitor and optimize the loading process of a web page in real time, and improve the loading speed of the web page and user experience.
[0053] In one embodiment, Figure 2 As shown, the present application provides a first screen time reporting method, which specifically includes the following steps:
[0054] Step S10, providing a target monitoring script to the target application, so as to obtain the first screen information through the target monitoring script, wherein the first screen information includes element node change information.
[0055] Specifically, the target monitoring script can be a JSSDK script. The JSSDK script contains a network communication module. By referencing the first-screen monitoring JSSDK script provided by the solution in all target applications that need to be accessed and used, the SDK (software development kit) sends an HTTP interface request to the server through the network communication module on the web page after initialization, and transmits the user's first-screen information to the server, thereby achieving the purpose of collecting the user's first-screen loading speed and page performance.
[0056] Step S11, filtering element text nodes based on element node change information, and generating an element text node list according to the element text nodes.
[0057] Specifically, element node change information is obtained, and element nodes and node attributes corresponding to the element nodes are extracted from the element node change information; element nodes are classified according to the node attributes corresponding to the element nodes, target node attribute types are obtained, and element nodes of the target node attribute type are used as element text nodes to be selected.
[0058] After obtaining the element node change information, the element nodes can be classified according to the element nodes included in the element node change information and the attributes corresponding to the element nodes to obtain the classified element nodes, and the target node attribute type can be obtained. The target node attribute type can be set according to actual needs, and the classified element nodes consistent with the target node attribute type are used as the element text nodes to be selected.
[0059] In one embodiment, the attributes corresponding to the element node may include video, picture, text, etc. The target node attribute type may be an element text node, and the classified element nodes of the element text node type in the classified element nodes are used as the element text to be selected, that is, the classified element nodes of the text attribute are used as the element text nodes to be selected.
[0060] Obtain the position information of the element text node to be selected; based on the position information of the element text node to be selected, determine whether the position of the element text node to be selected is within a preset loading range; and use the element text node to be selected whose position is within the preset loading range as the element text node.
[0061] Get the position information of the element text node to be selected, where the position information of the element text node includes the page position information of each element text node, and the preset loading range can be the first screen visible area, which can be determined according to the size of the first screen physical display area of the display device. It is understandable that in the case of full screen window, the window size is the size of the user's device display screen; in the case of zoom mode, the window size can be a user-defined size.
[0062] In a specific implementation, after the user enters the page, the SDK is initialized and the changes of DOM (element nodes) are monitored through MutationObserver. MutationObserver monitors DOM changes asynchronously, which means that when DOM changes occur, MutationObserver does not immediately execute the callback function, but stores these changes in a queue and processes them in batches after the current round of JavaScript execution. This asynchronous batch processing mechanism makes MutationObserver more efficient.
[0063] Obtaining the element node change information can filter out the element nodes with effective changes from the element nodes according to the element node change information, that is, the element text nodes of the present application. When monitoring the changes of DOM (element nodes) through MutationObserver, the label of each element node in the page is obtained. The label of each element node represents the node attributes of each element node. The element nodes corresponding to the labels irrelevant to the text type are regarded as invalid nodes, and the invalid nodes do not participate in the subsequent calculation of the first screen time. The element nodes corresponding to the labels related to the text type are regarded as the element text nodes to be selected, and it is further determined whether the element text nodes to be selected are within the preset loading range. The element text nodes to be selected that are not within the preset loading range are regarded as invalid nodes, and the invalid nodes do not participate in the subsequent calculation of the first screen time.
[0064] In one embodiment, determining whether the element text node to be selected is within a preset loading range can be achieved by comparing the coordinates of the element with the coordinates of the viewport. Specifically, if the top coordinate of the element is less than the top coordinate of the viewport, and the bottom coordinate of the element is greater than the bottom coordinate of the viewport, then the element text node to be selected is within the first screen.
[0065] Specifically, you can use the window.innerHeight and window.innerWidth properties in JavaScript, which return the height and width of the viewport respectively. If you need to be compatible with older versions of IE browsers, you can use document.documentElement.clientHeight and document.documentElement.clientWidth, or document.body.clientHeight and document.body.clientWidth3 to get the coordinates of the viewport.
[0066] In the present application, by performing multi-level screening on element nodes and selecting element text nodes to calculate the first screen time, the calculation accuracy of the first screen time calculation can be improved.
[0067] Step S12, determining the target element text node based on a preset method and element text nodes and obtaining the first screen time corresponding to the target element text node.
[0068] The preset method here may be to arrange the loading order of the element text nodes, take the last loaded element text node as the target element text node, and obtain the first screen time corresponding to the target element text node.
[0069] In one embodiment, the text type and display position information corresponding to the element text node are obtained; the element text node is divided into multiple element areas according to the text type and display position information corresponding to the element text node, and the element text nodes of the same text type that are adjacent in position can be divided into the same element area. For example, on the recommendation page of a shopping website, the commodity recommendation element text nodes of the same category and adjacent in position can be divided into the same element area. The loading order of each element area is obtained, and the target element area is determined according to the loading order of each element area; the loading time of the target element area is obtained, and the first screen time corresponding to the target element text node is determined according to the loading time of the target element area. The loading order of each element area can be sorted, and the last loaded element area is selected as the target element area. The element text node corresponding to the target element area is the target element text node. The loading completion time of the target element text node can be obtained according to the loading time of the target element text node, and then the loading time of the first element text node in the first screen is obtained to determine the first screen time.
[0070] Step S13, obtain the time resource list, match the element text node list and the time resource list, obtain the first screen loading status information, and report the first screen information, element node change information and first screen loading status information to the server.
[0071] Specifically, obtain a time resource list, which includes each element node tag of the target page, and each element node tag of the target page includes the loading address and loading duration of each element node of the target page; obtain an element text node list, which includes each element text node tag of the target page, and each element text node tag of the target page includes the loading address, loading duration and loaded element node list of each element text node of the target page; match each element node tag of the target page and each element text node tag of the target page to obtain the first screen loading status information.
[0072] The resource time list refers to the loading time, loading address and other information of all element nodes of the target page in the actual application, that is, the loading time and loading address of the element nodes that have not been screened. The element text node list is the loading address, loading time and loaded element node list of the valid element text nodes that have been screened. By comparing the loading time and loading address of all element nodes of the target page in the actual application with the loading time and loading address of the valid text node, the loading completion of the element text node can be checked. The element text node list also includes the loaded element node list. By comparing the element node list with the loading time and loading address of each element node in the time resource list, the element nodes other than the invalid valid nodes, that is, the loading status corresponding to the invalid nodes can be checked. For example, assuming that the element node list is marked as loaded with A element node (invalid nodes such as videos and pictures), but the loading time of A element node cannot be obtained in the time resource list, it is considered that A element has not been loaded. In this application, by matching the time resource list and the element text list, it is possible to check whether the elements in the target page of the first screen have been loaded, and obtain the first screen loading status information, so that subsequent users can clearly and concisely view the loading status information of each element node in the first screen.
[0073] In one embodiment, in response to a user entering a target page, an interaction duration corresponding to the target page is obtained; in response to obtaining the interaction duration corresponding to the target page, it is determined whether a pre-set reporting time can be obtained; in response to being able to obtain the pre-set reporting time, it is determined whether the interaction duration corresponding to the target page exceeds the pre-set reporting time; if the interaction duration corresponding to the target page exceeds the pre-set reporting time, a timer is started, and the first screen time corresponding to the target page is calculated and reported; in response to not being able to obtain the pre-set reporting time, a default time is set, and when the interaction duration corresponding to the target page exceeds the pre-set default time, the timer is started, and the first screen time corresponding to the target page is calculated and reported.
[0074] The target page is the page corresponding to the first screen, and the page here includes the display page of at least one window application window. When the user enters the target page, the interaction time corresponding to the target page is obtained. The interaction time corresponding to the target page is the time the user enters the page. The time to trigger the interaction after entering the page is used as the preset time. By judging whether the corresponding interaction time of the target page is greater than the preset time, it is judged whether the target page triggers the interaction after the user enters the target page. When the interaction time corresponding to the target page is greater than the preset time, it is considered that the user has not triggered the interaction after entering the page. At this time, it is necessary to stop monitoring, obtain the first screen information, calculate the first screen time corresponding to the target page, and report the first screen time. In this application, by setting the user to report the first screen time if the interaction is not triggered after entering the page for a certain period of time, the purpose is to save the SDK from occupying user device resources. Among them, the SDK supports the user-configured stop monitoring time, and the default time can be 20s.
[0075] like Figure 3 As shown, in a specific implementation manner, the process of the first screen time reporting method of the present application is as follows;
[0076] Step S20: Access the page to initialize the SDK.
[0077] Specifically, by providing the target monitoring script to the target application, the target monitoring script is run to monitor the target application and obtain the target application operation information. The application here can be an APP or application in the user-side operation terminal device. The target application is an application used to obtain the first screen information. After the SDK (software development kit) is initialized, it sends an HTTP interface request to the server through the network communication module on the web page, and transmits the user's first screen information to the server, so as to achieve the purpose of collecting the user's first screen loading speed and page performance.
[0078] Step S21: monitor and obtain the first screen information.
[0079] When a user visits a page, the process of establishing a link, requesting, accepting HTML, parsing scripts, and executing the page begins. After entering the page, the SDK is initialized, and the page rendering process begins. The SDK monitors DOM changes through the js Api MutationObserver, obtains valid DOM change nodes in the first screen, stores the current node and loading time in an array, and records location.href (the URL of the currently visited page).
[0080] In one embodiment, obtaining the first screen information through the target monitoring script includes: monitoring the page hiding, page interaction, routing status, target monitor and target memory of the target page based on the target monitoring script, and obtaining the corresponding page hiding information, page interaction information, page routing information, element node information and target memory information.
[0081] In one implementation, in response to monitoring page hiding of a target page, a target event is triggered, page hiding information corresponding to the target page is obtained, and the page hiding information is stored in a local memory and reported with a delay.
[0082] Specifically, as shown in the figure, the page hiding is monitored by monitoring the visibilitychange event. The visibilitychange event will be triggered when the visibility of the page changes, and the corresponding callback function will be executed. Through the visibilityState attribute in the callback function, visibilityState is an API provided by HTML5, which is used to record the activation status of the current tab in the browser. This state indicates whether the current tab is being browsed by the user to obtain the visibility status of the current page. Monitor page hiding, obtain relevant data when the page automatically jumps out, mark these data, and store them in the local storage. The data is not reported immediately, but reported when the set reporting time is reached.
[0083] Monitor page interactions, including click (user click events), wheel (scroll events), and touchmove (finger touching the screen). When a user click event, scroll event, or finger touching the screen event is triggered, it means that the user is performing a page jump operation and records the last element loaded on the page.
[0084] Monitor route changes. When the route changes, stop monitoring the first screen time of the current page and record it. When jumping to the next page, start monitoring the first screen time of the current page. When the route changes, it is not necessarily an interaction triggered manually by the user. In this scenario, the first screen time also needs to be reported. Therefore, it is necessary to monitor the first screen time and record the time of route changes.
[0085] Multi-page route jump: listen to the hashchange event through the js API addEventListener hashchange, and you can listen to the route jump. If the first screen time is not reported before the jump, stop listening and report it immediately.
[0086] Single page jump: In single page applications, js api 'pushState', 'replaceState' is used to monitor route changes by proxying 'pushState', 'replaceState' events. If the event is not reported when it is triggered, stop the current monitoring and report, and start a new monitoring process.
[0087] Since the performance.now() of SPA (single page application) projects is calculated from the initial opening of the page, the first screen time minus the time when the route changes is the correct first screen time before the final report. The target element text node can be quickly found based on the route change time, and the first screen time can be verified based on the route change time later.
[0088] MutationObserver is also used to monitor changes in DOM (element nodes) and obtain element node change information. The first screen time can be calculated based on the element node change information.
[0089] When the user's interaction time when entering the target page reaches the preset reporting time (reaching the set reporting time), stop monitoring, obtain the page hiding information obtained by monitoring the page hiding, the page interaction information obtained by monitoring the page interaction, the page routing information obtained by monitoring the routing status (routing changes), and the element node information obtained by monitoring the target observer (MutationObserver) to participate in the subsequent screening of the target element text nodes and the calculation of the first screen time.
[0090] This application also includes monitoring the target storage and obtaining target storage information. The target storage here is the local storage. After initializing the SDK, it monitors whether there is data stored in the storage. If there is data in the storage, the data is directly reported. After reporting, the data stored in the local storage is deleted.
[0091] Step S22: Get the last element in the first screen that has been loaded and the loading completion time.
[0092] After obtaining page hidden information, page interaction information, page routing information and element node information through step S21, the target element text node is screened and the first screen time is calculated based on the page hidden information, page interaction information, page routing information and element node information.
[0093] Specifically, element nodes that meet the target node attribute type and are within the preset loading range are taken as valid nodes, and the change information of the valid nodes is obtained. The current node and loading time are stored in an array, and location.href (the URL of the currently visited page) is recorded. The purpose of obtaining the valid DOM node and time is to find out the time of the last element loaded later. This time is the first screen time, and it is also to find elements that load slowly, so that it is convenient to find out the cause and optimize it later. The purpose of recording location.href is to record the currently visited URL and report it as the first screen time of the current page. Each page has its own separate first screen time for statistics.
[0094] The purpose of obtaining valid DOM nodes and time is to find the time of the last element loaded. This time is the first screen time. It is also to find slow loading elements, which will facilitate troubleshooting and optimization. In this process, there are interface requests, the front end will obtain data, and the DOM may continue to change. The SDK will continue to monitor and record the time.
[0095] The first screen time is calculated based on the last element text node in the target page of the first screen, that is, the loading completion time of the target element text node.
[0096] Step S23: Match the element text node list and the time resource list, and report the first screen time according to the matching result.
[0097] The elements in the page include DOM text elements and resource elements (pictures, videos, etc.). The loading time of resource elements is obtained through Performance. Finally, the reasonable first screen time and the last loaded elements are calculated through the correct timing and screening strategy.
[0098] The DOM list (element text node list) obtained by MutationObserver, where the list contains the valid nodes that have been filtered, and the loading completion time of the DOM element text node is recorded at the same time, and the last element loaded and the loading completion time in the first screen are obtained (the last element loaded in the first screen is the element node last loaded in the target page of the actual first screen, which can be a valid node or an invalid element node such as a video or a picture), and the time resource list is traversed to see if the loaded DOM tags and resource information can be completely matched. If not, it means that it is not fully loaded, and allLoad:false is marked, and it is considered that the first screen loading is not completed and the data has errors. For example, an IMG image is loaded in the DOM list, but the loading completion time cannot be obtained using the performa nce API, which means that the image has not been loaded. If it can be matched, allLoad:true is marked, the first screen loading is completed, and the data is available. Finally, the first screen information, element node change information, and first screen loading status information obtained are reported to the server.
[0099] Finally, use allLoad to perform accuracy statistics when performing data statistics. The formula is: available data (data marked as allLoad:true) / total page visits = accuracy.
[0100] Specifically, use the performance.getEntries() method to get the time information of the resources loaded in the page. Then, you can traverse these resources and check whether their time information matches certain tags in the DOM.
[0101] performance.getEntries() returns an array containing the timing information of all resources during the page loading process. The querySelector function is used to find tags with a specific src attribute in the DOM. If you need a more precise match, you can adjust the selector as needed.
[0102] In this application, the first screen monitoring JSSDK can be accessed through the page to monitor the first screen loading process of the web page in real time. The SDK can collect comprehensive first screen loading information, such as loading time, pages visited by users, and the latest loaded elements, to help developers quickly locate loading performance bottlenecks. By analyzing these data, developers can fully understand the loading performance of web pages, accurately evaluate the optimization effect, and perform targeted optimization based on the analysis results, thereby greatly improving the loading speed of web pages. Users can access web content faster, improving user experience and satisfaction.
[0103] It should be understood that although Figure 2-Figure 3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 3 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0104] In one embodiment, Figure 4 As shown, a first screen time reporting device is provided, comprising: an acquisition module 40, a screening module 41, a determination module 42 and a reporting module 43, wherein:
[0105] The acquisition module 40 is used to provide a target monitoring script to the target application, so as to obtain the first screen information through the target monitoring script, and the first screen information includes the element node change information;
[0106] A screening module 41 is used to screen element text nodes based on element node change information and generate an element text node list according to the element text nodes;
[0107] A determination module 42, configured to determine a target element text node based on a preset method and an element text node and obtain a first screen time corresponding to the target element text node;
[0108] The reporting module 43 is used to obtain the time resource list, match the element text node list and the time resource list, obtain the first screen loading status information, and report the first screen information, element node change information and first screen loading status information to the server.
[0109] In one embodiment, the above device can implement another implementation method of the first screen time reporting method, and the specific steps are as follows:
[0110] The first screen information obtained through the target monitoring script includes:
[0111] Based on the target monitoring script, the page hiding, page interaction, routing status, target monitor and target storage of the target page are monitored to obtain the corresponding page hiding information, page interaction information, page routing information, element node information and target storage information.
[0112] In one embodiment, the above device can implement another implementation method of the first screen time reporting method, and the specific steps are as follows:
[0113] Filtering element text nodes based on element node change information includes:
[0114] Obtain element node change information, and extract element nodes and node attributes corresponding to the element nodes from the element node change information;
[0115] Classify element nodes according to their corresponding node attributes;
[0116] Get the target node attribute type, and use the element node of the target node attribute type as the element text node to be selected;
[0117] Get the position information of the text node of the element to be selected;
[0118] Based on the position information of the element text node to be selected, determining whether the position of the element text node to be selected is within a preset loading range;
[0119] The element text node to be selected whose position is within a preset loading range is used as the element text node.
[0120] In one embodiment, the above device can implement another implementation method of the first screen time reporting method, and the specific steps are as follows:
[0121] Determining the target element text node based on the preset method and the element text node and obtaining the first screen time corresponding to the target element text node includes:
[0122] Obtain the text type and display position information corresponding to the element text node;
[0123] Dividing the element text node into a plurality of element areas according to the text type and display position information corresponding to the element text node;
[0124] Obtaining a loading order for each element region, and determining a target element region according to the loading order for each element region;
[0125] The loading time of the first element text node loaded and the loading time of the target element area are obtained, and the first screen time corresponding to the target element text node is determined according to the loading time of the first element text node loaded and the loading time of the target element area.
[0126] In one embodiment, the above device can implement another implementation method of the first screen time reporting method, and the specific steps are as follows:
[0127] The method also includes:
[0128] In response to the user entering the target page, obtaining the interaction time corresponding to the target page;
[0129] In response to obtaining the interaction duration corresponding to the target page, determining whether a preset reporting time can be obtained;
[0130] In response to obtaining the preset reporting time, determining whether the interaction duration corresponding to the target page exceeds the preset reporting time;
[0131] If the interaction time corresponding to the target page exceeds the preset reporting time, start the timer, calculate the first screen time corresponding to the target page and report it;
[0132] In response to not obtaining the preset reporting time, a default time is set. When the interaction time corresponding to the target page exceeds the preset default time, the timer is started to calculate the first screen time corresponding to the target page and report it.
[0133] In one embodiment, the above device can implement another implementation method of the first screen time reporting method, and the specific steps are as follows:
[0134] Get the time resource list, match the element text node list and the time resource list, and get the first screen loading status information including:
[0135] Obtain a time resource list, the time resource list includes each element node label of the target page, each element node label of the target page includes a loading address and loading duration of each element node of the target page;
[0136] Obtaining an element text node list, the element text node list includes each element text node label of the target page, each element text node label of the target page includes a loading address, loading duration, and a loaded element node list of each element text node of the target page;
[0137] Match each element node tag of the target page and each element text node tag of the target page to obtain the first screen loading status information.
[0138] In one embodiment, the above device can implement another implementation method of the first screen time reporting method, and the specific steps are as follows:
[0139] The method also includes:
[0140] In response to monitoring the page hiding of the target page, a target event is triggered, the page hiding information corresponding to the target page is obtained, and the page hiding information is stored in a local memory and reported with a delay.
[0141] For the specific limitations of the first screen time reporting device, please refer to the limitations of the first screen time reporting method above, which will not be repeated here. Each module in the above-mentioned first screen time reporting device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0142] In one embodiment, the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the first screen time reporting method provided by the above methods.
[0143] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data used in the first screen time reporting method. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a first screen time reporting method is implemented.
[0144] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0145] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0146] Step S10, providing a target monitoring script to the target application, so as to obtain the first screen information through the target monitoring script, wherein the first screen information includes element node change information.
[0147] Step S11, filtering element text nodes based on element node change information, and generating an element text node list according to the element text nodes.
[0148] Step S12, determining the target element text node based on a preset method and element text nodes and obtaining the first screen time corresponding to the target element text node.
[0149] Step S13, obtain the time resource list, match the element text node list and the time resource list, obtain the first screen loading status information, and report the first screen information, element node change information and first screen loading status information to the server.
[0150] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0151] The first screen information obtained through the target monitoring script includes:
[0152] Based on the target monitoring script, the page hiding, page interaction, routing status, target monitor and target storage of the target page are monitored to obtain the corresponding page hiding information, page interaction information, page routing information, element node information and target storage information.
[0153] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0154] Filtering element text nodes based on element node change information includes:
[0155] Obtain element node change information, and extract element nodes and node attributes corresponding to the element nodes from the element node change information;
[0156] Classify element nodes according to their corresponding node attributes;
[0157] Get the target node attribute type, and use the element node of the target node attribute type as the element text node to be selected;
[0158] Get the position information of the text node of the element to be selected;
[0159] Based on the position information of the element text node to be selected, determining whether the position of the element text node to be selected is within a preset loading range;
[0160] The element text node to be selected whose position is within a preset loading range is used as the element text node.
[0161] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0162] Determining the target element text node based on the preset method and the element text node and obtaining the first screen time corresponding to the target element text node includes:
[0163] Obtain the text type and display position information corresponding to the element text node;
[0164] Dividing the element text node into a plurality of element areas according to the text type and display position information corresponding to the element text node;
[0165] Obtaining a loading order for each element region, and determining a target element region according to the loading order for each element region;
[0166] The loading time of the first element text node loaded and the loading time of the target element area are obtained, and the first screen time corresponding to the target element text node is determined according to the loading time of the first element text node loaded and the loading time of the target element area.
[0167] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0168] The method also includes:
[0169] In response to the user entering the target page, obtaining the interaction time corresponding to the target page;
[0170] In response to obtaining the interaction duration corresponding to the target page, determining whether a preset reporting time can be obtained;
[0171] In response to obtaining the preset reporting time, determining whether the interaction duration corresponding to the target page exceeds the preset reporting time;
[0172] If the interaction time corresponding to the target page exceeds the preset reporting time, start the timer, calculate the first screen time corresponding to the target page and report it;
[0173] In response to not obtaining the preset reporting time, a default time is set. When the interaction time corresponding to the target page exceeds the preset default time, the timer is started to calculate the first screen time corresponding to the target page and report it.
[0174] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0175] Get the time resource list, match the element text node list and the time resource list, and get the first screen loading status information including:
[0176] Obtain a time resource list, the time resource list includes each element node label of the target page, each element node label of the target page includes a loading address and loading duration of each element node of the target page;
[0177] Obtaining an element text node list, the element text node list includes each element text node label of the target page, each element text node label of the target page includes a loading address, loading duration, and a loaded element node list of each element text node of the target page;
[0178] Match each element node tag of the target page and each element text node tag of the target page to obtain the first screen loading status information.
[0179] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0180] The method also includes:
[0181] In response to monitoring the page hiding of the target page, a target event is triggered, the page hiding information corresponding to the target page is obtained, and the page hiding information is stored in a local memory and reported with a delay.
[0182] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0183] Step S10, providing a target monitoring script to the target application, so as to obtain the first screen information through the target monitoring script, wherein the first screen information includes element node change information.
[0184] Step S11, filtering element text nodes based on element node change information, and generating an element text node list according to the element text nodes.
[0185] Step S12, determining the target element text node based on a preset method and element text nodes and obtaining the first screen time corresponding to the target element text node.
[0186] Step S13, obtain the time resource list, match the element text node list and the time resource list, obtain the first screen loading status information, and report the first screen information, element node change information and first screen loading status information to the server.
[0187] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0188] The first screen information obtained through the target monitoring script includes:
[0189] Based on the target monitoring script, the page hiding, page interaction, routing status, target monitor and target storage of the target page are monitored to obtain the corresponding page hiding information, page interaction information, page routing information, element node information and target storage information.
[0190] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0191] Filtering element text nodes based on element node change information includes:
[0192] Obtain element node change information, and extract element nodes and node attributes corresponding to the element nodes from the element node change information;
[0193] Classify element nodes according to their corresponding node attributes;
[0194] Get the target node attribute type, and use the element node of the target node attribute type as the element text node to be selected;
[0195] Get the position information of the text node of the element to be selected;
[0196] Based on the position information of the element text node to be selected, determining whether the position of the element text node to be selected is within a preset loading range;
[0197] The element text node to be selected whose position is within a preset loading range is used as the element text node.
[0198] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0199] Determining the target element text node based on the preset method and the element text node and obtaining the first screen time corresponding to the target element text node includes:
[0200] Obtain the text type and display position information corresponding to the element text node;
[0201] Dividing the element text node into a plurality of element areas according to the text type and display position information corresponding to the element text node;
[0202] Obtaining a loading order for each element region, and determining a target element region according to the loading order for each element region;
[0203] The loading time of the first element text node loaded and the loading time of the target element area are obtained, and the first screen time corresponding to the target element text node is determined according to the loading time of the first element text node loaded and the loading time of the target element area.
[0204] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0205] The method also includes:
[0206] In response to the user entering the target page, obtaining the interaction time corresponding to the target page;
[0207] In response to obtaining the interaction duration corresponding to the target page, determining whether a preset reporting time can be obtained;
[0208] In response to obtaining the preset reporting time, determining whether the interaction duration corresponding to the target page exceeds the preset reporting time;
[0209] If the interaction time corresponding to the target page exceeds the preset reporting time, start the timer, calculate the first screen time corresponding to the target page and report it;
[0210] In response to not obtaining the preset reporting time, a default time is set. When the interaction time corresponding to the target page exceeds the preset default time, the timer is started to calculate the first screen time corresponding to the target page and report it.
[0211] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0212] Get the time resource list, match the element text node list and the time resource list, and get the first screen loading status information including:
[0213] Obtain a time resource list, the time resource list includes each element node label of the target page, each element node label of the target page includes a loading address and loading duration of each element node of the target page;
[0214] Obtaining an element text node list, the element text node list includes each element text node label of the target page, each element text node label of the target page includes a loading address, loading duration, and a loaded element node list of each element text node of the target page;
[0215] Match each element node tag of the target page and each element text node tag of the target page to obtain the first screen loading status information.
[0216] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0217] The method also includes:
[0218] In response to monitoring the page hiding of the target page, a target event is triggered, the page hiding information corresponding to the target page is obtained, and the page hiding information is stored in a local memory and reported with a delay.
[0219] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous forwarding path (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0220] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0221] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for reporting first screen time, characterized in that: include: Providing a target monitoring script to the target application, so as to obtain first screen information through the target monitoring script, wherein the first screen information includes element node change information; Filter element text nodes based on the element node change information, and generate an element text node list according to the element text nodes; Determine the target element text node based on the preset method and the element text node and obtain the first screen time corresponding to the target element text node; Obtain a time resource list, match the element text node list with the time resource list, obtain first screen loading status information, and report the first screen information, the element node change information, and the first screen loading status information to the server.
2. The method according to claim 1, characterized in that: The obtaining of the first screen information through the target monitoring script includes: Based on the target monitoring script, the page hiding, page interaction, routing status, target monitor and target memory of the target page are monitored to obtain corresponding page hiding information, page interaction information, page routing information, element node information and target memory information.
3. The method according to claim 1, characterized in that The filtering of element text nodes based on the element node change information comprises: Obtaining element node change information, and extracting element nodes and node attributes corresponding to the element nodes from the element node change information; Classifying element nodes according to node attributes corresponding to the element nodes; Get the target node attribute type, and use the element node of the target node attribute type as the element text node to be selected; Get the position information of the text node of the element to be selected; Based on the position information of the element text node to be selected, determining whether the position of the element text node to be selected is within a preset loading range; The element text node to be selected whose position is within a preset loading range is used as the element text node.
4. The method according to claim 1, characterized in that: Determining the target element text node based on the preset method and the element text node and obtaining the first screen time corresponding to the target element text node includes: Obtain the text type and display position information corresponding to the element text node; Dividing the element text node into a plurality of element areas according to the text type and display position information corresponding to the element text node; Obtaining a loading order for each element region, and determining a target element region according to the loading order for each element region; The loading time of the first element text node loaded and the loading time of the target element area are obtained, and the first screen time corresponding to the target element text node is determined according to the loading time of the first element text node loaded and the loading time of the target element area.
5. The method according to claim 1, characterized in that The method further comprises: In response to the user entering the target page, obtaining the interaction time corresponding to the target page; In response to obtaining the interaction duration corresponding to the target page, determining whether a preset reporting time can be obtained; In response to obtaining the preset reporting time, determining whether the interaction duration corresponding to the target page exceeds the preset reporting time; If the interaction time corresponding to the target page exceeds the preset reporting time, start the timer, calculate the first screen time corresponding to the target page and report it; In response to not obtaining the preset reporting time, a default time is set. When the interaction time corresponding to the target page exceeds the preset default time, the timer is started to calculate the first screen time corresponding to the target page and report it.
6. The method according to claim 1, characterized in that The acquiring of the time resource list, matching the element text node list with the time resource list, and obtaining the first screen loading status information includes: Obtaining a time resource list, wherein the time resource list includes tags of each element node of the target page, and each element node tag of the target page includes a loading address and a loading duration of each element node of the target page; Obtaining an element text node list, wherein the element text node list includes each element text node tag of the target page, and each element text node tag of the target page includes a loading address, a loading duration, and a loaded element node list of each element text node of the target page; Each element node tag of the target page and each element text node tag of the target page are matched to obtain first screen loading status information.
7. The method according to claim 1, characterized in that The method further comprises: In response to monitoring the page hiding of the target page, a target event is triggered, the page hiding information corresponding to the target page is obtained, and the page hiding information is stored in a local memory and reported with a delay.
8. A first screen time reporting device, characterized in that: The device comprises: An acquisition module, used to provide a target monitoring script to a target application, so as to acquire first screen information through the target monitoring script, wherein the first screen information includes element node change information; A screening module, used for screening element text nodes based on the element node change information, and generating an element text node list according to the element text nodes; A determination module, used to determine a target element text node based on a preset method and the element text node and obtain a first screen time corresponding to the target element text node; The reporting module is used to obtain the time resource list, match the element text node list and the time resource list, obtain the first screen loading status information, and report the first screen information, the element node change information and the first screen loading status information to the server.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.