A method and system for reporting buried point data, a computer device and a medium
By caching and batch encapsulating messages between the main business thread and the secondary thread, the response delay caused by data tracking reporting was resolved, improving the timeliness of the system platform and the user experience.
Patent Information
- Application Number
- CN202310281242.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-14
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2043-03-14
AI Technical Summary
In existing technologies, when a user triggers a business function on the front-end web page, the need to process the data tracking and reporting operations causes a delay in the business function response, reducing the timeliness of the system platform.
By monitoring the event tracking messages generated by the main business thread in real time and caching them in the target queue of the event tracking sub-thread, the target thread is built using the HTML5 Web Workers framework. Data packets are then batch-encapsulated and reported to the server, avoiding the main thread from processing event tracking messages and improving system timeliness.
This effectively avoids response delays caused by the main business thread processing event tracking messages, improving the timeliness of the system platform and enhancing the user experience.
Smart Images

Figure CN116166507B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, system, computer equipment, and medium for reporting embedded data. Background Technology
[0002] Event tracking refers to collecting information within specific processes of an application (APP) to track its usage. This information can then be used to further optimize the product or provide operational data support. Event tracking can be used to collect information such as the number of visits, visitors, dwell time, page views, and bounce rate.
[0003] Currently, there are many data collection solutions in the industry, including visual event tracking and no-code event tracking. Visual event tracking requires selection, while no-code event tracking saves the XPath of all user clicks and then sends it to the backend for analysis. Currently, the front-end web function page only has a business thread for processing. When a user triggers a related business function, the business thread needs to process the event tracking report first, which causes a response delay for the user-triggered business function, thus reducing the timeliness of the system platform. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, system, computer equipment, and medium for reporting embedded data to address the issue of low timeliness of the system platform.
[0005] A method for reporting event tracking data includes: real-time monitoring and acquisition of event tracking messages generated by the main business thread to obtain the event tracking messages of the main business thread; caching the event tracking messages of the main business thread into the target queue of the event tracking sub-thread according to the message identifier of the event tracking messages; wherein, the main business thread is the thread used to process system business functions, and the event tracking sub-thread is the thread used to process event tracking data; and according to the queue status of the target queue, the event tracking messages of the target queue are batch-encapsulated into event tracking data packets, and the event tracking data packets are reported to the server.
[0006] In one embodiment, before real-time monitoring and acquisition of the event tracking messages generated by the main business thread, the process further includes: constructing a target thread using the HTML5 Web Workers framework; defining an array object; integrating the array object with the target thread to obtain an event tracking sub-thread; and merging the event tracking sub-thread into the web page of the current system.
[0007] In one embodiment, the method further includes: real-time monitoring and acquisition of the instrumentation messages generated by the main business thread, and obtaining the instrumentation messages of the main business thread, including: when a message sending instruction generated by the main business thread is detected, receiving a message sent from the main business thread based on the message sending instruction; creating a passive message identifier; and encapsulating the passive message identifier with the message received from the main business thread to obtain the instrumentation messages of the main business thread.
[0008] In one embodiment, real-time monitoring and acquisition of instrumentation messages generated by the main business thread to obtain the main business thread instrumentation messages includes: when a message destruction instruction is detected from the main business thread, calling the message reading service set on the main business thread based on the message destruction instruction; creating an active message identifier; acquiring the instrumentation message from the response of the message reading service; and encapsulating the active message identifier and the instrumentation message from the response of the message reading service to obtain the main business thread instrumentation messages.
[0009] In one embodiment, caching the main thread's event tracking messages into the target queue of the secondary thread based on the message identifier of the main thread's event tracking messages includes: when the message identifier of the main thread's event tracking messages is a passive message identifier, analyzing the number of target elements corresponding to the monitored event tracking messages; determining the number of storage positions in the target queue of the secondary thread; when the number of target elements is greater than the number of storage positions, creating multiple linked list elements based on the number of target elements; inserting the multiple linked list elements into the tail of the target queue pointed to by the pointer to obtain the target queue after updating the storage position; and saving the monitored event tracking messages into the target queue after updating the storage position.
[0010] In one embodiment, the step of batch encapsulating the tracking messages of the target queue into tracking data packets according to the queue status of the target queue includes: when the queue status of the target queue is not idle, sampling the data in the target queue one by one to obtain sampled data; batch encapsulating the sampled data to obtain tracking data packets; or, when the queue status of the target queue is idle, continuing to execute the step of caching the tracking messages of the main business thread to the target queue of the tracking sub-thread according to the message identifier of the tracking messages of the main business thread.
[0011] In one embodiment, the method further includes: calculating the number of elements in the target queue; determining the queue state of the target queue to be non-idle when the number of elements in the target queue is greater than or equal to a preset threshold; or determining the queue state of the target queue to be idle when the number of elements in the target queue is less than the preset threshold.
[0012] A data reporting system for event tracking includes: a data tracking message listening and acquisition module, used to listen for and acquire data tracking messages generated by the main business thread in real time, and obtain the data tracking messages of the main business thread; a data tracking message caching module, used to cache the data tracking messages of the main business thread into the target queue of the secondary tracking thread according to the message identifier of the data tracking messages; wherein, the main business thread is the thread used to process system business functions, and the secondary tracking thread is the thread used to process data tracking data; and a data tracking message encapsulation and reporting module, used to encapsulate the data tracking messages of the target queue into data tracking data packets in batches according to the queue status of the target queue, and report the data tracking data packets to the server.
[0013] A computer device includes a memory and a processor. The memory stores computer-readable instructions, which, when executed by the processor, cause the processor to perform the steps of the above-described method for reporting embedded data.
[0014] A medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the above-described method for reporting embedded data.
[0015] The aforementioned method, system, device, and medium for reporting event tracking data involve the event tracking data reporting system first listening to and acquiring event tracking messages generated by the main business thread in real time. Then, based on the message identifier of the main business thread's event tracking messages, the system caches these messages in the target queue of the event tracking sub-thread. The main business thread handles system business functions, while the event tracking sub-thread handles event tracking data. Finally, based on the queue status of the target queue, the event tracking messages in the target queue are batch-encapsulated into event tracking data packets, which are then reported to the server. Because this application caches the main business thread's event tracking messages in the target queue of the event tracking sub-thread, the processing of event tracking messages is handled exclusively by the sub-thread, thus avoiding response delays in user-triggered business functions caused by the main business thread processing event tracking messages, and improving the timeliness of the system platform. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0017] Figure 1 This is a diagram illustrating the implementation environment of the data reporting method for embedded data points provided in one embodiment of this application.
[0018] Figure 2 This is a schematic diagram of the internal structure of a computer device in one embodiment of this application;
[0019] Figure 3This is a schematic diagram of a method for reporting embedded data in one embodiment of this application;
[0020] Figure 4 This is a schematic diagram of another method for reporting embedded data provided in one embodiment of this application;
[0021] Figure 5 This is a schematic diagram of the system structure of a data reporting system based on embedded data provided in an embodiment of this application. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0023] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another.
[0024] Figure 1 This is a diagram illustrating the implementation environment of the data reporting method provided in one embodiment, such as... Figure 1 As shown, this implementation environment includes a server 110 and a client 120.
[0025] Server 110 can be a server, specifically a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. For example, it could be a server device storing event tracking data packets. Client 120 listens in real-time and obtains event tracking messages generated by the main business thread. After obtaining these messages, Client 120 caches them in the target queue of the secondary event tracking thread based on the message identifier. The main business thread handles system business functions, while the secondary thread handles event tracking data. Client 120 batches the event tracking messages in the target queue into event tracking data packets based on the queue status and reports these data packets to Server 110.
[0026] It should be noted that the client 120 can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these. The server 110 and the client 120 can connect via Bluetooth, USB (Universal Serial Bus), or other communication connection methods, which are not limited in this invention.
[0027] Figure 2 This is a schematic diagram of the internal structure of a computer device in one embodiment. For example... Figure 2 As shown, the computer device includes a processor, media, memory, and network interface connected via a system bus. The media of the computer device stores an operating system, a database, and computer-readable instructions. The database may store control information sequences. When the computer-readable instructions are executed by the processor, they enable the processor to implement a method for reporting embedded data. The processor of the computer device provides computing and control capabilities to support the operation of the entire device. The memory of the computer device may store computer-readable instructions, which, when executed by the processor, enable the processor to execute a method for reporting embedded data. The network interface of the computer device is used for communication with a terminal. Those skilled in the art will understand that… Figure 2 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. A specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. The medium is a readable storage medium.
[0028] The following will be combined with the appendix Figure 3-4 This application provides a detailed description of the method for reporting event tracking data provided in its embodiments. This method can be implemented using a computer program and can run on an event tracking data reporting system based on the von Neumann architecture. This computer program can be integrated into an application or run as a standalone utility application.
[0029] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0030] Foundational artificial intelligence technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, large-scale data reporting technology, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0031] Please see Figure 3 The above is a flowchart illustrating a method for reporting embedded data in an embodiment of this application.
[0032] like Figure 3 As shown, the method in this application embodiment may include the following steps:
[0033] S101, listens for and obtains the event tracking messages generated by the main business thread in real time, and obtains the event tracking messages of the main business thread;
[0034] In this context, a thread is the smallest unit of computation that the operating system can schedule; each thread is used to execute different tasks. The main business thread is used to handle system business functions.
[0035] In this embodiment, before real-time monitoring and acquisition of the event tracking messages generated by the main business thread, it is necessary to construct a secondary event tracking thread and integrate it into the web page of the current system. First, a target thread is constructed using the HTML5 Web Workers framework, then an array object is defined, and then the array object is integrated with the target thread to obtain the secondary event tracking thread. Finally, the secondary event tracking thread is integrated into the web page of the current system.
[0036] Specifically, the HTML5 Web Workers framework is a front-end framework. Web Workers are JavaScript running in the background, independent of other scripts, and do not affect page performance. Using Web Workers to build a secondary thread for event tracking avoids impacting the responsiveness of business functions by having the main business thread report event data. By integrating a queue cache into the secondary thread built with Web Workers, batch reporting of event data can be performed, which significantly alleviates server and network transmission pressure.
[0037] In one possible implementation, when listening for and acquiring the event tracking messages generated by the main business thread in real time, the process begins by receiving the message sent by the main business thread upon receiving a message sending command. Then, a passive message identifier is created, and finally, the passive message identifier is encapsulated with the received message to obtain the event tracking message. For example, a user triggers a business function on the system's front-end page. The event tracking function then runs, collecting information and generating event tracking data in real time. It also sends a message sending command from the main business thread to the listener. When the listener receives this command, it receives the message passively. Therefore, a passive message identifier is created to mark the message, and the event tracking message is obtained after marking.
[0038] In another possible implementation, while real-time monitoring and acquisition of event tracking messages generated by the main business thread, upon receiving a message destruction command from the main business thread, the system first calls the message reading service set up on the main business thread based on the message destruction command. Then, an active message identifier is created, followed by the acquisition of the event tracking message from the message reading service response. Finally, the active message identifier and the event tracking message from the message reading service response are encapsulated to obtain the main business thread event tracking message. For example, when a user triggers the closure of the system front-end page, in order to report the generated event tracking data promptly, upon receiving the message destruction command from the main business thread, the system first calls the message reading service set up on the main business thread based on the message destruction command. Since this message acquisition is active, an active message identifier needs to be created, followed by the acquisition of the event tracking message from the message reading service response. Finally, the active message identifier and the event tracking message from the message reading service response are encapsulated to obtain the main business thread event tracking message.
[0039] S102, cache the main thread's event tracking messages to the target queue of the event tracking sub-thread based on the message identifier of the event tracking messages;
[0040] Among them, the event tracking sub-thread is used to process event tracking data.
[0041] In one possible implementation, when the message identifier of the event tracking message in the main business thread is a passive message identifier, it indicates that the user is currently using the business functions of the operating system. Due to the large amount of event tracking information generated, the event tracking information in this scenario needs to be cached in the target queue of the event tracking sub-thread. First, the number of target elements corresponding to the monitored event tracking messages is analyzed. Then, the number of storage positions in the target queue of the event tracking sub-thread is determined. Next, when the number of target elements is greater than the number of storage positions, multiple linked list elements are created according to the number of target elements. Then, multiple linked list elements are inserted into the tail of the target queue pointed to by the pointer to obtain the target queue after updating the storage position. Finally, the monitored event tracking messages are saved to the target queue after updating the storage position.
[0042] In another possible implementation, when the message identifier of the main business thread's event tracking message is an active message identifier, it means that the user is closing the system's front-end page. In order to report the event tracking data in a timely manner, the event tracking message of the main business thread with the message identifier of an active message identifier needs to be directly reported to the server.
[0043] S103, based on the queue status of the target queue, batch encapsulate the tracking messages of the target queue into tracking data packets, and report the tracking data packets to the server.
[0044] In one possible implementation, when the target queue's event tracking messages are batch-encapsulated into event tracking data packets based on the target queue's queue status, if the target queue's queue status is not idle, the data in the target queue is first sampled one by one to obtain sampled data, and then the sampled data is batch-encapsulated to obtain event tracking data packets.
[0045] In another possible implementation, when the target queue's event tracking messages are batch-encapsulated into event tracking data packets according to the target queue's queue state, if the target queue's queue state is idle, the step of caching the business main thread's event tracking messages into the event tracking sub-thread's target queue according to the message identifier of the business main thread's event tracking messages continues until the queue is non-idle.
[0046] Specifically, when determining the idle state of the target queue, the number of elements in the target queue is first calculated. Then, if the number of elements in the target queue is greater than or equal to a preset threshold, the queue state of the target queue is determined to be non-idle; or, if the number of elements in the target queue is less than the preset threshold, the queue state of the target queue is determined to be idle.
[0047] It should be noted that by using web workers to create new threads, the monitored events and data are sent to the worker thread, and the worker thread reports the event tracking data. This does not block the UI operations of the main thread, thus improving the user experience.
[0048] In this embodiment, the event tracking data reporting system first listens for and obtains event tracking messages generated by the main business thread in real time. Then, based on the message identifier of the main business thread's event tracking messages, it caches these messages in the target queue of the event tracking sub-thread. The main business thread handles system business functions, while the event tracking sub-thread handles event tracking data. Finally, based on the queue status of the target queue, the event tracking messages in the target queue are batch-encapsulated into event tracking data packets, which are then reported to the server. Because this application caches the main business thread's event tracking messages in the target queue of the event tracking sub-thread, the processing of event tracking messages is handled exclusively by the event tracking sub-thread. This avoids response delays in user-triggered business functions caused by the main business thread processing event tracking messages, thus improving the timeliness of the system platform.
[0049] Please see Figure 4 The above is a flowchart illustrating a method for reporting embedded data in an embodiment of this application.
[0050] like Figure 4 As shown, the method in this application embodiment may include the following steps:
[0051] S201, construct the target thread using the HTML5 Web Workers framework;
[0052] S202, Define an array object, integrate the array object with the target thread for processing, and obtain the instrumentation sub-thread;
[0053] S203 integrates the event tracking sub-thread into the current system's web page;
[0054] S204, when a message sending instruction is received from the main business thread, the message sent from the main business thread is received based on the message sending instruction;
[0055] S205, Create a passive message identifier, encapsulate the passive message identifier with the message received from the main business thread to obtain the main business thread's embedded message;
[0056] S206, When the message identifier of the event tracking message in the main business thread is a passive message identifier, analyze the number of target elements corresponding to the event tracking message being listened to.
[0057] S207, determine the number of available storage locations in the target queue of the event tracking sub-thread. When the number of target elements is greater than the number of available storage locations, create multiple linked list elements according to the number of target elements.
[0058] S208: Insert multiple linked list elements into the tail of the target queue pointed to by the pointer to obtain the target queue after updating the storage location, and save the monitored instrumentation messages into the target queue after updating the storage location.
[0059] S209: Based on the queue status of the target queue, the event tracking messages of the target queue are batch encapsulated into event tracking data packets, and the event tracking data packets are reported to the server.
[0060] In this embodiment, the event tracking data reporting system first listens for and obtains event tracking messages generated by the main business thread in real time. Then, based on the message identifier of the main business thread's event tracking messages, it caches these messages in the target queue of the event tracking sub-thread. The main business thread handles system business functions, while the event tracking sub-thread handles event tracking data. Finally, based on the queue status of the target queue, the event tracking messages in the target queue are batch-encapsulated into event tracking data packets, which are then reported to the server. Because this application caches the main business thread's event tracking messages in the target queue of the event tracking sub-thread, the processing of event tracking messages is handled exclusively by the event tracking sub-thread. This avoids response delays in user-triggered business functions caused by the main business thread processing event tracking messages, thus improving the timeliness of the system platform.
[0061] The following are system embodiments of the present invention, which can be used to execute the method embodiments of the present invention. For details not disclosed in the system embodiments of the present invention, please refer to the method embodiments of the present invention.
[0062] Please see Figure 5 This diagram illustrates the structure of a data reporting system for tracking points provided in an exemplary embodiment of the present invention. This data reporting system can be implemented as all or part of a device through software, hardware, or a combination of both. System 1 includes a tracking point message listening and acquisition module 10, a tracking point message caching module 20, and a tracking point message encapsulation and reporting module 30.
[0063] The event tracking and acquisition module 10 is used to listen for and acquire event tracking messages generated by the main business thread in real time, and obtain the event tracking messages of the main business thread.
[0064] The event tracking message caching module 20 is used to cache event tracking messages from the main business thread to the target queue of the event tracking sub-thread based on the message identifier of the event tracking message; wherein,
[0065] The main business thread is used to handle system business functions, while the secondary event tracking thread is used to handle event tracking data.
[0066] The event tracking message encapsulation and reporting module 30 is used to encapsulate the event tracking messages of the target queue into event tracking data packets in batches according to the queue status of the target queue, and report the event tracking data packets to the server.
[0067] It should be noted that the above embodiments of the data reporting system are only illustrated by the division of the functional modules described above when executing the data reporting method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data reporting system and the data reporting method embodiments provided above belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0068] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0069] In this embodiment, the event tracking data reporting system first listens for and obtains event tracking messages generated by the main business thread in real time. Then, based on the message identifier of the main business thread's event tracking messages, it caches these messages in the target queue of the event tracking sub-thread. The main business thread handles system business functions, while the event tracking sub-thread handles event tracking data. Finally, based on the queue status of the target queue, the event tracking messages in the target queue are batch-encapsulated into event tracking data packets, which are then reported to the server. Because this application caches the main business thread's event tracking messages in the target queue of the event tracking sub-thread, the processing of event tracking messages is handled exclusively by the event tracking sub-thread. This avoids response delays in user-triggered business functions caused by the main business thread processing event tracking messages, thus improving the timeliness of the system platform.
[0070] In one embodiment, a computer device is provided, the device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
[0071] Real-time monitoring and acquisition of event tracking messages generated by the main business thread;
[0072] The main business thread's event tracking messages are cached in the target queue of the event tracking sub-thread based on the message identifier of the event tracking messages; where...
[0073] The main business thread is used to handle system business functions, while the secondary event tracking thread is used to handle event tracking data.
[0074] Based on the queue status of the target queue, the event tracking messages of the target queue are batch-encapsulated into event tracking data packets, and the event tracking data packets are reported to the server.
[0075] In one embodiment, before the processor performs real-time listening and retrieves the event tracking messages generated by the main business thread, it also performs the following operations:
[0076] Build the target thread using the HTML5 Web Workers framework;
[0077] Define an array object;
[0078] The array object is integrated with the target thread to obtain the instrumentation sub-thread;
[0079] Integrate the event tracking sub-thread into the current system's web page.
[0080] In one embodiment, the processor performs real-time listening and obtains the event tracking messages generated by the main business thread. When the event tracking messages from the main business thread are obtained, the following operations are performed:
[0081] When a message sending command is received from the main business thread, the message sent from the main business thread is received based on the message sending command.
[0082] Create a passive message identifier;
[0083] The passive message identifier is encapsulated with the message received from the main business thread to obtain the main business thread's instrumentation message.
[0084] In one embodiment, the processor performs real-time listening and obtains the event tracking messages generated by the main business thread. When the event tracking messages from the main business thread are obtained, the following operations are performed:
[0085] When a message destruction command is detected in the main business thread, the message reading service set on the main business thread is invoked based on the message destruction command.
[0086] Create an active message identifier;
[0087] Retrieve the event tracking message from the message reading service response;
[0088] The active message identifier is encapsulated with the instrumentation message from the message reading service response to obtain the instrumentation message for the main business thread.
[0089] In one embodiment, when the processor caches the main business thread's event tracking message into the target queue of the event tracking sub-thread based on the message identifier of the event tracking message, it specifically performs the following operations:
[0090] When the message identifier of the event tracked by the main business thread is a passive message identifier, analyze the number of target elements corresponding to the event tracked by the thread.
[0091] Determine the number of locations that can be stored in the target queue of the event tracking sub-thread;
[0092] When the number of target elements is greater than the number of available storage locations, create multiple linked list elements based on the number of target elements.
[0093] Insert multiple linked list elements into the tail of the target queue pointed to by the pointer to obtain the target queue after updating the storage location;
[0094] Save the monitored event messages to the target queue after updating the storage location.
[0095] In one embodiment, when the processor performs the step-by-step encapsulation of the target queue's event tracking messages into event tracking data packets based on the target queue's queue status, it specifically performs the following operations:
[0096] When the target queue is in a non-idle state, the data in the target queue is sampled one by one to obtain sampled data;
[0097] The sampled data is batch-packaged to obtain the data package containing the data points.
[0098] or,
[0099] When the target queue is in an idle state, continue executing the step of caching the main business thread's event tracking message into the event tracking sub-thread's target queue based on the message identifier of the event tracking message.
[0100] In one embodiment, the processor also performs the following operations:
[0101] Calculate the number of elements in the target queue;
[0102] When the number of elements in the target queue is greater than or equal to a preset threshold, the queue status of the target queue is determined to be non-idle.
[0103] or,
[0104] When the number of elements in the target queue is less than a preset threshold, the queue status of the target queue is determined to be idle.
[0105] In this embodiment, the event tracking data reporting system first listens for and obtains event tracking messages generated by the main business thread in real time. Then, based on the message identifier of the main business thread's event tracking messages, it caches these messages in the target queue of the event tracking sub-thread. The main business thread handles system business functions, while the event tracking sub-thread handles event tracking data. Finally, based on the queue status of the target queue, the event tracking messages in the target queue are batch-encapsulated into event tracking data packets, which are then reported to the server. Because this application caches the main business thread's event tracking messages in the target queue of the event tracking sub-thread, the processing of event tracking messages is handled exclusively by the event tracking sub-thread. This avoids response delays in user-triggered business functions caused by the main business thread processing event tracking messages, thus improving the timeliness of the system platform.
[0106] In one embodiment, a medium storing computer-readable instructions is provided, which, when executed by one or more processors, cause the one or more processors to perform the following steps:
[0107] Real-time monitoring and acquisition of event tracking messages generated by the main business thread;
[0108] The main business thread's event tracking messages are cached in the target queue of the event tracking sub-thread based on the message identifier of the event tracking messages; where...
[0109] The main business thread is used to handle system business functions, while the secondary event tracking thread is used to handle event tracking data.
[0110] Based on the queue status of the target queue, the event tracking messages of the target queue are batch-encapsulated into event tracking data packets, and the event tracking data packets are reported to the server.
[0111] In one embodiment, before the processor performs real-time listening and retrieves the event tracking messages generated by the main business thread, it also performs the following operations:
[0112] Build the target thread using the HTML5 Web Workers framework;
[0113] Define an array object;
[0114] The array object is integrated with the target thread to obtain the instrumentation sub-thread;
[0115] Integrate the event tracking sub-thread into the current system's web page.
[0116] In one embodiment, the processor performs real-time listening and obtains the event tracking messages generated by the main business thread. When the event tracking messages from the main business thread are obtained, the following operations are performed:
[0117] When a message sending command is received from the main business thread, the message sent from the main business thread is received based on the message sending command.
[0118] Create a passive message identifier;
[0119] The passive message identifier is encapsulated with the message received from the main business thread to obtain the main business thread's instrumentation message.
[0120] In one embodiment, the processor performs real-time listening and obtains the event tracking messages generated by the main business thread. When the event tracking messages from the main business thread are obtained, the following operations are performed:
[0121] When a message destruction command is detected in the main business thread, the message reading service set on the main business thread is invoked based on the message destruction command.
[0122] Create an active message identifier;
[0123] Retrieve the event tracking message from the message reading service response;
[0124] The active message identifier is encapsulated with the instrumentation message from the message reading service response to obtain the instrumentation message for the main business thread.
[0125] In one embodiment, when the processor caches the main business thread's event tracking message into the target queue of the event tracking sub-thread based on the message identifier of the event tracking message, it specifically performs the following operations:
[0126] When the message identifier of the event tracked by the main business thread is a passive message identifier, analyze the number of target elements corresponding to the event tracked by the thread.
[0127] Determine the number of locations that can be stored in the target queue of the event tracking sub-thread;
[0128] When the number of target elements is greater than the number of available storage locations, create multiple linked list elements based on the number of target elements.
[0129] Insert multiple linked list elements into the tail of the target queue pointed to by the pointer to obtain the target queue after updating the storage location;
[0130] Save the monitored event messages to the target queue after updating the storage location.
[0131] In one embodiment, when the processor performs the step-by-step encapsulation of the target queue's event tracking messages into event tracking data packets based on the target queue's queue status, it specifically performs the following operations:
[0132] When the target queue is in a non-idle state, the data in the target queue is sampled one by one to obtain sampled data;
[0133] The sampled data is batch-packaged to obtain the data package containing the data points.
[0134] or,
[0135] When the target queue is in an idle state, continue executing the step of caching the main business thread's event tracking message into the event tracking sub-thread's target queue based on the message identifier of the event tracking message.
[0136] In one embodiment, the processor also performs the following operations:
[0137] Calculate the number of elements in the target queue;
[0138] When the number of elements in the target queue is greater than or equal to a preset threshold, the queue status of the target queue is determined to be non-idle.
[0139] or,
[0140] When the number of elements in the target queue is less than a preset threshold, the queue status of the target queue is determined to be idle.
[0141] In this embodiment, the event tracking data reporting system first listens for and obtains event tracking messages generated by the main business thread in real time. Then, based on the message identifier of the main business thread's event tracking messages, it caches these messages in the target queue of the event tracking sub-thread. The main business thread handles system business functions, while the event tracking sub-thread handles event tracking data. Finally, based on the queue status of the target queue, the event tracking messages in the target queue are batch-encapsulated into event tracking data packets, which are then reported to the server. Because this application caches the main business thread's event tracking messages in the target queue of the event tracking sub-thread, the processing of event tracking messages is handled exclusively by the event tracking sub-thread. This avoids response delays in user-triggered business functions caused by the main business thread processing event tracking messages, thus improving the timeliness of the system platform.
[0142] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned medium can be a non-volatile medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0143] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.
[0144] The above embodiments merely illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this patent should be determined by the appended claims.
Claims
1. A method for reporting embedded data, characterized in that, The method includes: The target thread is constructed using the HTML5 Web Workers framework; an array object is defined; the array object is integrated with the target thread to obtain a secondary tracking thread; the secondary tracking thread is integrated into the web page of the current system; by integrating a queue cache into the secondary tracking thread constructed using Web Workers, batch reporting of tracking data can be performed, which can alleviate the pressure on the server and network transmission. Real-time monitoring and acquisition of event tracking messages generated by the main business thread; The main business thread's event tracking message is cached in the target queue of the event tracking sub-thread based on the message identifier of the event tracking message. The main business thread is used to process system business functions, and the event tracking sub-thread is used to process event tracking data. Each thread is used to perform different tasks. Based on the queue status of the target queue, the event tracking messages of the target queue are batch-encapsulated into event tracking data packets, and the event tracking data packets are reported to the server.
2. The method according to claim 1, characterized in that, The real-time monitoring and acquisition of the event tracking messages generated by the main business thread, and the acquisition of the event tracking messages of the main business thread, includes: When a message sending instruction is received from the main business thread, the message sent by the main business thread is received based on the message sending instruction. Create a passive message identifier; The passive message identifier is encapsulated with the message received from the main business thread to obtain the main business thread's embedded message.
3. The method according to claim 1, characterized in that, The real-time monitoring and acquisition of the event tracking messages generated by the main business thread, and the acquisition of the event tracking messages of the main business thread, includes: Upon receiving a message destruction instruction from the main business thread, the message reading service set on the main business thread is invoked based on the message destruction instruction. Create an active message identifier; Obtain the event tracking message from the message reading service response; The active message identifier is encapsulated with the instrumentation message from the message reading service response to obtain the business main thread instrumentation message.
4. The method according to claim 1, characterized in that, The step of caching the main thread's event tracking message into the target queue of the event tracking sub-thread based on the message identifier of the event tracking message includes: When the message identifier of the main thread's event tracking message is a passive message identifier, analyze the number of target elements corresponding to the monitored event tracking message. Determine the number of locations that can be stored in the target queue of the event tracking sub-thread; When the number of target elements is greater than the number of available storage locations, multiple linked list elements are created based on the number of target elements. Insert the multiple linked list elements into the tail of the target queue pointed to by the pointer to obtain the target queue after updating the storage position; Save the monitored event messages to the target queue after updating the storage location.
5. The method according to claim 1, characterized in that, The step of batch encapsulating the event tracking messages of the target queue into event tracking data packets according to the queue status of the target queue includes: When the target queue is in a non-idle state, the data in the target queue is sampled one by one to obtain sampled data; The sampled data is batch-packaged to obtain embedded data packets; or, When the target queue is in an idle state, continue to execute the step of caching the main thread's event tracking message into the target queue of the event tracking sub-thread based on the message identifier of the event tracking message of the main thread.
6. The method according to claim 5, characterized in that, The method further includes: Calculate the number of elements in the target queue; When the number of elements in the target queue is greater than or equal to a preset threshold, the queue status of the target queue is determined to be non-idle. or, When the number of elements in the target queue is less than a preset threshold, the queue status of the target queue is determined to be idle.
7. A data reporting system for embedded data points implemented using the method described in any one of claims 1-6, characterized in that, The system includes: The event tracking message listening and acquisition module is used to listen for and acquire event tracking messages generated by the main business thread in real time, and obtain the event tracking messages of the main business thread; The event tracking message caching module is used to cache the event tracking messages of the main business thread into the target queue of the event tracking sub-thread based on the message identifier of the event tracking messages of the main business thread; wherein... The main business thread is used to handle system business functions, and the secondary tracking thread is used to handle tracking data. The event tracking message encapsulation and reporting module is used to encapsulate the event tracking messages of the target queue into event tracking data packets in batches according to the queue status of the target queue, and report the event tracking data packets to the server.
8. A computer device, characterized in that, The device includes a memory and a processor, wherein the memory stores computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of the data reporting method for embedded data as described in any one of claims 1 to 6.
9. A medium storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by one or more processors, the one or more processors perform the step of reporting the embedded data as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Front-end burying point data reporting detection method and system and computer readable storage medium
CN114629818A
Method and device for reporting burying point information, storage medium and electronic equipment
CN115454770A
