A flutter-based automatic burying method, device, equipment and medium

By creating route observers and click event managers within the Flutter development framework, global automated event tracking is achieved, solving the problem of insufficient event tracking data collection, improving event tracking efficiency and accuracy, supporting operational data statistics and APP optimization, and ensuring stable system performance.

CN122633182APending Publication Date: 2026-08-25SHANGHAI GANGLIAN E COMMERCE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610983637.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-03
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

Within the Flutter development framework, automated event tracking solutions are relatively scarce, resulting in inadequate event tracking data collection and processing, which affects product optimization and user experience.

Method used

By creating route observers and click event managers, we can achieve automated tracking of route changes and click events globally. Combined with tracking configuration files and widget encapsulation, we can automatically identify and upload page browsing and click event information, and ensure system stability through tracking performance monitoring.

Benefits of technology

It enables automated event tracking for page views and clicks, improving tracking efficiency and accuracy, reducing development resource investment, supporting operational data statistics and APP optimization, and ensuring stable system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122633182A_ABST
    Figure CN122633182A_ABST
Patent Text Reader

Abstract

The application discloses a flutter-based automatic burying point method and device, equipment and medium, including: step one, carrying out page browsing automatic burying point, including: creating and registering route observer, defining several methods through route observer; creating burying point configuration file, setting page browsing related configuration parameters; configuring the route parameters of each page; calling several methods when the route changes, obtaining page browsing events through several methods; step two, carrying out click event burying point, including: creating click event manager, encapsulating the custom Widget, obtaining DMTrackWidget, wrapping DMTrackWidget, and intercepting the click event of the Widget; creating a burying point configuration file, setting click event related configuration parameters; creating a click event class; setting the object of the click event for the Widget; in the click event intercepted by the click event manager, finding the corresponding Widget by traversing, obtaining click event information and uploading to the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of mobile application development, and in particular to an automatic event tracking method, apparatus, device, and medium based on Flutter. Background Technology

[0002] With the continuous development of mobile application development technology, more and more development languages ​​and frameworks have emerged in the market. In addition to mainstream Android and iOS mobile development technologies, more and more cross-platform development frameworks have become popular and widely used. Among them, the Flutter development framework stands out from other cross-platform development frameworks with its excellent performance, hot reload, and multi-platform consistency, becoming the most popular cross-platform mobile development framework among enterprises and developers.

[0003] However, compared to the long-standing and mature automated event tracking technologies of Android and iOS, Flutter's automated event tracking solutions are relatively scarce and inadequate. The main reason is that Dart in Flutter has limited support for Runtime reflection. The collection and processing of event tracking data is particularly important for optimizing products or providing data support for operations. Product operations departments, data statistics departments, and other related departments need to clearly understand user behavior during app operations, including but not limited to data such as access count, dwell time, number of visitors, page views, and click-through rate, in order to achieve the goals of continuous app optimization and improving user experience. Therefore, how to complete the collection and processing of event tracking data within the Flutter development framework is the fundamental problem that this invention aims to solve. Summary of the Invention

[0004] In order to collect and process event tracking data within the Flutter development framework, this application provides an automatic event tracking method, apparatus, device, and medium based on Flutter.

[0005] Firstly, this application provides an automatic event tracking method based on Flutter, employing the following technical solution: An automatic event tracking method based on Flutter, including: Create and register route observers, and define several methods through route observers; create a tracking configuration file and set page browsing related configuration parameters; Configure the routing parameters for each page; Several methods are invoked when the route changes, and page browsing events are obtained through these methods.

[0006] Optionally, it also includes: Create a click event manager, encapsulate the custom Widget, obtain DMTrackWidget, wrap the DMTrackWidget, and intercept the click events of the Widget; Create a configuration file for tracking points and set the relevant configuration parameters for click events; Create a click event class; The object on which a click event is set for a Widget; In the click events intercepted by the click event manager, the corresponding Widget is found by traversing the event, the click event information is obtained and uploaded to the server.

[0007] Optionally, several methods include the didPush method and the didPop method; The `didPop` method is called when a route is popped from the navigator, and the `didPush` method is called when a new route is pushed to the navigator. When the didPop method is called, the parameters of the route being pushed out are obtained and the page view event is uploaded; When the didPush method is called, the previous page route parameters for the new page are set, and the previous page browsing event is uploaded.

[0008] Optionally, the process of intercepting click events of a Widget includes: Wrap DMTrackWidget with RawGestureDetector, and set the gesture recognition property of RawGestureDetector to a custom DMTapGestureRecognizer that inherits from TapGestureRecognizer; override rejectGesture in DMTapGestureRecognizer and intercept all click events through rejectGesture. The process of obtaining click event information includes: Based on the one-to-one correspondence between Widgets and Elements, the Element tree of the clicked event object is recursively traversed upwards and downwards. The key type of the Widget corresponding to each Element is compared. If the key type is a custom ObjectKey, it is determined that the Widget corresponding to the Element is a click event tracking control, the recursive traversal is stopped, and the click event information configured in the ObjectKey is retrieved.

[0009] Optionally, the method further includes: Step 3: Obtain the execution process data and system operation data of the tracking points, monitor the performance status of the tracking points based on the execution process data and system operation data, and judge the performance of the tracking points based on the monitoring results; The data for the execution process of the data points includes the frequency of data points and the data size of each data point. The system operating data includes CPU usage curves and memory usage curves; The process of monitoring the performance status of embedded points includes: Based on the data from the data collection process, obtain the curve of the predicted number of successful data collection points over time under the system's preset state; obtain the curve of the actual cumulative number of successful data collection points over time under the system's preset state; The quality score of the embedding points is obtained by using the curves showing the predicted number of successful embedding points over time and the curves showing the actual cumulative number of successful embedding points over time. The quality score of the correlation coefficient is compared with a preset threshold, and it is also determined whether the system operation data has reached the preset system state. If the quality score is greater than or equal to the preset threshold, the performance status of the data collection point is considered to be normal. If the quality score is less than the preset threshold and the system operation data does not reach the preset system state, the tracking point identification is judged to be abnormal. If the quality score is less than the preset threshold and the system operation data reaches the preset system state, it is determined that the complexity of the data points is too high, resulting in abnormal performance.

[0010] Optionally, the process of obtaining the curve of predicted success rate of data collection over time includes: Under the system's preset conditions, test the processing time of data collection tasks with different data collection frequency ranges and different data collection sizes, and establish a comparison table; Based on the average frequency and average size of the data points, the predicted processing time tp of the data point task per unit time is obtained according to the reference table. A plane coordinate system is established with time as the x-axis and the number of successful data points as the y-axis. The coordinate points (max{tp, ts}, np) corresponding to each unit time are connected to obtain the curve of the predicted number of successful data points changing with time. Here, ts is the unit time, max{tp, ts} represents the maximum value between tp and ts, and np is the number of data point tasks per unit time. The calculation process of the tracking point quality score includes: obtaining several time points before the current time point, calculating the accuracy index, stability index and correlation coefficient based on the predicted tracking point success rate and the actual tracking point success rate corresponding to the several time points, and using the weighted sum of the accuracy index, stability index and correlation coefficient as the tracking point quality score.

[0011] Optionally, the process of determining whether the system operating data has reached the system preset state includes: Determine whether the maximum value of the CPU usage curve has reached the preset CPU usage space in the system's default state, and whether the maximum value of the memory usage curve has reached the preset memory usage space in the system's default state. If any one of them is true, then the system operating data is determined to have reached the system preset state; Otherwise, it is determined that the system's operating data has not reached the system's preset state.

[0012] Secondly, this application provides an automatic event tracking device based on Flutter, which adopts the following technical solution: An automatic event tracking device based on Flutter, wherein the device runs a program of any one of the above-described automatic event tracking methods based on Flutter.

[0013] Thirdly, this application provides an automatic event tracking device based on Flutter, employing the following technical solution: An automatic event tracking device based on Flutter includes a processor, wherein the processor runs a program of an automatic event tracking method based on Flutter as described in any one of the above.

[0014] Fourthly, this application provides an automatic event tracking medium based on Flutter, employing the following technical solution: An automatic event tracking medium based on Flutter, wherein the program stores an automatic event tracking method based on Flutter as described in any one of the above.

[0015] In summary, this application includes at least one of the following beneficial technical effects: This invention enables automated event tracking for page browsing. The automated tracking globally monitors route changes, and page configuration information is stored in a unified page definition. In most scenarios, simply configuring page parameters in the page definition is sufficient. Subsequent page navigation automatically identifies, records, and uploads event tracking information. This solution significantly improves tracking efficiency and accuracy, while also being easy to maintain. Only the relevant page parameters in the page definition need to be changed, greatly reducing the resource investment required for tracking. Developers can typically complete page and click event tracking with just one line of code through simple configuration. These advantages allow developers to focus more on business-related functions, enabling them to complete tracking quickly and accurately while excelling in development. The collected tracking information can be used by the operations department for various data statistics and user behavior analysis, which in turn greatly benefits app function optimization. This solution addresses the problems of large code intrusion and high maintenance costs associated with traditional manual tracking in Flutter. Attached Figure Description

[0016] Figure 1 This is a flowchart of the automatic event tracking method based on Flutter in this invention.

[0017] Figure 2 This is a schematic diagram illustrating the principle of automated tracking points for page browsing in this invention.

[0018] Figure 3 This is a logic diagram illustrating the principle of click event tracking in this invention. Detailed Implementation

[0019] The embodiments of this application are described in detail below, and examples of the embodiments are shown in the accompanying drawings.

[0020] In the description of this specification, the references to "certain embodiments," "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples" refer to specific features, structures, materials, or characteristics described in connection with the described embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0021] This application discloses an automatic event tracking method based on Flutter, referring to... Figures 1-2 This document outlines the process for automating page browsing event tracking, including: creating and registering route observers, defining several methods through these observers; creating a tracking configuration file and setting page browsing-related configuration parameters; where route observers are created by inheriting the NavigatorObserver class, an abstract class capable of defining various methods, including the didPush and didPop methods; calling several methods when routes change to obtain page browsing events; for example, calling the didPop method when a route pops out of the navigator, retrieving the parameters of the popped route and uploading the page browsing event; calling the didPush method when a new route is pushed to the navigator, setting the previous page's route parameters and uploading the previous page's browsing event; and configuring parameters for each page in the route registration for each page in the routing management process, allowing for easy retrieval of the popped page information from the registered route parameters when a page is pushed in or out.

[0022] Furthermore, this embodiment utilizes a custom GetX-based global state manager to record global variables, such as the time of page entry. This time variable is primarily used to calculate page dwell time. It also tracks page parameter settings for tab functionality, mainly to switch routing levels when switching tabs, ensuring accurate recording of page browsing outside the routing stack. Through this process, automated page tracking is achieved, with global monitoring of route changes. Page configuration information is stored in a unified page definition. In most scenarios, configuring page parameters in the page definition is sufficient; subsequent page navigation automatically identifies, records, and uploads tracking information. This solution significantly improves tracking efficiency and accuracy while being easy to maintain—simply changing the relevant page parameter configurations in the page definition. This solves the problems of significant code intrusion and high maintenance costs associated with traditional manual tracking in Flutter.

[0023] Additionally, refer to Figure 1 , Figure 3 This embodiment also provides a method for tracking click events, including: creating a click event manager, encapsulating a custom Widget to obtain a DMTrackWidget, wrapping the DMTrackWidget, and intercepting the Widget's click events; this process wraps the DMTrackWidget with a RawGestureDetector, and sets the gesture recognition property of the RawGestureDetector to a custom DMTapGestureRecognizer that inherits from TapGestureRecognizer; indicating that this control will recognize the custom gesture DMTapGestureRecognizer, and overriding rejectGesture in the DMTapGestureRecognizer, through r ejectGesture intercepts all click events; creates a tracking configuration file and sets the relevant configuration parameters for click events; creates a click event class; sets the click event object for the Widget; in the click events intercepted by the click event manager, it iterates through the corresponding Widget, obtains the click event information, and uploads it to the server. This process is based on the one-to-one correspondence between Widget and Element, recursively traversing the Element tree of the click event object upwards and downwards, comparing the key type of the Widget corresponding to each Element. If the key type is a custom ObjectKey, it determines that the Widget corresponding to the Element is a click event tracking control, stops the recursive traversal, and retrieves the click event information configured in the ObjectKey, thus achieving the acquisition of click event information.

[0024] It should be noted that for complex nested Widget trees containing multiple ObjectKeys, the recursive traversal is exited and the click event tracking information is uploaded when the first ObjectKey is hit, following the principle of proximity. With the above approach, you only need to set the key of the corresponding control to a custom ObjectKey and set the relevant button properties. Then, the click event will automatically hit the marked control and upload the tracking information.

[0025] At the same time, the resource investment required for event tracking is greatly reduced. Developers can usually complete page and click event tracking with just one line of code through simple configuration. These advantages allow developers to have more time and energy to focus on business-related functions. While completing development work well, they can also complete event tracking work quickly and accurately. The information collected by event tracking can be used by the operations department for various data statistics, user behavior analysis, etc., which in turn brings great benefits to the optimization of APP functions.

[0026] In one embodiment, a method for monitoring and judging the performance of data points is also proposed. Step three involves acquiring data on the execution process of data points and system operation data. The data on the execution process of data points includes the frequency of data points and the data size of each data point. The system operation data includes CPU usage curves and memory usage curves. The performance status of data points is monitored based on the data on the execution process of data points and the system operation data. The performance of data points is judged based on the monitoring results. The above scheme can judge the rationality of the data point process and ensure the smoothness of the system after it runs.

[0027] The process of monitoring the performance status of the tracking points includes: obtaining the predicted tracking success rate curve np(t) over time under the system preset state based on the tracking point execution process data; and obtaining the actual cumulative tracking success rate curve na(t) over time under the system preset state. Factors that significantly affect application performance include tracking point frequency, the amount of data collected by the tracking points, system performance, and network status. In this embodiment, the system performance and network status are kept consistent during the testing process, i.e., the test is conducted under the system preset state, which is a system environment with reserved preset CPU space, reserved preset memory space, strong network environment, and preset transmission performance.

[0028] Meanwhile, the process of obtaining the curve np(t) of the predicted number of successful data points over time includes: testing the processing time of data point tasks with different data point frequencies and different data point sizes under the system's preset state, and establishing a comparison table. The table above is the reference table established in this embodiment. Based on the range of the average frequency of the tracking points and the range of the average size of the tracking point data, the predicted processing time tp of the tracking point task per unit time is obtained according to the reference table. A plane coordinate system is established with time as the x-axis and the tracking point success rate as the y-axis. The coordinate points (max{tp, ts}, np) corresponding to each unit time are connected to obtain the curve np(t) of the predicted tracking point success rate changing with time. Here, ts is the unit time, max{tp, ts} represents the maximum value between tp and ts, and np is the tracking point task quantity per unit time. When the predicted processing time per unit time exceeds the unit time, the curve will be delayed. Through the above adjustment of the points, the obtained curve np(t) of the predicted tracking point success rate changing with time can accurately predict the tracking point success rate.

[0029] The tracking quality score R is obtained based on the predicted success rate of tracking points over time (np(t)) and the actual cumulative success rate of tracking points over time (na(t)). The calculation process includes: selecting W time points before the current time point t; and using the formula... Calculate and obtain the accuracy index A; where, The attenuation factor has a value range of (0, 1], and is set to 0.9 in this embodiment. By introducing the attenuation factor, more weight can be given to recent data, thereby more accurately judging the absolute error status of the successful data collection.

[0030] Then, the mean values ​​of na(t) and np(t) at W time points are obtained respectively. , and variance , Through formula Calculate the stability index S; where, , , To prevent positive numbers from being divided by zero, its value is set to 1 × 10^(-6); therefore, the stability index S considers the volatility of the actual curve itself and the difference between its volatility and that of the predicted curve, where, Measuring the difference between actual and predicted volatility patterns It is to punish excessive fluctuations in the actual curve itself. The exponential model is used for numerical normalization, and the obtained stability index S has a value range of (0, 1).

[0031] Finally, the Pearson correlation coefficients of the corresponding values ​​of na(t) and np(t) at W time points are calculated. The weighted sum of the accuracy index A, stability index S, and Pearson correlation coefficients is used as the tracking point quality score R. The corresponding weights are set according to historical data. In this embodiment, the weight ratio is 2:4:4. Since there is an error in the number of successes in the test results, the focus is on stability and correlation factors. The obtained tracking point quality score R can realize the quality judgment of the tracking point status from the perspectives of accuracy, stability, and trend consistency.

[0032] Next, the data tracking quality score R is compared with a preset threshold. At the same time, it is determined whether the system operation data has reached the system preset state. The preset threshold is set according to the allowable error. The process of determining whether the system operation data has reached the system preset state includes: determining whether the maximum value of the CPU usage curve has reached the preset CPU usage space in the system preset state, and whether the maximum value of the memory usage curve has reached the preset memory usage space in the system preset state. If either one is yes, then the system operation data is determined to have reached the system preset state; otherwise, the system operation data is determined not to have reached the system preset state.

[0033] During the comparison process, if the tracking quality score R ≥ the preset threshold, it indicates that the tracking quality is high, meaning the actual cumulative successful tracking amount over time curve na(t) follows the preset result, thus indicating that the tracking performance is normal. If the tracking quality score R < the preset threshold and the system operation data does not reach the system preset state, it indicates that the actual cumulative successful tracking amount over time curve na(t) does not follow the predicted result and the system preset state is fully occupied, thus indicating that the tracking identification is abnormal. If the tracking quality score R < the preset threshold and the system operation data reaches the system preset state, it indicates that the system performance is too high, causing the actual cumulative successful tracking amount over time curve na(t) to not follow the predicted result, thus indicating that the tracking data complexity is too high, leading to abnormal performance. Through the above judgment process, the performance status of the tracking operation process can be judged more accurately before the application goes live, ensuring the stability of the application after it goes live.

[0034] This application also discloses an automatic event tracking device based on Flutter, which runs a program of the above-described automatic event tracking method based on Flutter.

[0035] This application also discloses an automatic event tracking device based on Flutter, including a processor in which a program for the above-described automatic event tracking method based on Flutter is running.

[0036] This application also discloses an automatic event tracking medium based on Flutter, which stores a program for the aforementioned automatic event tracking method based on Flutter.

[0037] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. An automatic event tracking method based on Flutter, characterized in that, include: Create and register route observers, and define several methods through route observers; create a tracking configuration file and set page browsing related configuration parameters; Configure the routing parameters for each page; Several methods are invoked when the route changes, and page browsing events are obtained through these methods.

2. The automatic event tracking method based on Flutter according to claim 1, characterized in that, Also includes: Create a click event manager, encapsulate the custom Widget, obtain DMTrackWidget, wrap the DMTrackWidget, and intercept the Widget's click events; Create a configuration file for tracking points and set the configuration parameters related to click events; Create a click event class; The object on which a click event is set for a Widget; In the click events intercepted by the click event manager, the corresponding Widget is found by traversing the event, the click event information is obtained and uploaded to the server.

3. The automatic event tracking method based on Flutter according to claim 2, characterized in that, Several methods are available, including the didPush and didPop methods; The `didPop` method is called when a route is popped from the navigator, and the `didPush` method is called when a new route is pushed to the navigator. When the didPop method is called, the parameters of the route being pushed out are obtained and the page view event is uploaded; When the didPush method is called, the previous page route parameters for the new page are set, and the previous page browsing event is uploaded.

4. The automatic event tracking method based on Flutter according to claim 3, characterized in that, The process of intercepting click events of a Widget includes: Wrap DMTrackWidget with RawGestureDetector, and set the gesture recognition property of RawGestureDetector to a custom DMTapGestureRecognizer that inherits from TapGestureRecognizer; override rejectGesture in DMTapGestureRecognizer and intercept all click events through rejectGesture. The process of obtaining click event information includes: Based on the one-to-one correspondence between Widgets and Elements, the Element tree of the clicked event object is recursively traversed upwards and downwards. The key type of the Widget corresponding to each Element is compared. If the key type is a custom ObjectKey, it is determined that the Widget corresponding to the Element is a click event tracking control, the recursive traversal is stopped, and the click event information configured in the ObjectKey is retrieved.

5. The automatic event tracking method based on Flutter according to claim 4, characterized in that, The method further includes: Step 3: Obtain the execution process data and system operation data of the tracking points, monitor the performance status of the tracking points based on the execution process data and system operation data, and judge the performance of the tracking points based on the monitoring results; The data for the execution process of the data points includes the frequency of data points and the data size of each data point. The system operating data includes CPU usage curves and memory usage curves; The process of monitoring the performance status of embedded points includes: Based on the data from the data collection process, obtain the curve of the predicted number of successful data collection points over time under the system's preset state; obtain the curve of the actual cumulative number of successful data collection points over time under the system's preset state; The quality score of the embedding points is obtained by using the curves showing the predicted number of successful embedding points over time and the curves showing the actual cumulative number of successful embedding points over time. The quality score of the correlation coefficient is compared with a preset threshold, and it is also determined whether the system operation data has reached the preset system state. If the quality score is greater than or equal to the preset threshold, the performance status of the data collection point is considered to be normal. If the quality score is less than the preset threshold and the system operation data does not reach the preset system state, the tracking point identification is judged to be abnormal. If the quality score is less than the preset threshold and the system operation data reaches the preset system state, it is determined that the complexity of the data points is too high, resulting in abnormal performance.

6. The automatic event tracking method based on Flutter according to claim 5, characterized in that, The process of obtaining the curve of the predicted success rate of data tracking over time includes: Under the system's preset conditions, test the processing time of data collection tasks with different data collection frequency ranges and different data collection sizes, and establish a comparison table; Based on the average frequency and average size of the data points, the predicted processing time tp of the data point task per unit time is obtained according to the reference table. A plane coordinate system is established with time as the x-axis and the number of successful data points as the y-axis. The coordinate points (max{tp, ts}, np) corresponding to each unit time are connected to obtain the curve of the predicted number of successful data points changing with time. Here, ts is the unit time, max{tp, ts} represents the maximum value between tp and ts, and np is the number of data point tasks per unit time. The calculation process of the tracking point quality score includes: obtaining several time points before the current time point, calculating the accuracy index, stability index and correlation coefficient based on the predicted tracking point success rate and the actual tracking point success rate corresponding to the several time points, and using the weighted sum of the accuracy index, stability index and correlation coefficient as the tracking point quality score.

7. The automatic event tracking method based on Flutter according to claim 5, characterized in that, The process of determining whether the system's operating data has reached the system's preset state includes: Determine whether the maximum value of the CPU usage curve has reached the preset CPU usage space in the system's default state, and whether the maximum value of the memory usage curve has reached the preset memory usage space in the system's default state. If any one of them is true, then the system operating data is determined to have reached the system preset state; Otherwise, it is determined that the system's operating data has not reached the system's preset state.

8. An automatic event tracking device based on Flutter, characterized in that, The device runs a program of an automatic event tracking method based on Flutter as described in any one of claims 1-7.

9. An automatic event tracking device based on Flutter, characterized in that, The device runs a program of an automatic event tracking method based on Flutter as described in any one of claims 1-7.

10. An automatic event tracking medium based on Flutter, characterized in that, The medium stores a program for an automatic event tracking method based on Flutter as described in any one of claims 1-7.