Method and device for monitoring first screen time of application page

By obtaining the time-consuming and terminal running records of the page initialization to the first asynchronous callback, the problem of inaccurate page time statistics in the existing technology is solved, and more accurate page loading performance evaluation and optimization guidance are achieved.

CN119415371APending Publication Date: 2025-02-11SHANGHAI MEDIA TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411425198.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

When calculating the first-screen time of the page, the prior art cannot accurately reflect the page loading completion time actually perceived by the user, resulting in a lack of reference value for the evaluation results.

Method used

By obtaining the time taken for the page to be initialized to the first asynchronous callback, and determining whether it has exceeded the preset time threshold, obtaining the page information of the application's preset position and the terminal's running record, performing aggregation analysis to obtain accurate page homepage time data .

Benefits of technology

This avoids errors caused by incomplete asynchronous operations in traditional methods, improves the accuracy of page loading performance evaluation, and thus better guides performance optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415371A_ABST
    Figure CN119415371A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for monitoring the first screen time of an application page, and belongs to the technical field of computers, and the method comprises the steps: S1, obtaining the time consumption from page initialization to completion of first asynchronous callback, and judging whether the time consumption exceeds a preset time threshold or not; s2, when it is judged that the consumed time exceeds a preset time threshold value, page information of a preset position of the application is obtained, and operation records of the application and the terminal are collected through a collection thread; and S3, carrying out aggregation analysis on the page information and the operation record to obtain time consumption data from page initialization of the application to completion of the first asynchronous callback. The method has the beneficial effects that the loading time consumption of the first asynchronous callback is put forward as the precondition for obtaining the page information, errors caused by the fact that asynchronous operation is not completed in a traditional method are avoided, the accuracy of page loading performance evaluation is improved, and then performance optimization is better guided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for monitoring the first screen time of an application page. Background Art

[0002] The page first screen time is one of the important indicators for evaluating the performance of network applications. It reflects the length of time it takes for a user to open a page of the website on the client and for the page to be fully displayed on the client's screen.

[0003] Currently, the tracking technology is usually used to record the time when the page starts loading and when the page loading is completed, and the time difference between the two is calculated to determine the page first screen time, and then this value is used to evaluate the application performance.

[0004] Regarding the tracking location, there is no dispute about the tracking point when the page starts loading. Generally, the tracking code is added to the onCreate callback of the page (Activity or Fragment) to count the time when the page starts loading.

[0005] However, for the tracking point when the page is loaded, the method widely used in the prior art is to add the tracking point code to the onResume callback of the page to count the time when the page is loaded. This method is simple and practical, so it is adopted by many websites and applications. However, its limitations are also increasingly prominent. Specifically, the page entering the onResume callback can only mean that the synchronous work in the page initialization is basically completed, and in application development, there are often a lot of asynchronous work to be completed when the page is loaded, so the execution of the onResume callback does not mean that the page loading is truly completed. From the perspective of the system, the first screen time has been concluded, but for the user, the screen elements at this time have not been fully displayed. The first screen completion time counted at this time is only the time of the empty first screen or the default first screen, not the first screen time in the business. Since the first screen display from the user's perspective has not been completed, the value counted in this way is smaller than the actual value. If this value is used to evaluate the application performance evaluation, the evaluation result will lack reference value. Summary of the invention

[0006] In order to solve the above technical problems, the present invention provides a method and device for monitoring the first screen time of an application page.

[0007] The technical problem solved by the present invention can be achieved by adopting the following technical solutions:

[0008] A method for monitoring the first screen time of an application page, comprising:

[0009] Step S1, obtaining the time taken from page initialization to completion of the first asynchronous callback, and determining whether the time taken exceeds a preset time threshold;

[0010] Step S2, when it is determined that the time consumption exceeds the preset time threshold, obtaining page information of a preset position of the application, and using a collection thread to collect operation records of the application and the terminal;

[0011] Step S3, performing aggregate analysis on the page information and the operation record to obtain time-consuming data from page initialization of the application to completion of the first asynchronous callback.

[0012] Preferably, before step S1, the step further includes:

[0013] Place the embedding point at the initialization position of the page;

[0014] Place a tracking point at the location where the first asynchronous callback on the page is completed.

[0015] Preferably, in step S2, the embedding point is used to obtain page information of a preset location of the application.

[0016] Preferably, the page information includes one or more combinations of the initialization time of the page, the time when the first asynchronous callback of the page is completed, the class of the page, and the thread of the page.

[0017] Preferably, the operation record includes one or more combinations of the user's device system version and device model.

[0018] Preferably, step S3 comprises:

[0019] The page information and the operation record are aggregated and analyzed, and the time taken to complete the first asynchronous callback of the page is subtracted from the initialization time of the page to obtain the time-consuming data from the initialization of the application page to the completion of the first asynchronous callback.

[0020] The present invention also provides a monitoring device for the first screen time of an application page, which is used to implement the monitoring method for the first screen time of an application page as described above, comprising:

[0021] A monitoring unit, used to obtain the time taken from page initialization to the completion of the first asynchronous callback, and determine whether the time taken exceeds a preset time threshold;

[0022] A collection unit, connected to the monitoring unit, for obtaining page information of a preset position of the application when it is determined that the time consumption exceeds the preset time threshold, and collecting the operation records of the application and the terminal by using a collection thread;

[0023] A processing unit is connected to the collection unit and is used to perform aggregate analysis on the page information and the operation record to obtain time-consuming data from page initialization of the application to completion of the first asynchronous callback.

[0024] Preferably, it also includes:

[0025] The tracking unit is used to track the page at the initialization position and when the first asynchronous callback of the page is completed.

[0026] Preferably, the acquisition unit uses the embedding point to obtain page information of a preset location of the application.

[0027] Preferably, the page information includes one or more combinations of the initialization time of the page, the time when the first asynchronous callback of the page is completed, the class of the page, and the thread of the page.

[0028] The advantages or beneficial effects of the technical solution of the present invention are:

[0029] The present invention proposes to use the loading time of the first asynchronous callback as a prerequisite for obtaining page information, thereby avoiding errors caused by incomplete asynchronous operations in traditional methods, improving the accuracy of page loading performance evaluation, and thus better guiding performance optimization. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 A flow chart of a method for monitoring the first screen time of an application page in a preferred embodiment of the present invention;

[0031] Figure 2 This is a structural block diagram of a device for monitoring the first screen time of an application page in a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0033] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0034] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.

[0035] See also Figure 1 In a preferred embodiment of the present invention, based on the above problems existing in the prior art, a method for monitoring the first screen time of an application page is provided, comprising:

[0036] Step S1, obtaining the time taken from page initialization to the completion of the first asynchronous callback, and determining whether the time taken exceeds a preset time threshold;

[0037] Step S2, when it is determined that the time consumption exceeds the preset time threshold, the page information of the preset position of the application is obtained, and the operation records of the application and the terminal are collected by using the collection thread;

[0038] Step S3, aggregate and analyze the page information and operation records to obtain time-consuming data from page initialization of the application to completion of the first asynchronous callback.

[0039] In this embodiment, the time consumed is defined as the first screen time of the application page.

[0040] Specifically, the prior art usually uses the time point when page loading is completed, such as onResume, but this time point only reflects the completion of synchronous operations, while ignoring the impact of asynchronous operations, resulting in inaccurate first screen time statistics. In this embodiment, it is proposed for the first time to use the loading time of the first asynchronous callback as a prerequisite for obtaining page information. By recording the time consumption of the first asynchronous callback, it is closer to the page loading completion time actually perceived by the user, avoiding the errors caused by incomplete asynchronous operations in traditional methods, improving the accuracy of page loading performance evaluation, and thus better guiding performance optimization.

[0041] As a preferred embodiment, before step S1, the method further includes:

[0042] Place the embedding point at the initialization position of the page;

[0043] Place a tracking point at the location where the first asynchronous callback on the page is completed.

[0044] In this embodiment, the page initialization position refers to the position where the page starts to load, that is, the initial stage in the page life cycle.

[0045] Specifically, a point is placed at the initialization position of the application page to record the initialization time of the page.

[0046] In this embodiment, the first asynchronous callback completion position of the page refers to the position after the first asynchronous operation (such as data request, third-party script loading, etc.) is completed during the page loading process.

[0047] Specifically, by tracking the location where the first asynchronous callback is completed on the page, the execution time of the asynchronous operation can be recorded to obtain the time when the first asynchronous callback is completed.

[0048] In this embodiment, the time taken from page initialization to the completion of the first asynchronous callback is subtracted from the time when the first asynchronous callback is completed.

[0049] As a preferred implementation, in step S2, the page information of the preset location of the application is obtained by using the embedding point.

[0050] As a preferred implementation, the page information includes one or more combinations of the page initialization time, the time when the first asynchronous callback of the page is completed, the class of the page, and the thread of the page.

[0051] As a preferred implementation, the operation record includes one or more combinations of the user's device system version and device model.

[0052] Specifically, in this embodiment, a monitoring thread is used to monitor whether the time from page initialization to the completion of the first asynchronous callback exceeds a preset time threshold; when the loading time exceeds the preset time threshold, a tracking point is used to obtain the page information of the preset position of the application; specifically, the page information includes but is not limited to the initialization time of the page, the time when the first asynchronous callback of the page is completed, and general information such as the class and thread of the page.

[0053] At the same time, the collection thread is used to collect the operation records of applications and terminals; specifically, the operation records include but are not limited to the user's device system version, device model and other general information.

[0054] As a preferred embodiment, step S3 includes:

[0055] Perform aggregate analysis on page information and running records, subtract the page initialization time from the time the first asynchronous callback of the page is completed, and obtain the time-consuming data from the initialization of the application page to the completion of the first asynchronous callback.

[0056] Specifically, in this embodiment, the page information and operation records are aggregated and analyzed, and the time for the first asynchronous callback of the page to be completed is subtracted from the initialization time of the page to obtain the time-consuming data from the initialization of the application page to the completion of the first asynchronous callback. In addition, general information such as the page class, thread, user's device system version, and device model is provided, which is further combined with the running status of the application and the terminal to provide comprehensive data support for analyzing the reasons for slow page loading.

[0057] The embodiment of the present invention can quickly and accurately obtain page information of application pages with a long first screen time (i.e., slow loading), thereby providing an effective reference for analyzing the cause of slow page loading and solving the problem.

[0058] See also Figure 2 The present invention also provides a monitoring device for the first screen time of an application page, which is used to implement the monitoring method for the first screen time of an application page as described above, comprising:

[0059] Monitoring unit 1 is used to obtain the time taken from page initialization to the completion of the first asynchronous callback, and determine whether the time taken exceeds a preset time threshold;

[0060] The collection unit 2 is connected to the monitoring unit 1 and is used to obtain the page information of the preset position of the application when it is judged that the time consumed exceeds the preset time threshold, and use the collection thread to collect the operation records of the application and the terminal;

[0061] The processing unit 3 is connected to the collection unit 2 and is used to perform aggregate analysis on the page information and the operation records to obtain the time-consuming data from the initialization of the application page to the completion of the first asynchronous callback.

[0062] Specifically, in this embodiment, the time consumption is defined as the first screen time of the application page. The monitoring unit 1 is used to obtain the first screen time of the page, and use the monitoring thread to monitor whether the first screen time of the page exceeds a preset time threshold; if it exceeds the threshold, it means that the application has performance problems in terms of page loading speed;

[0063] The collection unit 2 is used to use the embedding point to obtain the page information of the application at the preset position when the page first screen time exceeds the preset time threshold, and use the collection thread to collect the operation records of the application and the terminal; the processing unit 3 is used to aggregate and analyze the page information and operation records to obtain the time-consuming data of the application, that is, the page first screen time data.

[0064] As a preferred embodiment, the invention further comprises:

[0065] The tracking unit 4 is used to track the initialization position of the page and when the first asynchronous callback of the page is completed.

[0066] As a preferred implementation, the acquisition unit 2 uses embedded points to obtain page information of a preset location of the application.

[0067] As a preferred implementation, the page information includes one or more combinations of the page initialization time, the time when the first asynchronous callback of the page is completed, the class of the page, and the thread of the page.

[0068] Specifically, in an embodiment of the present invention, after a point is buried at a preset position of an application, the start loading time of the interface and the completion time of the first asynchronous callback of the page are obtained, and a monitoring thread is used to monitor whether the first screen time of the page exceeds the preset time threshold each time the page is opened. When the first screen time of the page exceeds the preset time threshold, the buried point is used to obtain the page information of the preset position of the application, and the collection thread is used to collect the operation records of the application and the terminal, and the page information and the operation records are aggregated and analyzed to obtain the slow loading data of the application. That is, in an embodiment of the present invention, when slow loading is monitored, the collection thread is used to collect the operation records of the application and the terminal, and the page information of the slowly loading page is quickly and accurately obtained through the buried point at the preset position. The slow loading data of the application can be obtained based on the obtained page information and operation records, thereby providing an effective reference for the cause analysis and problem solving of the slow page loading.

[0069] In the specific implementation process, when compiling an application, the method and device for monitoring the first screen time of an application page proposed in an embodiment of the present invention can receive these inputs (i.e., the Class files generated during compilation) by writing a Transform to obtain the Class files generated during compilation and process the Class files generated during compilation before generating the Dex file. And add additional content to the input that has been generated. Next, register the written Transform class through the Gradle plug-in. The registered Transform class will be packaged into a Gradle Task by Gradle, which will run after the java compile task (java compile Task) is executed.

[0070] In the Transform class, the embodiment of the present invention implements the functional content by inserting the tracking unit 4, the monitoring unit 1, and the collection unit 2, so that the required plug-in injection work can be completed when the application is compiled, thereby not affecting the runtime performance.

[0071] The following are the specific implementation steps:

[0072] The first step is to write a custom transform class, which inherits Transform and is responsible for receiving the Class file generated during compilation;

[0073] The second step is to call the register method of ActivityExt (or similar registration methods provided by Gradle plug-ins) to register the customized class in the first step into the application, so that the required instrumentation injection work can be completed when the application is compiled, thus not affecting the performance of the application at runtime;

[0074] The third step is to check the class name of the current class and make sure it does not end with "NavHostFragment" but ends with "Fragment", and also make sure its superclass ends with "Fragment".

[0075] The fourth step is to find a method named "onCreate" in the "onCreate" method of the class, and insert performance monitoring instructions into the "onCreate" method to implement the performance monitoring function. Specifically, the inserted instructions include obtaining the performance monitoring instance, the current object and method parameters, and calling the "firstScreenStart" method of the performance monitoring instance;

[0076] Step 5: Define the performance monitoring instance in tracking unit 4, define a method named "firstScreenStart" in the performance monitoring instance, and receive a parameter "fragment";

[0077] Step 6: Check whether "fragment" is an instance of "Fragment". If not, return to step 5; if yes, go to step 7;

[0078] Step 7: Associate the current timestamp with the simple class name of "fragment" and store it in "firstScreenMap" to record the start time of the first screen loading as the initialization time of the above page;

[0079] Step 8. Check the class name of the current class and make sure it contains "Fragment$initViewModel";

[0080] Step 9. Find the method named "onChanged" in the class;

[0081] The tenth step is to insert performance monitoring instructions into the "onChanged" method to implement the performance monitoring function. Specifically, the inserted instructions include obtaining the performance monitoring instance, the current object and method parameters, and calling the "firstScreenEnd" method of the performance monitoring instance; by inserting the performance monitoring instructions before the instruction node of the method exit, it is ensured that performance monitoring is performed when the method is executed;

[0082] Step 11. Define a method named "firstScreenEnd" that receives two parameters: "obj" and "p1";

[0083] Step 12: Get the class name from "obj", and get the name of "fragment" by processing the class name;

[0084] Step 13: If "p1" is null, the monitoring process is terminated directly;

[0085] Step 14: Get the start time associated with "fragment" from "firstScreenMap";

[0086] Step 15: If the start time obtained in step 14 is not null, calculate the loading timing and call the upload page first screen time method to upload the relevant page data;

[0087] Step 16: Set the start time associated with "fragment" in "firstScreenMap" to null, indicating the end of monitoring;

[0088] Step 17: define the upload page first screen time method in the acquisition unit 2, and call the upload page first screen time interface;

[0089] Step 18: Use the @FormUrlEncoded annotation to indicate that the interface uses form encoding.

[0090] Step 19. Use the @POST annotation to specify the relative path of the request as "performance / page".

[0091] Step 20, define a suspend method named "page" that accepts three parameters: "type", "during" and "page";

[0092] Step 21: Use the @Field annotation to identify each parameter and specify its corresponding field name;

[0093] Step 22: The method returns a suspend-modified Response <int>Object, used to asynchronously process the response to the page upload request;

[0094] Step 23: When the server receives the request from the interface, it writes the parameters into the database;

[0095] Step 24. In the visualization project, use the st.title method to set the page title to 'Page Experience';

[0096] Step 25: Get the page performance data by calling the table('page') method and create a data frame using pd.DataFrame.

[0097] Step 26: Define a list of column names including table headers as columns of the data frame;

[0098] Step 27: Use GridOptionsBuilder to create a grid configuration from the data frame, configure automatic paging and adjust column width;

[0099] Step 28: Create an Ag-Grid component to display page performance data and pass the data frame and grid configuration to the Ag-Grid component.

[0100] In step 29, through the method described in the embodiment, a user interface can be built in the Web application to intuitively display the page performance data uploaded by the mobile application.

[0101] The advantages or beneficial effects of adopting the above technical solution are: the present invention proposes to use the loading time of the first asynchronous callback as a prerequisite for obtaining page information, avoiding errors caused by incomplete asynchronous operations in traditional methods, improving the accuracy of page loading performance evaluation, and thus better guiding performance optimization.

[0102] The above are only preferred embodiments of the present invention, and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should be aware that all solutions obtained by equivalent substitutions and obvious changes made using the contents of this specification and illustrations should be included in the protection scope of the present invention.< / int>

Claims

1. A method for monitoring the first screen time of an application page, characterized in that: include: Step S1, obtaining the time taken from page initialization to completion of the first asynchronous callback, and determining whether the time taken exceeds a preset time threshold; Step S2, when it is determined that the time consumption exceeds the preset time threshold, obtaining page information of a preset position of the application, and using a collection thread to collect operation records of the application and the terminal; Step S3, performing aggregate analysis on the page information and the operation record to obtain time-consuming data from page initialization of the application to completion of the first asynchronous callback.

2. The method for monitoring the first screen time of an application page according to claim 1, characterized in that: Before step S1, the following steps are also included: Place the embed point at the initialization position of the page; Place a tracking point at the location where the first asynchronous callback on the page is completed.

3. The method for monitoring the first screen time of an application page according to claim 2, characterized in that: In step S2, the page information of the preset location of the application is obtained using the embedding point.

4. The method for monitoring the first screen time of an application page according to claim 1, characterized in that: The page information includes one or more combinations of the initialization time of the page, the time when the first asynchronous callback of the page is completed, the class of the page, and the thread of the page.

5. The method for monitoring the first screen time of an application page according to claim 1, characterized in that: The operation record includes one or more combinations of the user's device system version and device model.

6. The method for monitoring the first screen time of an application page according to claim 1, characterized in that: The step S3 comprises: The page information and the operation record are aggregated and analyzed, and the time taken to complete the first asynchronous callback of the page is subtracted from the initialization time of the page to obtain the time-consuming data from the initialization of the application page to the completion of the first asynchronous callback.

7. A monitoring device for the first screen time of an application page, characterized in that: The method for monitoring the first screen time of an application page according to any one of claims 1 to 6 comprises: A monitoring unit, used to obtain the time taken from page initialization to the completion of the first asynchronous callback, and determine whether the time taken exceeds a preset time threshold; A collection unit, connected to the monitoring unit, for obtaining page information of a preset position of the application when it is determined that the time consumption exceeds the preset time threshold, and collecting the operation records of the application and the terminal by using a collection thread; A processing unit is connected to the collection unit and is used to perform aggregate analysis on the page information and the operation record to obtain time-consuming data from page initialization of the application to completion of the first asynchronous callback.

8. The monitoring device for the first screen time of an application page according to claim 7, characterized in that: Also includes: The tracking unit is used to track the page at the initialization position and when the first asynchronous callback of the page is completed.

9. The monitoring device for the first screen time of an application page according to claim 8, characterized in that: The acquisition unit uses the embedding point to obtain page information of a preset location of the application.

10. The monitoring device for the first screen time of an application page according to claim 7, characterized in that: The page information includes one or more combinations of the initialization time of the page, the time when the first asynchronous callback of the page is completed, the class of the page, and the thread of the page.