Event reporting method, system and device

By creating a shared waiting object in the page instance and asynchronously initiating experimental diversion requests, combined with timeout control and abort mechanisms, the problems of duplicate requests and inconsistent results in the existing event reporting mechanisms are solved, achieving more accurate and reliable event reporting, and improving user experience and the credibility of data analysis.

CN123178226APending Publication Date: 2026-11-27BEIJING ACCELERATED EVOLUTION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611529410.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-29
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing event reporting mechanisms suffer from problems such as duplicate requests, inconsistent results, interface flickering, experimental context tampering, and high data parsing difficulty when handling complex business scenarios. They also lack a unified coordination mechanism and strict timeout control.

Method used

By creating a shared wait object in the page instance, an experimental routing request is asynchronously initiated, and settlement is performed based on the request execution information. The information is written into the public context, structured events are generated and reported in batches, and combined with timeout control and termination mechanisms, the consistency and accuracy of experimental dimension information are ensured.

Benefits of technology

It avoids duplicate requests for experimental routing and inconsistent results, prevents interface flickering and context tampering, improves the accuracy and reliability of event reporting, and provides a smoother user experience and more accurate data analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178226A_ABST
    Figure CN123178226A_ABST
Patent Text Reader

Abstract

The embodiment of the present specification provides an event reporting method, system and device, the event reporting method comprises: in response to a loading request of a target page, calling a target toolkit to read configuration information corresponding to the target page; according to the experiment shunt address information in the configuration information, creating a shared waiting object in the page instance of the target page, and asynchronously initiating an experiment shunt request according to the experiment shunt address information; according to the request execution information of the experiment shunt request, settling the shared waiting object, extracting the experiment dimension information according to the settlement result and writing into the public context; in response to a business behavior event triggered for the target page, reading the public context snapshot corresponding to the public context, generating a structured event carrying an experiment dimension field according to the public context snapshot and the business behavior event, and writing the structured event into a batch event queue; according to the trigger condition corresponding to the batch event queue, the structured event in the batch event queue is reported to the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments in this specification relate to the field of computer software technology, and in particular to event reporting methods, systems and apparatus. Background Technology

[0002] With the development of computer and internet technologies, online experimental platforms have become a core infrastructure for the iterative optimization of internet products, widely used in scenarios such as A / B testing, feature canary releases, and user behavior analysis. In the actual operation of experimental systems, client-side event reporting is a crucial link connecting user behavior and backend data analysis; the accuracy, completeness, and timeliness of this data directly determine the credibility of experimental conclusions. However, existing event reporting mechanisms still face numerous technical bottlenecks when handling complex business scenarios. First, experimental request routing lacks a unified coordination mechanism. Business code initiates calls at different times, leading to frequent duplicate requests and intense competition for results. Inconsistent routing results obtained by different components severely interfere with the accuracy of experimental data. Second, when the routing interface response is delayed, business pages often render prematurely without obtaining valid results. After the response arrives, the experimental variant is forcibly switched, causing interface flickering and broken event attribution logic, even resulting in multiple experimental versions mixed in the same page instance. Furthermore, client-side solutions generally lack strict boundary control of "freezing upon timeout," and delayed responses can still tamper with the experimental context, leading to subsequent events being incorrectly marked. Meanwhile, the assembly process of experimental results, exposure events, and ordinary behavioral events is handled independently by each business unit, often resulting in issues such as missing fields and non-standard key names, increasing the difficulty of server-side parsing. Therefore, an effective solution is urgently needed to address these problems. Summary of the Invention

[0003] In view of this, embodiments of this specification provide an event reporting method. One or more embodiments of this specification also relate to an event reporting system, an event reporting device, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.

[0004] According to a first aspect of the embodiments of this specification, an event reporting method is provided, including: In response to a request to load the target page, the target toolkit is invoked to read the configuration information corresponding to the target page; Based on the experimental routing address information in the configuration information, a shared waiting object is created in the page instance of the target page, and an experimental routing request is asynchronously initiated based on the experimental routing address information. The shared waiting object is settled according to the request execution information of the experimental diversion request, and the experimental dimension information is extracted and written into the public context according to the settlement result; In response to a business behavior event triggered for the target page, a public context snapshot corresponding to the public context is read, a structured event carrying an experiment dimension field is generated based on the public context snapshot and the business behavior event, and the structured event is written into a batch event queue. Based on the triggering conditions corresponding to the batch event queue, the structured events in the batch event queue are reported to the server.

[0005] According to a second aspect of the embodiments of this specification, an event reporting system is provided, including a client and a server, comprising: The client is configured to, in response to a loading request for a target page, invoke the target toolkit to read the configuration information corresponding to the target page; create a shared waiting object in the page instance of the target page according to the experimental routing address information in the configuration information, and asynchronously initiate an experimental routing request according to the experimental routing address information; settle the shared waiting object according to the request execution information of the experimental routing request, extract experimental dimension information according to the settlement result and write it into the public context; in response to a business behavior event triggered for the target page, read the public context snapshot corresponding to the public context, generate a structured event carrying an experimental dimension field according to the public context snapshot and the business behavior event, and write the structured event into a batch event queue; and report the structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue. The server is used to receive structured events reported by the client and perform event analysis and processing based on the experiment dimension field in the structured events.

[0006] According to a third aspect of the embodiments of this specification, an event reporting device is provided, comprising: The calling module is configured to call the target toolkit to read the configuration information corresponding to the target page in response to a loading request for the target page; The creation module is configured to create a shared waiting object in the page instance of the target page according to the experimental routing address information in the configuration information, and asynchronously initiate an experimental routing request according to the experimental routing address information; The writing module is configured to settle the shared waiting object according to the request execution information of the experimental diversion request, extract experimental dimension information according to the settlement result and write it into the public context; The reading module is configured to, in response to a business behavior event triggered for the target page, read a public context snapshot corresponding to the public context, generate a structured event carrying an experiment dimension field based on the public context snapshot and the business behavior event, and write the structured event into a batch event queue. The reporting module is configured to report the structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue.

[0007] According to a fourth aspect of the embodiments of this specification, a computing device is provided, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the above-described event reporting method.

[0008] According to a fifth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the event reporting method described above.

[0009] According to a sixth aspect of the embodiments of this specification, a computer program product is provided, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described event reporting method.

[0010] The event reporting method provided in this embodiment, in response to a loading request for a target page, calls the target toolkit to read the configuration information corresponding to the target page; based on the experimental routing address information in the configuration information, creates a shared waiting object in the page instance of the target page, and asynchronously initiates an experimental routing request based on the experimental routing address information; settles the shared waiting object according to the request execution information of the experimental routing request, extracts experimental dimension information based on the settlement result, and writes it into the public context; in response to a business behavior event triggered for the target page, reads the public context snapshot corresponding to the public context, generates a structured event carrying an experimental dimension field based on the public context snapshot and the business behavior event, and writes the structured event into a batch event queue; and reports the structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue. This approach achieves reliable reporting of structured events by creating a shared waiting object in the page instance of the target page and asynchronously initiating an experiment routing request. The shared waiting object is settled based on the request execution information to ensure the consistency of experiment dimension information. Combined with a common context and a batch event queue, this approach avoids duplicate initiation of experiment routing requests and inconsistent results, prevents interface flickering and context tampering caused by response delays, and improves the accuracy and reliability of event reporting. Attached Figure Description

[0011] Figure 1 This is a flowchart of an event reporting method provided in one embodiment of this specification; Figure 2This is a flowchart illustrating the processing procedure of an event reporting method provided in one embodiment of this specification; Figure 3 This is a schematic diagram of the structure of an event reporting system provided in one embodiment of this specification; Figure 4 This is a schematic diagram of the structure of an event reporting device provided in one embodiment of this specification; Figure 5 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0012] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0013] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0014] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0015] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0016] This specification provides an event reporting method, and also relates to an event reporting system, an event reporting device, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.

[0017] See Figure 1 , Figure 1 A flowchart of an event reporting method according to an embodiment of this specification is shown, which specifically includes the following steps.

[0018] Step S102: In response to the loading request for the target page, the target toolkit is invoked to read the configuration information corresponding to the target page.

[0019] Step S104: Based on the experimental routing address information in the configuration information, create a shared waiting object in the page instance of the target page, and asynchronously initiate an experimental routing request based on the experimental routing address information.

[0020] Step S106: Calculate the shared waiting object according to the request execution information of the experimental diversion request, extract the experimental dimension information according to the settlement result and write it into the public context.

[0021] Step S108: In response to a business behavior event triggered for the target page, read the public context snapshot corresponding to the public context, generate a structured event carrying an experiment dimension field based on the public context snapshot and the business behavior event, and write the structured event into the batch event queue.

[0022] Step S110: According to the triggering conditions corresponding to the batch event queue, report the structured events in the batch event queue to the server.

[0023] Specifically, the target page refers to the webpage or application interface accessed by the user on the client device. This page carries business logic and user interaction, and is the source of event reporting. The target toolkit refers to the software development kit (SDK) integrated into the target page, whose main functions are to initialize the event reporting mechanism, read configuration information, and coordinate experiment routing requests. Configuration information refers to the set of parameters used to guide event reporting and experiment routing behavior. This information may include the experiment routing address, timeout threshold, event reporting trigger conditions, etc., and is usually obtained by the target toolkit when the page loads. Experiment routing address information refers to the Uniform Resource Locator (URL) or related identifier used to initiate the experiment routing request. Through this address, the client can request the experiment group information that the current user should be assigned to from the experiment routing service. A page instance refers to the independent runtime environment created when the target page runs in the client browser or application. Each page instance has its own independent memory space and execution context.

[0024] Correspondingly, the shared wait object refers to a data structure or mechanism created within the page instance to carry the final result of the experiment routing request. This object is designed to ensure that all components within the page that require the experiment routing result can obtain a consistent and unique result, avoiding duplicate requests and inconsistent results. An experiment routing request refers to a network request initiated by the client to the experiment routing service to obtain the experiment currently being participated in and its corresponding variant allocation information. This request is typically executed asynchronously and does not block the main thread rendering of the page. Request execution information refers to the status data generated during the network transmission and processing of the experiment routing request, including but not limited to whether the request was successful, the response status code, the business return code, the response data content, and whether a timeout occurred. Settlement refers to the process of updating the status and filling the result of the shared wait object based on the request execution information of the experiment routing request. After settlement, the shared wait object will contain the final experiment routing result or indicate an empty result.

[0025] Correspondingly, experiment dimension information refers to the information extracted from the settlement results of experiment routing requests, describing the experiment group and variant a user belongs to. For example, the "button color" dimension of an experiment might be assigned to the "red" variant. Public context refers to a globally accessible data storage area maintained within a page instance. This area is used to uniformly store various information that needs to be shared throughout the page's lifecycle, including but not limited to experiment dimension information, user identifiers, and device information. Public context snapshot refers to a one-time read and fixation of public context content at a specific point in time. The purpose of snapshots is to ensure that the associated experiment dimension information is in a stable state of the public context at the time an event is generated, avoiding data inconsistencies caused by subsequent context changes. Business behavior events refer to events triggered by various user operations on the target page or changes in the page's own state, such as clicking a button, scrolling the page, submitting a form, and page exposure. These events are data that needs to be collected and reported. Structured events refer to data packets organized according to a predefined format after integrating business behavior events with relevant context information (such as experiment dimension information). Structured events facilitate unified parsing and analysis by the server. A batch event queue is a buffer maintained on the client side for temporarily storing structured events to be reported. Events are first written to the queue, and then reported to the server in batches after specific triggering conditions are met, thus reducing the number of network requests. Triggering conditions refer to preset rules that control the timing of structured event reporting in the batch event queue. Common triggering conditions include the queue length reaching a threshold and timer expiration. The server side refers to the backend server system that receives structured events reported by the client and stores, analyzes, and processes them.

[0026] Based on this, in response to a loading request for the target page, the target toolkit is invoked to read the corresponding configuration information for the target page. When the target page begins loading, the client environment generates a loading request. This can be achieved by directly calling the target toolkit's initialization function in the page initialization script, or by listening to browser-provided page load completion events (such as `DOMContentLoaded` or `load` events) to trigger the target toolkit's startup. After being invoked, the target toolkit performs the task of reading configuration information. The configuration information can be pre-embedded in the page code or obtained from a remote server through synchronous or asynchronous requests. For example, the target toolkit can read a global configuration object or send a request to a specific configuration interface to obtain the various configuration parameters required by the page.

[0027] Based on the experimental routing address information in the configuration information, a shared wait object is created in the page instance of the target page, and an experimental routing request is asynchronously initiated according to the experimental routing address information. After obtaining the configuration information, if it contains experimental routing address information, a shared wait object is created in the memory of the current page instance. This object can be a simple JavaScript object, whose initial state indicates that the experimental routing result is not yet ready. After creating this object, an asynchronous network request is immediately initiated according to the experimental routing address information to obtain the user's experimental routing result. This asynchronous request can be executed in the background using standard network request interfaces provided by the browser (such as the `XMLHttpRequest` object or the `fetch` API), and its execution process does not block page rendering and user interaction.

[0028] The shared wait object is settled based on the request execution information of the experiment routing request. Experiment dimension information is extracted from the settlement result and written to the public context. Once the experiment routing request completes (whether with a successful response, a failure response, or a timeout), its request execution information is obtained. Based on this information, the previously created shared wait object is settled. For example, if the request succeeds and returns valid data, this data is parsed into experiment dimension information, and the state of the shared wait object is updated to include this dimension information. If the request fails or times out, the shared wait object can be settled with an empty result. After settlement, the final experiment dimension information (if it exists) is extracted from the shared wait object and written to the public context maintained by the page instance. The public context can be a globally accessible JavaScript object used to store shared data throughout the page's lifecycle.

[0029] In response to business behavior events triggered on the target page, a snapshot of the public context corresponding to the public context is read. Based on the public context snapshot and the business behavior event, a structured event carrying experimental dimension fields is generated and written to a batch event queue. When a user performs an action on the target page (e.g., click, input, scroll) or the page's state changes, a corresponding business behavior event is triggered. Upon capturing these events, a snapshot of the current public context is immediately read. The purpose of the snapshot is to ensure that the experimental dimension information associated with the event generation is stable. Subsequently, the experimental dimension information in the public context snapshot is merged with the current business behavior event data to generate a structured event containing experimental dimension fields. This structured event is encapsulated according to a predefined format and then added to a batch event queue maintained by the client.

[0030] Based on the trigger conditions corresponding to the batch event queue, structured events in the batch event queue are reported to the server. Structured events in the batch event queue are not reported immediately, but wait for preset trigger conditions to be met. Trigger conditions may include the number of events in the queue reaching a certain threshold, or a timer expiring. When either trigger condition is met, the system retrieves the current batch of structured events from the queue and encapsulates it into a data packet. This data packet is then sent to the server via a network request (e.g., an HTTP POST request). Batch reporting effectively reduces the number of network requests, lowers the load on both the client and server, and improves data transmission efficiency.

[0031] For example, suppose user A accesses a product details page on an e-commerce website through a browser. When the product details page begins loading, the browser sends a loading request for the page. At this time, the pre-defined event reporting target toolkit in the page is activated. This target toolkit first reads the configuration information loaded during page initialization, which includes specific experimental routing address information used to obtain experimental routing results. Based on the read experimental routing address information, the target toolkit creates a globally shared wait object in the current product details page instance. This wait object is initially empty, indicating that the experimental routing result has not yet been determined. Next, the target toolkit asynchronously initiates a network request to a remote experimental routing service based on the experimental routing address information. This request executes in the background and does not block the rendering of the product details page; user A can continue to see the page content gradually presented. After the experimental routing request is sent, the system continuously monitors the execution status of the request. For example, 800 milliseconds after the request is sent, the experimental routing service returns a response. The system settles the previously created shared wait objects based on the request execution information in the response (e.g., a response status code of 200, a business return code of 0, and an allocation set contained in the response body). Specifically, the system extracts the experiment dimension information that user A participated in on this page from the response data. For example, the "button color" experiment is assigned to the "red" variant, and the "recommendation algorithm" experiment is assigned to the "group A" variant. This experiment dimension information is then written to the public context of the page instance to ensure that all subsequent operations within the page can access a consistent experiment status.

[0032] Furthermore, after the product details page loads, user A begins browsing product information. For example, user A clicks the "Add to Cart" button, triggering a business behavior event. At this point, the event reporting module immediately reads the public context and generates a public context snapshot. This snapshot contains the experimental dimension information of user A's current position (e.g., "Button color: red," "Recommendation algorithm: Group A"). Subsequently, the system merges the experimental dimension information in this snapshot with the "Add to Cart" business behavior event data to generate a structured event. This structured event is written to a batch event queue maintained by the client. As user A performs further actions on the page, more business behavior events are triggered and generate structured events, which are continuously written to the batch event queue. When the number of events in the batch event queue reaches the preset maximum batch size (e.g., 20), or when an associated timer expires, the system determines that the triggering conditions have been met. At this time, the system retrieves these 20 structured events from the queue, serializes them into an event array, and reports the event array to the server via an HTTP POST request. After receiving these events, the server can perform subsequent event analysis and processing based on the experimental dimension fields they carry.

[0033] In summary, by creating a shared waiting object in the page instance of the target page and asynchronously initiating experimental routing requests, and calculating the shared waiting object based on the request execution information to ensure the consistency of experimental dimension information, and by combining a common context and a batch event queue to achieve reliable reporting of structured events, the system avoids duplicate initiation of experimental routing requests and inconsistent results, prevents interface flickering and context tampering caused by response delays, and improves the accuracy and reliability of event reporting.

[0034] In practice, excessively long response times for experimental traffic splitting requests can lead to business pages rendering before receiving the splitting results, or the in-transit requests failing to be effectively controlled after a timeout. This can result in issues such as page flickering, inconsistent experimental variations, and delayed response errors modifying the context. To address this, in this embodiment, the asynchronous initiation of the experimental traffic splitting request based on the experimental traffic splitting address information includes: creating a stop controller based on the experimental traffic splitting address information, and starting a timer associated with the stop controller based on the timeout threshold information in the configuration information; asynchronously initiating the experimental traffic splitting request in the background via a browser network request interface, wherein the experimental traffic splitting request and the loading of page resources of the target page are executed in parallel; and after the step of asynchronously initiating the experimental traffic splitting request based on the experimental traffic splitting address information is executed, the method further includes: canceling the experimental traffic splitting request in the execution state via the stop controller when the timer is triggered.

[0035] Specifically, an abort controller is a mechanism for controlling the lifecycle of asynchronous operations. It can be a software object or interface that provides the ability to interrupt or cancel an ongoing operation. For example, in a JavaScript environment, the AbortController API can be used to create an abort controller, whose signal property can be passed to a network request, and the request can be canceled by calling the abort() method. Alternatively, a custom control object can be designed, containing a status flag and a series of callback functions. When abort is needed, the status flag is set and the callback functions are triggered to notify the relevant operation to stop. A timer is a mechanism for executing a specific operation after a preset time. It can be a software timer; for example, in JavaScript, the setTimeout function can be used to set a delayed execution callback. This timer is associated with the abort controller, meaning that when the timer expires, it triggers the abort controller to perform a cancellation operation. Another implementation approach is to utilize lower-level timing services provided by the operating system or browser, combined with an event listener to trigger the cancellation logic of the abort controller. Browser network request interfaces refer to the APIs provided by browsers for initiating network requests in web pages. Common implementations include the XMLHttpRequest object or the Fetch API. These interfaces allow sending data to and receiving responses from the server without blocking the main thread. For example, you can use the `fetch()` function to initiate a request and process the Promise object it returns. Alternatively, you can leverage pre-packaged network request methods provided by third-party libraries or frameworks, which are typically based on the XMLHttpRequest or Fetch API at the underlying level.

[0036] Correspondingly, the parallel execution of experimental routing requests and the loading of page resources on the target page means that the sending and processing of experimental routing requests and the loading process of the target page (such as HTML, CSS, JavaScript, images, etc.) occur simultaneously without blocking each other. This means that the browser can independently process experimental routing requests in the background while downloading and rendering page content. This can be achieved by placing experimental routing requests in non-blocking asynchronous tasks, such as using async / await syntax in conjunction with fetch requests, or by placing the request logic in a Web Worker, thereby avoiding the consumption of main thread resources. When a timer is triggered, canceling an ongoing experimental routing request by using an abort controller means that when the timer reaches its preset timeout, the abort controller will signal to stop the ongoing experimental routing request from executing. For example, if using AbortController, when the timer expires, calling the abortController.abort() method will cause the Promise of the fetch request associated with that controller to be rejected, thereby interrupting network transmission or subsequent processing. As an alternative implementation, if the network request is based on XMLHttpRequest, the xhr.abort() method can be called to terminate the request when the timer is triggered.

[0037] Based on this, a termination controller is first created according to the experimental routing address information. This controller, as the core of request lifecycle management, can interrupt requests. Simultaneously, a timer associated with this termination controller is started based on the timeout threshold information in the configuration, setting a clear upper limit for the execution time of the experimental routing request. Subsequently, the experimental routing request is asynchronously initiated in the background via the browser's network request interface. This request is designed to execute in parallel with the loading of page resources on the target page, thus avoiding blocking page rendering while waiting for routing results and effectively improving page loading efficiency. Throughout the request execution process, the timer continuously monitors the time. Once the timer triggers, it indicates that the experimental routing request has exceeded the preset timeout. At this point, the termination controller immediately intervenes and cancels the experimental routing request in the execution state. This mechanism ensures that even if the request response is slow, it will not occupy resources indefinitely or continue running after a timeout, cutting off interference from timed-out requests to subsequent business logic at the source, ensuring the purity of the experimental context, and avoiding data pollution or state abnormalities caused by delayed responses, thereby ensuring the accuracy of the experimental routing results and the consistency of the page display. In this way, this application effectively solves problems such as page flickering, inconsistent experimental variants, and delayed response errors that may occur due to excessively long response times for experimental diversion requests, while asynchronously obtaining experimental dimension information.

[0038] For example, on an e-commerce product details page, a page load request triggers the execution of the client-side SDK. The SDK first reads the page's configuration information, which includes an experimental splitting address (e.g., https: / / abtest.example.com / split) and a timeout threshold (e.g., 2000 milliseconds). The SDK immediately creates an `AbortController` instance as the abort controller and obtains its `signal` object. Simultaneously, the SDK starts a `setTimeout` timer, setting it to execute a callback function after 2000 milliseconds. Within this callback function, the `abort()` method of the `AbortController` instance is called. Next, the SDK uses the `fetch` API to initiate an experimental splitting request to `https: / / abtest.example.com / split`, passing the `AbortController`'s `signal` object as one of the request options to the `fetch` function. This `fetch` request executes asynchronously in the background, concurrently with the loading of other resources on the page (such as product images, CSS stylesheets, and other JavaScript files), without blocking page rendering. If the experimental splitting request successfully returns a result within 2000 milliseconds, the timer is cleared, and the request is processed normally. If the request is not completed after 2000 milliseconds, the setTimeout callback function will be executed, calling the abort() method. At this point, the fetch request will be aborted, and the returned Promise will be rejected with an AbortError, thus canceling the execution of the experimental request splitting.

[0039] In summary, by setting explicit timeout boundaries for experimental traffic splitting requests and proactively canceling requests upon timeout using a stop controller, we prevented business pages from rendering before receiving the splitting results, thus eliminating page flickering and inconsistencies in experimental variations. Furthermore, the mechanism of proactively canceling requests in transit fundamentally eliminates the possibility of delayed responses incorrectly modifying the experimental context, ensuring the accuracy of subsequent business behavior event attribution. Compared to the basic solution, this approach significantly improves the stability and reliability of experimental traffic splitting results while ensuring asynchronous execution of experimental traffic splitting requests and avoiding page loading efficiency. This provides users with a smoother and more consistent page experience and more accurate experimental dimensional information for data analysis.

[0040] Furthermore, the lack of a refined handling mechanism for response types and abnormal states can lead to the system's inability to accurately distinguish between successful, failed, or timed-out scenarios, resulting in incorrect judgments of experimental traffic splitting results or context pollution due to delayed responses. To address this, in this embodiment, the settlement of the shared waiting object based on the request execution information of the experimental traffic splitting request includes: determining the response type corresponding to the shared waiting object based on the request execution information of the experimental traffic splitting request, wherein the response type includes at least one of a successful response type, a failed response type, and a timeout type; if the response type is the successful response type, verifying the status code and service return code of the experimental traffic splitting request response; if both the status code and the service return code are successful and the response data contains an allocation set, extracting the allocation set from the response data and settling the shared waiting object as a traffic splitting result associated with the allocation set; if the response type is the failed response type, settling the shared waiting object as an empty result; if the response type is the timeout type, canceling the in-transit request through the abort controller, settling the shared waiting object as an empty result, and marking the settled status.

[0041] Specifically, the request execution information refers to the various status and result data generated during the execution of the experimental traffic splitting request, such as the HTTP response status code, network error information, request time, and whether it was aborted. This information is the basis for judging the final result of the request. The response type is an abstract classification of the experimental traffic splitting request execution result, used to guide subsequent settlement logic. The response success type indicates that the experimental traffic splitting request has been successfully completed and valid response data has been obtained, which usually means that the network connection is normal and the server has returned the expected result. The response failure type indicates that the experimental traffic splitting request failed to complete successfully, for example, due to network errors, internal server errors, or client request errors. The timeout type indicates that the experimental traffic splitting request failed to receive a response within a preset time threshold. The response type can be determined by listening to various event callbacks of the browser's Fetch API or XMLHttpRequest object to obtain request execution information. For example, the then branch in fetch().then().catch() can capture a successful response, the catch branch can capture a network error, and an external timer can be used to determine whether a timeout has occurred. Alternatively, a timer can be started when the request is initiated. When the request returns, the timer is checked to see if it has expired. If the timer expires but the request does not return, it is considered a timeout. If the request returns, the HTTP status code and network error information are used to determine whether it is a success or failure.

[0042] Accordingly, the verification status code and business return code are used. The status code typically refers to the HTTP status code (e.g., 200 indicates success), while the business return code is a custom code defined by the server in the response body to indicate the result of business logic processing (e.g., 0 indicates business success). This dual verification ensures success not only at the network level but also at the business logic level. The response data refers to the data body returned by the server after a successful experiment assignment request, usually in JSON format, which may contain experiment assignment information. The assignment set is the specific experiment grouping information contained in the response data, such as which experiment and variant group the user was assigned to. The settlement is the assignment result associated with the assignment set, meaning that the valid assignment set extracted from the response data is used as the final result of the shared waiting object for subsequent business logic. Verification and extraction of the assignment set can be done by parsing the response body (e.g., JSON) after receiving an HTTP 200 status code response, checking for the existence of a predefined business return code field (e.g., `code`), and determining whether its value indicates success (e.g., `code === 0`). Simultaneously, it checks whether a field named `data.assignments` exists in the response data, and whether this field is not empty. If all conditions are met, `assignments` is extracted as the allocation set. Alternatively, a unified response parser can be defined. This parser first checks if the HTTP status code is within the 2xx range, then attempts to parse the response body into a JSON object. Next, according to the preset configuration, the business status field and business data field are retrieved from the JSON object. If the business status field indicates success, and the business data field contains the expected experimental allocation structure (e.g., a mapping containing experimental key-value pairs), then the validation is considered successful, and the allocation set is extracted.

[0043] Accordingly, an empty result indicates that the experiment allocation request failed to obtain valid experiment allocation information, and therefore the shared wait object is set to a state representing "no result" or "default result". When a network error (such as TypeError: Failed to fetch) or an HTTP status code of 4xx / 5xx is captured, the allocation result field stored internally in the shared wait object can be directly set to null or a predefined empty object. Alternatively, all unsuccessful responses can be handled through a unified error handling function. This function receives error information and, based on the error type (such as network interruption, server error, etc.), updates the status of the shared wait object to "failed" and clears or sets its result field to a default value.

[0044] Accordingly, the abort controller is a mechanism for controlling the lifecycle of asynchronous operations (such as network requests), allowing them to be cancelled before completion. Cancelling an in-transit request means actively terminating the execution of the request and releasing related resources before it is completed. Marking the settled state means setting a flag within the shared wait object to indicate that the object has completed its settlement process, and subsequent late responses will not be processed. When a timer triggers a timeout event, the `abort()` method of the `AbortController` instance can be called, which will cause the associated Fetch request to be cancelled. Simultaneously, an internal boolean flag (such as `isSettled`) of the shared wait object is set to true, and its result is set to null. Alternatively, a request management module can be encapsulated, which returns a Promise with a `cancel()` method when initiating a request. When a timeout occurs, the `cancel()` method is called, which internally triggers the request abort logic. Simultaneously, the state of the shared wait object is updated, marking it as settled, and its result is cleared.

[0045] Based on this, a refined response type determination mechanism is introduced to manage the execution results of experimental traffic splitting requests in a closed loop, thereby ensuring the accuracy and consistency of the settlement results for shared waiting objects. Upon responding to a loading request for the target page, the system calls the target toolkit to read configuration information and creates a shared waiting object in the page instance based on the experimental traffic splitting address information, while simultaneously initiating an asynchronous experimental traffic splitting request. This asynchronous request executes in parallel with page resource loading and is managed through a stop controller and timer. When the execution information of the experimental traffic splitting request is returned, this solution determines the response type corresponding to the shared waiting object based on this information, such as the HTTP status code, network error, or timer status. This response type is explicitly divided into successful response, failed response, and timeout response. Specifically, if the response is determined to be successful, the system further rigorously verifies the response of the experimental traffic splitting request, including checking whether both the HTTP status code and the business return code indicate success, and whether the response data actually contains a valid allocation set. Only when all these conditions are met is the allocation set extracted from the response data, and the shared waiting object is settled as the traffic splitting result associated with that allocation set. This dual-verification mechanism effectively avoids erroneous traffic splitting caused by network-level success but business logic failure or incomplete data. If the response is determined to be a failure, such as due to network anomalies or server errors, the system immediately settles the shared waiting object as an empty result. This ensures that the business logic can promptly detect traffic splitting failures, avoiding unnecessary waiting and resource consumption. If the request is determined to be a timeout, meaning the experimental traffic splitting request fails to complete within the preset timeout threshold, this solution proactively cancels requests still in transit through the abort controller, thereby avoiding resource waste. Simultaneously, the shared waiting object is settled as an empty result and critically marked as settled. This "settled status" marking is crucial; it effectively prevents any late responses from modifying the settled result, prevents context pollution caused by network latency, and ensures accurate attribution of experimental dimensions for subsequent business behavior events. Through the above mechanism, this solution further improves the settlement logic of request results on the basis of asynchronously initiating experimental diversion requests. In particular, when dealing with abnormal situations (such as failure and timeout), it can provide clear boundaries and consistent results, effectively solving the problems of duplicate requests, result competition, page flickering and late response pollution of context that exist in traditional solutions.

[0046] For example, when a target page is loaded, the client SDK asynchronously initiates an experimental traffic splitting request to the remote server. This request carries an `AbortSignal`, generated by an `AbortController` instance. Simultaneously, a timer is started, for example, set to 2000 milliseconds. In one scenario, suppose at 1500 milliseconds, the server returns a response with an HTTP status code of 200, and the response body is `{"code":0, "data":{"assignments":{"featureA":{"group":"variant_b"}}}}`. Upon receiving the response, the client SDK first determines if it is a success response. Next, it verifies that the HTTP status code is 200 (success), the business return code is 0 (business success), and the `data` contains the `assignments` field. Since all conditions are met, the SDK extracts `{"featureA":{"group":"variant_b"}}` as the allocation set and calculates the shared wait object as the traffic splitting result associated with this allocation set. In another scenario, suppose that at 500 milliseconds, the Fetch request throws a TypeError due to a client network outage. The client SDK catches this error and determines it to be a response failure. In this case, the SDK immediately settles the shared wait object to an empty result, indicating that valid experimental routing information could not be obtained. In yet another scenario, suppose that at 2000 milliseconds, the timer expires, but the experimental routing request still hasn't received any response. The client SDK determines it to be a timeout. In this case, the SDK immediately calls the `abort()` method of the `AbortController` instance, canceling the ongoing Fetch request. Simultaneously, it settles the shared wait object to an empty result and sets its internal `isSettled` flag to true. Even if a server response arrives later (e.g., at 2500 milliseconds), since `isSettled` is already true, the late response will be ignored and will not affect the final settlement result of the shared wait object.

[0047] In summary, by introducing multi-dimensional response type determination and implementing refined processing for success, failure, and timeout scenarios, this solution ensures the accuracy and consistency of experimental traffic distribution results. Particularly in timeout scenarios, by proactively canceling in-transit requests and marking them as settled, it effectively avoids the contamination of the experimental context by late responses, thus ensuring that the experimental dimension attribution of subsequent business behavior events is always based on the definite traffic distribution results. This significantly improves the reliability of experimental data collection, avoids problems such as page flickering and inconsistent event attribution caused by uncertain traffic distribution results, provides users with a more stable and consistent page experience, and provides a more accurate foundation for data analysis.

[0048] Furthermore, the directly obtained raw response data often contains a large amount of redundant information or unexpected formats. If the response data is not strictly filtered, validated, and structured, the subsequently generated experimental dimension information may have chaotic formats, invalid entries, or data that does not meet business constraints, thereby affecting the accuracy of the experimental dimensions and the reliability of subsequent event attribution. To address this, in this embodiment, after the step of extracting the allocation set from the response data is executed, the method further includes: traversing each experimental key in the allocation set, reading the variant group field corresponding to each experimental key based on the traversal result; retaining entries where the variant group field is a string type, generating a dimension snapshot based on the retained entries, wherein the dimension snapshot contains the correspondence between experimental keys and variant group fields; settling the shared wait object as a splitting result associated with the dimension snapshot; or, if all entries in the allocation set do not meet the constraints, settling the shared wait object as an empty result.

[0049] Specifically, traversing each experiment key in the allocation set refers to checking and processing each allocation set extracted from the response data of the experiment distribution request. The allocation set is typically a data structure containing multiple experiment configuration items, each identified by a unique "experiment key." The traversal operation ensures comprehensive processing of all experiment configurations in the allocation set, forming the basis for subsequent data extraction and verification. This traversal can be implemented using a loop structure (e.g., a for loop, forEach method) or an iterator pattern. The "experiment key" is a string or number used to uniquely identify a specific experiment, such as "button_color" or "banner_style."

[0050] Accordingly, reading the variant group field corresponding to each experimental key based on the traversal results refers to retrieving the associated "variant group field" for the currently processed experimental key when traversing the allocation set. The "variant group field" represents the specific experimental variant or grouping information corresponding to the experimental key, such as "variant_a" or "control_group". The read operation typically involves parsing the data structure of the allocation set, such as retrieving the value of a specific key from a JSON object or extracting the content of a specific tag from an XML document.

[0051] Accordingly, retaining entries where the variant group field is a string type means performing data type validation on the read variant group field and only accepting entries with a string data type. This step aims to filter out unexpected or malformed data, such as numbers, booleans, empty objects, or arrays, ensuring the consistency and validity of experimental dimension information. This can be achieved through built-in type checking functions in the programming language (such as JavaScript's `typeof` operator) or through custom validation logic.

[0052] Accordingly, generating a dimension snapshot based on the retained entries refers to organizing the valid experimental keys that have undergone type validation and are retained, along with their corresponding string type variant group fields, into a new, structured data set, i.e., a "dimensional snapshot." A dimension snapshot is a concise and standardized representation of experimental dimension information; it contains only valid and expected experimental configurations. This can be achieved by storing these key-value pairs in a new hash table (Map), dictionary, or plain object.

[0053] Accordingly, the dimension snapshot contains a mapping between experimental keys and variant group fields, which clarifies the internal structure of the dimension snapshot. Each experimental key uniquely maps to a string-type variant group field. This explicit mapping allows subsequent event reporting to accurately reference and carry experimental dimension information.

[0054] Accordingly, settling the shared wait object as the offloading result associated with the dimension snapshot means that after successfully generating the dimension snapshot, this dimension snapshot is used as the final result of the experimental offloading and updated in the previously created shared wait object. This means that the shared wait object now carries the cleaned, validated, and structured experimental offloading result, available to all callers that depend on this result. Settlement operations typically involve updating the state or data fields within the shared wait object.

[0055] Correspondingly, the condition that "all entries in the allocation set do not meet the constraints" means that after traversing the allocation set and performing type validation, if it is found that none of the variant group fields corresponding to all experimental keys are of string type, or do not meet other preset business constraints (e.g., variant group fields cannot be empty strings, or must be values ​​in a predefined list), then this condition is triggered. This is a fallback mechanism to handle cases where the allocation set is completely invalid or empty.

[0056] Accordingly, settling the shared wait object to an empty result means updating its state to contain no valid experimental dimension information when none of the entries in the allocation set meet the constraints. This typically implies that the experiment splitting failed or there was no valid splitting, and subsequent events will not carry experimental dimension information, or will carry default empty dimension information. A settlement to an empty result can be achieved by setting the dimension snapshot field inside the shared wait object to null, undefined, or an empty object.

[0057] Based on this, the system ensures the standardization and validity of experimental dimension information by finely filtering and structurally reorganizing the experimental triage response data. Upon receiving the response data of the experimental triage request and extracting the allocation set, the system immediately performs rigorous verification and processing on the set. First, it iterates through each experimental key in the allocation set and attempts to read its corresponding variant group field. To ensure data quality and consistency, the system only retains entries where the variant group field is a string type, effectively eliminating any unexpected or incorrectly formatted data and avoiding parsing errors or subsequent processing problems caused by inconsistent data types. Then, based on these filtered and retained valid entries, the system generates a standardized "dimensional snapshot." This snapshot clearly establishes the correspondence between experimental keys and variant group fields, providing a unified and reliable data source for subsequent experimental dimension labeling. Finally, this structured dimension snapshot is associated with a shared waiting object as the final settlement result of the experimental triage. Furthermore, to enhance the system's robustness, this solution introduces a fallback mechanism: if all entries in the allocation set fail to meet preset constraints after validation (e.g., all variant group fields are not string types), the shared wait object will be settled as an empty result. This mechanism effectively prevents invalid or incorrect configurations from being mistakenly applied to business events, thereby ensuring the quality of experimental routing results and the stability of system operation. In this way, this solution adds strict data governance to the routing results on top of basic experimental routing request processing, enabling subsequent event collection and analysis to be based on high-quality experimental dimensional information, avoiding attribution errors caused by messy raw data.

[0058] For example, suppose that after responding to an experiment split request, the allocation set extracted from the response data is {"button_color":{"group":"variant_b"},"badge":{"group":123},"text_size":{"group":""}}. The system first iterates through this allocation set. For the first experiment key "button_color", its corresponding variant group field is {"group":"variant_b"}. After reading its internal "group" field, we get "variant_b", which is a string type, so this entry is retained. For the second experiment key "badge", its corresponding variant group field is {"group":123}. After reading its internal "group" field, we get the number 123. Since it is not a string type, this entry will be filtered out. For the third experiment key "text_size", its corresponding variant group field is {"group":""}. After reading its internal "group" field, we get the empty string "", which is a string type, so this entry is retained. After this processing, the final valid entries will be {"button_color":"variant_b", "text_size":""}. Based on these retained entries, the system will generate a dimension snapshot, for example, {"button_color":"variant_b", "text_size":""}. Finally, this dimension snapshot will be associated with the shared wait object as the final distribution result. If all entries in the allocation set, such as {"badge":{"group":123}}, are filtered out, then the shared wait object will be settled as an empty result.

[0059] In summary, by traversing the allocation set, performing type validation, and structuring, we ensure that only experimental keys and string type variant fields that conform to the specifications are included in the dimension snapshot. This avoids parsing errors caused by data corruption and unreliable subsequent event attribution. This refined data processing mechanism, combined with a fallback strategy, greatly improves the accuracy, consistency, and effectiveness of experimental dimension information. It enables subsequent event collection and analysis to be based on high-quality experimental data, thereby guaranteeing the reliability of experimental results and the scientific nature of business decisions.

[0060] Furthermore, existing solutions, when settling shared waiting objects based on the request execution information of experimental routing requests and extracting experimental dimension information to write into the public context, still face key challenges in improving the accuracy and real-time performance of data analysis. These challenges include ensuring the uniformity of the experimental dimension information format and efficiently and accurately identifying whether experimental variants have changed and promptly triggering corresponding exposure events. In this embodiment, the step of extracting experimental dimension information and writing it into the public context based on the settlement result includes: serializing the dimension snapshot into a target string and writing the target string into the experimental dimension field of the public context; after the step of extracting experimental dimension information and writing it into the public context based on the settlement result, the solution further includes: sorting the experimental keys in the dimension snapshot in lexicographical order, generating stable keys in key-value concatenation form, and comparing the stable keys with the recorded stable keys; if the stable keys differ from the recorded stable keys, generating an exposure event based on the dimension snapshot and writing the exposure event into the batch event queue.

[0061] Specifically, a dimension snapshot is a structured representation of the experimental splitting results. It typically contains the experiment's key and its corresponding variant group field. Its purpose is to clearly and completely record the experimental state of the current page instance, serving as the foundation for generating subsequent experimental dimension information. A dimension snapshot can be a collection of key-value pairs, such as a JavaScript object or a Map structure, where the key is the experiment identifier and the value is the experiment variant. Serializing the dimension snapshot into a target string aims to standardize the data format, facilitating transmission and storage between different system components and ensuring data consistency when written to the public context. One implementation is to use JSON (JavaScript Object Notation) format, converting the dimension snapshot object to a JSON string using the JSON.stringify() method. Another implementation is to use custom delimiters (such as commas, semicolons, or vertical bars) to concatenate key-value pairs into a string, for example, "key1=value1;key2=value2". The public context is a data storage area accessible and shared throughout the page instance's lifecycle, used to store general information related to the current page state. The experimental dimension field is a specific area within the public context, dedicated to storing the experimental splitting results of the current page instance. Writing the serialized target string to this field allows all subsequent business events to easily read and carry this experimental dimension information. This can be achieved through direct assignment operations, such as storing the string in a property of a global object, or storing the data in a shared data pool through a specific API interface.

[0062] Correspondingly, the experiment key is a unique name used to identify different experiments in the dimension snapshot. Lexicographical sorting refers to arranging these experiment keys in alphabetical or character order. The purpose of this operation is to standardize the stable key generation process, ensuring that even if the key-value pairs in the dimension snapshot are in different orders, as long as their content is the same, unique and comparable stable keys can be generated. This can be achieved using sorting functions provided by programming languages, such as the `Array.prototype.sort()` method in JavaScript to sort the key array. A stable key is a string composed of the sorted experiment keys and their corresponding variant group fields, serving as a unique identifier for the current experimental dimension state. This connection format ensures the uniqueness and comparability of stable keys; even at different points in time or in different code paths, as long as the experimental dimension state is the same, the generated stable keys will be identical. For example, sorted key-value pairs can be concatenated in the form of "key=value" and separated using a specific delimiter (such as a vertical bar "|") to form the string "key1=value1|key2=value2". Recorded stable keys are the stable keys corresponding to the last successfully generated exposure event. Comparing the currently generated stable key with the recorded stable key is to determine whether the current experimental dimension state has actually changed. If they differ, it indicates a change in the experimental configuration or distribution results, requiring a new exposure event to be triggered. This can be achieved through simple string comparison operations, such as using the === operator or the String.prototype.localeCompare() method. An exposure event is a special type of business behavior event used to record a user's first "exposure" or "contact" under a specific experimental variant. Generating an exposure event when a change in the experimental dimension state is detected aims to accurately record the experimental version experienced by the user, providing attribution basis for subsequent data analysis. An exposure event can be a structured data object containing a specific event name (such as "ab_test_exposure") and a snapshot of the current dimension (usually a serialized string). The batch event queue is a temporary storage area used to collect multiple business behavior events and exposure events for batch reporting when specific conditions are met. Writing exposure events to the batch event queue aims to optimize network requests, reduce the number of communications with the server, and improve data reporting efficiency. This can be achieved by adding event objects to a data structure such as an array or linked list, which is typically managed by a separate module responsible for enqueuing, dequeuing, and bulk sending of events.

[0063] Based on this, after responding to the loading request for the target page, the system first calls the target toolkit to read the configuration information corresponding to the target page. According to the experimental routing address information in the configuration information, a shared waiting object is created in the page instance of the target page, and an experimental routing request is asynchronously initiated. This experimental routing request is executed in parallel with the loading of page resources on the target page. By creating a stop controller and a timer, it is ensured that the request can be cancelled in a timely manner if it times out, avoiding resource waste and state chaos. After the request execution information of the experimental routing request is returned, the system will settle the shared waiting object according to its response type (success, failure, or timeout). If the response is successful and the data is valid, the allocation set is extracted from the response data, and a dimension snapshot is generated, which is associated with the shared waiting object. Furthermore, to ensure the uniformity of the experimental dimension information format and efficiently identify experimental variant changes, this application further serializes the dimension snapshot into a target string and writes the target string into the experimental dimension field of the public context. This processing unifies the complex experimental dimension structure into an easy-to-process string format, facilitating rapid reading and mounting during subsequent business behavior event generation, thereby ensuring the consistency of the experimental dimension field in all structured events. Meanwhile, to accurately capture the dynamic changes of experimental variants and avoid duplicate reporting, the system sorts the experimental keys in the dimension snapshot in lexicographical order and generates a stable key in key-value concatenation format. This stable key is a unique identifier of the current experimental dimension state. Subsequently, this stable key is compared with the previously recorded stable key. Only when the current stable key differs from the previously recorded stable key does it indicate that an actual change has occurred in the experimental variant. At this point, the system generates an exposure event based on the dimension snapshot and writes it to the batch event queue. This mechanism effectively solves the problem of state judgment bias caused by inconsistent experimental key order, ensures unique identification of experimental configuration changes, and triggers exposure events only when an actual change occurs in the variant, avoiding redundant data reporting. Finally, when a business behavior event is triggered for a target page, the system reads a public context snapshot containing serialized experimental dimension information and generates a structured event carrying experimental dimension fields based on this snapshot and the business behavior event, writing it to the batch event queue. When the batch event queue meets the triggering conditions, the structured events (including business behavior events and exposure events) within it are reported to the server in batches. Through the above solution, this application achieves efficient management of experimental dimension information and accurate triggering of exposure events, providing a reliable data foundation for accurate event analysis and attribution on the server side, and effectively solving the problems of missing experimental fields, duplicate reporting of exposure, and difficulty in correlation on the server side in traditional solutions.

[0064] For example, suppose a user visits an e-commerce page that is undergoing A / B testing, testing "button color" and "banner text". When the page loads, the system asynchronously initiates an experiment split request and successfully obtains the split result, for example, a dimension snapshot as {"button_color": "variant_b", "banner_text": "control"}. First, this dimension snapshot is serialized. For example, using the JSON.stringify method, it is converted to the string '{"banner_text":"control","button_color":"variant_b"}'. This string is then written to the experiments field of the public context. Next, to generate stable keys, the system extracts the experimental keys "button_color" and "banner_text" from the dimension snapshot. These keys are sorted lexicographically as "banner_text" and "button_color". Then, stable keys are generated in key-value concatenation form, for example, "banner_text=control|button_color=variant_b". The system compares this newly generated stable key with the previously recorded stable keys. Assuming this is the first time the page loads and the traffic distribution result is obtained, there is no previously recorded stable key (or it is empty). Since the current stable key is different from an empty value, the system will determine that the experimental variant has changed, and generate an exposure event based on the current dimension snapshot, for example, an event named ab_test_exposure, whose event attributes also include the serialized dimension snapshot '{"banner_text":"control","button_color":"variant_b"}'. This exposure event is then added to the batch event queue. Subsequently, if the user clicks a button on the page, triggering a business behavior event (e.g., click_product), the system will read the snapshot containing '{"banner_text":"control","button_color":"variant_b"}' from the public context, append it as an experimental dimension field to the click_product event, forming a complete structured event, which is also written to the batch event queue. If the page attempts to retrieve or update the experimental split results again in subsequent operations, but the obtained dimension snapshot is exactly the same as before, for example, it is still {"button_color": "variant_b", "banner_text": "control"}. In this case, the generated stable key will still be "banner_text=control|button_color=variant_b".When this stabilization key is compared with a previously recorded stabilization key, if they are the same, the system will not generate the exposure event again, thus avoiding redundant reporting.

[0065] In summary, the above processing ensures the consistency of experimental dimension information format throughout the entire event reporting chain, avoiding parsing difficulties and data chaos caused by inconsistent processing methods of different components or at different times. Simultaneously, by introducing a stable key and performing real-time comparison, this application can accurately identify actual changes in experimental variants, generating exposure events only when necessary, effectively avoiding duplicate reporting of redundant exposure data, thereby optimizing data transmission efficiency and reducing the server-side processing burden. Furthermore, writing the serialized experimental dimension information into a common context allows all business behavior events to automatically carry accurate experimental attribution information, greatly simplifying the data assembly work for business parties and providing a reliable and consistent data foundation for accurate event analysis, attribution, and effect evaluation on the server side, significantly improving the accuracy and real-time performance of data analysis.

[0066] Furthermore, if the experimental traffic splitting request returns a response only after the shared waiting object has been settled into an empty result, i.e., a delayed response occurs, and if this delayed response is not effectively controlled, it may cause the delayed response to incorrectly modify the determined experimental context, thereby leading to incorrect experimental dimension labeling of subsequent business behavior events and resulting in chaotic data attribution. To address this, in this embodiment, after the step of settling the shared waiting object according to the request execution information of the experimental traffic splitting request, the method further includes: if the shared waiting object has been settled into an empty result and marked as settled, and a delayed response to the experimental traffic splitting request is received, checking the settled status; if the settled status is settled, discarding the delayed response and ensuring that the public context does not contain experimental dimension information; if the settled status is unsettled, using the delayed response as the response to the experimental traffic splitting request, and performing the step of verifying the status code and business return code of the experimental traffic splitting request response.

[0067] Specifically, the shared waiting object being settled as an empty result and marked as settled means that when an experimental routing request fails to obtain a valid experimental routing result due to network errors, server response failure, or reaching a preset timeout threshold, the shared waiting object will be set to "empty result." Simultaneously, to confirm that the state of the shared waiting object has been finalized, the system will mark it as "settled." This mark indicates that regardless of whether a response to the experimental routing request is subsequently received, the state of the shared waiting object will not change due to that request. One implementation is to maintain a state variable within the shared waiting object, such as a boolean flag `isSettled` and an enumerated result variable `settlementResult`. When the experimental routing request times out or fails, `settlementResult` is set to `EMPTY`, and `isSettled` is set to `true`. Another implementation is to manage the state of all shared waiting objects through a centralized state management module. When a shared waiting object is settled as an empty result, this module atomically updates its state, marks it as settled, and notifies all subscribers that the state has been finalized. A delayed response to an experimental traffic splitting request refers to a request that is transmitted over the network and eventually reaches the client, but its arrival time is later than the time when the shared waiting object has been settled and marked as settled. For example, when an experimental traffic splitting request is judged as failed by the system due to timeout and the shared waiting object is settled, the actual response to the request is only returned from the server to the client. One implementation is to record the unique identifier and initiation time of the experimental traffic splitting request. When the response arrives, the corresponding shared waiting object is found based on the identifier, and the response arrival time is compared with the settlement time of the shared waiting object. If the response arrival time is later than the settlement time, it is judged as a delayed response. Another implementation is to remove the associated request identifier from a "pending request" list when the shared waiting object is settled and marked as settled. When any response arrives, its identifier is first checked to see if it is still in the "pending request" list. If not, it is considered a delayed response. The purpose of checking the settled status is to determine whether the shared waiting object has completed the final settlement process, thereby deciding how to handle the currently received experimental traffic splitting request response. This is a crucial step to prevent late responses from interfering with an already settled state. One implementation is to directly access the `isSettled` boolean flag maintained internally by the shared wait object upon receiving a response to an experiment splitting request. If the flag is true, it indicates that the settlement has been completed; otherwise, it indicates that the settlement has not been completed. Another implementation is to query the current settlement status by calling a public method provided by the shared wait object, such as `isSettled()`. This method returns a boolean value indicating whether the object is in a final settlement state.

[0068] Correspondingly, discarding late responses serves to prevent them from modifying or interfering with the established experimental context when the shared waiting object is already in a settled state, thereby maintaining data consistency and accuracy. One implementation is to directly terminate subsequent processing of late responses after confirming the settled state, such as not parsing the response body, not triggering any callback functions, and clearing it from memory. Another implementation is to log late responses but not process them for business logic, using them only for debugging or monitoring to ensure they do not affect the current state of the system. Maintaining the public context from containing experimental dimension information ensures that the public context is not contaminated by experimental dimension information in late responses when the shared waiting object settles to an empty result due to timeout or failure. This is crucial for the correct attribution of subsequent business events, avoiding experimental context inconsistencies caused by network latency. One implementation is to explicitly not perform any operations that write experimental dimension information to the public context after discarding the late response. The experimental dimension fields of the public context will retain their initial null or default values. Another implementation is to set the experiment dimension field to a specific value (e.g., an empty string or null) representing "no experiment dimension" when it is initialized in the public context, and ensure that this field is not modified when discarding late responses. Treating late responses as responses to experiment routing requests aims to treat them as normal experiment routing request responses when the shared waiting object is in an unsettled state. This fully utilizes the data returned by the network and avoids missing valid experiment routing results due to brief network fluctuations or processing delays. One implementation is to pass the received late response to a general processing function that handles experiment routing request responses, allowing it to be parsed and processed according to the normal process. Another implementation is to encapsulate the late response into a standardized response object and assign it to the shared waiting object so that subsequent verification steps can handle it uniformly. The step of verifying the status code and business return code of the experiment routing request response aims to validate the received response, ensuring that it is not only successful at the network level but also valid at the business logic level. This helps filter out invalid or erroneous response data, ensuring the accuracy of experiment dimension information. One approach is to call a predefined response validation module. This module checks the HTTP status code of the response (e.g., 200 OK) and the business return code in the response body (e.g., code: 0 indicates success), and determines the validity of the response based on preset rules. Another approach is to perform structure and content validation on the response data using regular expressions or JSON Schema to ensure it conforms to the expected format and contains necessary experimental routing information.

[0069] Based on this, in response to a loading request for the target page, the system calls the target toolkit to read the configuration information corresponding to the target page, creates a shared waiting object in the page instance of the target page according to the experimental routing address information in the configuration information, and asynchronously initiates an experimental routing request according to the experimental routing address information. Then, the system settles the shared waiting object according to the request execution information of the experimental routing request. This settlement process may result in the shared waiting object being settled as an empty result due to request timeout, network error, or business failure, and at this point, it is explicitly marked as settled. Furthermore, this application proposes that when the system receives a late response to the experimental routing request, i.e., after the shared waiting object has been settled as an empty result and marked as settled, the system will first check the settled status of the shared waiting object. This check is the core decision point. If the check result indicates that the settled status is settled, it means that the status of the shared waiting object has been finally determined and is an empty result. In this case, the system will decisively discard the late response, no longer process it, and ensure that the public context does not contain experimental dimension information. This approach effectively prevents late responses from overwriting or incorrectly updating already determined empty result states, thus avoiding experimental context pollution caused by network latency. For example, if a shared waiting object is settled as empty due to timeout, the public context will not contain experimental dimension information. Even if the late response contains experimental grouping information, this information will not be adopted, ensuring the consistency of attribution for all subsequent business behavior events—that is, they will not carry experimental dimension information. Conversely, if the check result indicates that the settled state is unsettled, this usually means that the shared waiting object has not yet been finally settled, or that previous settlement attempts did not mark it as a final state. In this case, the system will treat the late response as a response to a valid experimental routing request and continue to execute the steps of verifying the status code and business return code of the experimental routing request response. This mechanism ensures that the system can fully utilize the data returned by the network before the request is determined to be a final result, balancing system flexibility and data acquisition integrity. For example, if a shared waiting object is temporarily marked as failed at a certain point in time but not yet settled, and a late response happens to contain valid experimental offloading results, the system can capture and process the result in a timely manner, avoiding the loss of valid data due to premature abandonment. Through the aforementioned refined state checking and response processing logic, the proposed solution fundamentally solves the uncertainty interference caused by late responses in asynchronous requests, ensuring that the writing of experimental dimension information in the public context is always under control, providing a reliable contextual foundation for the subsequent generation of accurate structured events. This contrasts sharply with the potential problem of late responses arbitrarily modifying the context in basic solutions, significantly improving the accuracy and consistency of experimental data attribution.

[0070] For example, suppose a user accesses a target page in a browser, and this page needs to perform experimental routing to determine the user's experimental group. First, when the target page loads, the system creates a globally unique shared wait object in the page instance based on the experimental routing address information in the configuration information. Simultaneously, an experimental routing request is asynchronously initiated. To prevent the request from going unresponsive for an extended period, the system starts a timer, for example, setting a timeout threshold of 2000 milliseconds. In one scenario, the experimental routing request successfully returns a response after 1800 milliseconds, and the response content is valid. At this point, the shared wait object is settled as a routing result associated with a specific experimental routing result (e.g., "Group A") and marked as settled. Even if any delayed responses arrive subsequently, since the shared wait object is already in a settled state, these delayed responses will be discarded, and the public context will contain the experimental dimension information for "Group A". In another scenario, the experimental routing request fails to return a response within 2000 milliseconds, triggering a timeout. In this case, the system cancels the request through the abort controller, settles the shared wait object as an empty result, and marks it as settled. For example, the `isSettled` flag inside the shared wait object is set to `true`, and `settlementResult` is set to `EMPTY`. Then, suppose that after 2500 milliseconds, the response to the previously timed-out experimental routing request finally arrives at the client. Upon receiving this late response, the system immediately checks the settled status of the shared wait object. Since the object was marked as settled at 2000 milliseconds, the system determines the current status to be "settled". Therefore, the late response will be discarded without any parsing or processing. The public context will remain free of any experimental dimension information, ensuring that all subsequent business behavior events triggered on the target page, such as clicks and views, will not carry experimental dimension fields, thus avoiding experimental context pollution caused by late responses. In contrast, if the shared wait object is settled to an empty result at some point, but for some reason is not immediately marked as settled (i.e., the `isSettled` flag is still `false`), then if a late response arrives and the system checks the settled status as "unsettled", the late response will be considered a valid response to the experimental routing request. The system will continue to verify the status code and business return code of the response. For example, if the HTTP status code of the response is 200, the business return code is 0, and it contains valid experimental routing data, then the shared waiting object will recalculate based on the late response and update the experimental dimension information in the public context. This mechanism ensures that the system can flexibly handle late responses to obtain the most accurate experimental routing results even when the status of the shared waiting object is not yet finalized.

[0071] In summary, once a shared waiting object is settled as an empty result and marked as settled due to timeout or failure, any subsequent late responses will be accurately identified and discarded by the system, ensuring that the public context remains free of experimental dimension information. This mechanism fundamentally eliminates the interference of late responses on the already determined empty result state, avoids experimental context pollution caused by network latency, and guarantees that the experimental dimension attribution of all subsequent business behavior events remains consistent with the final settlement state of the shared waiting object. Simultaneously, even before the shared waiting object has been finally settled, the system can flexibly treat late responses as valid responses, fully utilizing the data returned from the network, balancing system flexibility with data acquisition integrity. This refined state checking and response processing logic significantly improves the accuracy and consistency of experimental data attribution, providing a reliable foundation for data analysis.

[0072] Furthermore, existing event reporting methods, when generating structured events based on public context snapshots and business behavior events for event reporting, may lack necessary metadata support due to reliance solely on public context snapshots. This makes it difficult for the server to accurately identify the specific context, time sequence, and source platform of the event during event analysis, thus affecting the accuracy of event attribution and the depth of data analysis. To address this, in this embodiment, generating structured events with experimental dimension fields based on the public context snapshot and the business behavior events includes: assigning an event identifier to the business behavior event, determining the event time information corresponding to the business behavior event, and identifying the client platform information corresponding to the business behavior event; and generating structured events with experimental dimension fields based on the event identifier, the event time information, the client platform information, and the public context snapshot.

[0073] Specifically, assigning an event identifier to a business behavior event is a unique marker used to identify each event. Its purpose is to ensure that the event has a unique identity throughout its entire lifecycle, whether it's collected, processed, and stored on the client side, or received, analyzed, and attributed on the server side. This is crucial for avoiding event duplication, tracking event flow, and performing event association and deduplication in distributed systems. For example, a globally unique identifier (UUID / GUID) generation algorithm can be used to generate a random and unique string locally on the client side as the event identifier; alternatively, a highly unique event identifier can be generated by combining information such as timestamps, client device IDs, and page session IDs through hash algorithms or specific encoding rules; or, a distributed ID generation scheme such as the Snowflake algorithm can be used to generate a trend-increasing and globally unique 64-bit integer as the event identifier.

[0074] Correspondingly, determining the event time information corresponding to a business behavior event refers to the actual time when the business behavior event occurred. Accurately recording event time is crucial for subsequent data analysis, user behavior path reconstruction, experimental effect evaluation, and time series analysis. It helps the server understand the context of the event and perform precise time series analysis. For example, the local system time of the client device can be obtained and converted into a unified time format (such as a Unix timestamp or ISO 8601 format string) as the event time information; alternatively, at the time of the event, a high-precision timestamp can be obtained by calling the browser or operating system's API to ensure the accuracy of the time information.

[0075] Correspondingly, identifying the client platform information corresponding to business behavior events refers to the relevant attributes of the device or environment in which the business behavior event occurred, such as operating system type, browser type and version, device model, and network environment. Identifying this information helps the server perform platform differentiation analysis, troubleshoot compatibility issues, and in-depth mining of user behavior characteristics specific to a particular platform. For example, information such as the operating system, browser type, and version can be obtained by parsing the browser's User-Agent string; or, information such as device type and operating system can be obtained by using JavaScript's navigator object (such as navigator.platform, navigator.userAgent) or specific APIs; in mobile applications, detailed information such as device model, operating system version, and network connection type (Wi-Fi / cellular data) can also be obtained by calling the interfaces provided by the SDK.

[0076] Based on this, a multi-dimensional event data structure was constructed by introducing event identifiers, event time information, and client platform information, significantly enhancing the integrity and traceability of event data. When responding to business behavior events triggered on a target page, a unique event identifier is first assigned to the event to ensure its identifiability throughout the data processing chain and avoid data confusion. Simultaneously, determining the precise time information of the event allows the server to construct accurate time series, which is crucial for analyzing user behavior paths, evaluating the real-time effectiveness of experiments, and conducting cross-event correlation analysis. Furthermore, identifying the client platform information from which the event originates enables the server to perform differentiated data cleaning and analysis for different platforms, thereby eliminating statistical bias caused by platform differences. Finally, by organically integrating these newly generated event identifiers, event time information, and client platform information with a snapshot of the common context read from the common context, a structured event carrying experimental dimension fields is generated. This structured event not only includes the attributes of the business behavior itself but also integrates its precise time of occurrence, source platform, and the experimental dimension information of the user, greatly enriching the event's context. Subsequently, the structured event is written to a batch event queue, awaiting reporting to the server based on triggering conditions. This integration approach enables the server to perform accurate event attribution and in-depth analysis based on this structured data, effectively solving the problem that single contextual information is insufficient to support complex business analysis. It is also closely linked to the steps of extracting experimental dimension information and writing it into the common context in the basic solution, ensuring that all business behavior events accurately carry the experimental state at the time of occurrence, providing a solid data foundation for subsequent event analysis and experimental effect evaluation.

[0077] For example, when a user clicks a button on a target page (i.e., triggers a business behavior event), the client immediately initiates the event collection process. First, the system generates a UUID-style event identifier for this click, such as "a1b2c3d4-e5f6-7890-1234-567890abcdef". Simultaneously, it obtains the precise timestamp of the current client device, such as "1678886400000" (corresponding to March 15, 2023, 00:00:00 UTC), as the event time information. Next, by parsing the browser's User-Agent string, it identifies the client platform information, such as "Chrome 110 on Windows 10". After obtaining this metadata, the system reads a snapshot of the public context stored in memory. This snapshot may contain the user ID, session ID, and experimental dimension information obtained from previous experimental traffic splitting request settlements, such as {"experimentA": "variant1", "experimentB": "control"}. Finally, this information is combined with the attributes of the business behavior event itself (such as the event name "button_click" and the button ID "buy_now_button") to generate a complete JSON-formatted structured event. This structured event is then added to the batch event queue and sent to the server when the reporting conditions are met.

[0078] In summary, a unique event identifier ensures event traceability and deduplication capabilities, avoiding confusion during data processing; precise event timing information enables the server to perform refined time-series analysis and user behavior path reconstruction, enhancing the depth of data analysis; and client platform information allows the server to perform platform-specific analysis, ensuring the accuracy and applicability of the data analysis. The combination of this metadata with experimental dimension fields allows the server to more accurately understand the specific context, timing, and source of an event upon receipt, thereby achieving more precise event attribution and more in-depth evaluation of experimental effects. This effectively solves the problem of limited event analysis due to insufficient metadata in traditional solutions, significantly improving the quality and efficiency of data analysis.

[0079] In practical applications, how to balance the timeliness of reporting with the overhead of network requests, and how to ensure the reliability of data reporting when the network environment is unstable or the server is abnormal, are problems that have not yet been effectively solved in existing technologies. In this embodiment, the step of reporting structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue includes: determining that the triggering conditions corresponding to the batch event queue are met when the queue length of the batch event queue reaches the maximum batch size or the timer associated with the batch event queue expires; retrieving the current batch of structured events from the batch event queue according to the triggering conditions, serializing the current batch of structured events into an event array, and reporting the event array to the server; wherein, after the step of reporting structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue is executed, the method further includes: determining the reporting result according to the response status code returned by the server; and, in the case that the response status code is a non-success status code or a network anomaly occurs, retrying the reporting of the event array according to an exponential backoff strategy, abandoning the current batch of structured events and recording the failure information after reaching the maximum number of retries.

[0080] Specifically, a batch event queue is a data structure used to temporarily store multiple structured events. Its purpose is to aggregate individual events to reduce network request frequency and optimize resource utilization. This queue can be implemented using a first-in, first-out (FIFO) queue based on an array or linked list, or a circular buffer that can trigger reporting or overwrite older events when a preset capacity is reached. Triggering conditions are preset criteria used to initiate the process of sending structured events from the batch event queue to the server, aiming to balance real-time reporting and network efficiency. These conditions can include the queue length reaching a preset maximum batch size, or the expiration of a timer associated with the batch event queue. Reaching the maximum batch size as a triggering condition ensures that in high-event scenarios, batch processing of events minimizes the overhead of individual network requests. This can be achieved by checking whether the current queue length has reached or exceeded the maximum batch size after each structured event is enqueued, or by using a counter to trigger reporting when the maximum batch size is reached. The expiration of a timer associated with the batch event queue is another triggering condition, ensuring that structured events do not remain in the queue indefinitely when the event volume is low, thus guaranteeing timely event reporting. This can be a periodically running timer or a one-time timer that starts when the first structured event is enqueued and resets each time a new event is enqueued. Serializing structured events into an event array refers to converting the collection of structured events in a batch event queue into a structured data format suitable for network transmission, such as a JSON array or Protocol Buffers binary format, for efficient batch uploading.

[0081] Correspondingly, reporting to the server refers to transmitting an array of events to a designated server for processing and storage via a network connection. This is typically achieved through HTTP POST requests or WebSocket connections. The response status code returned by the server is the server's feedback on the reporting request, indicating the processing result. For example, in the HTTP protocol, 200 indicates success, 4xx indicates client error, and 5xx indicates server error. The exponential backoff strategy is a retry mechanism characterized by an exponentially increasing wait time between each retrieval. It aims to avoid exacerbating system pressure due to frequent retries when the server is overloaded or the network is unstable, while allowing the server time to recover. This can manifest as a wait of T seconds for the first retry, 2T seconds for the second, 4T seconds for the third, and so on, and random jitter can be introduced to avoid the "thundering herd effect." The maximum number of retries is a preset upper limit for retry attempts, used to prevent infinite retrieval loops, avoid excessive consumption of client resources and network bandwidth, and ensure graceful fault handling. Once the maximum number of retries is reached, abandoning the current batch of structured events and recording failure information means that the system will stop further reporting attempts for that batch of events and record detailed failure logs for diagnosis or subsequent processing, such as removing the failed events from the queue and recording relevant information in local logs or error monitoring systems.

[0082] Based on this, triggering reporting by reaching the maximum batch size in the queue effectively reduces the number of network requests caused by high-frequency events, lowering communication overhead. Triggering reporting by timer expiration ensures that in low-frequency event scenarios, events will not cause data delays due to prolonged queue lag. After determining the triggering conditions, the data transmission structure is further optimized by serializing the structured events of the current batch into an event array for unified reporting, facilitating batch parsing and processing by the server. To address uncertainties in the reporting process, this solution introduces a feedback mechanism based on the response status code returned by the server. By judging whether the response status code is successful, the health status of the reporting link can be monitored in real time. When a non-successful status code occurs or a network anomaly occurs, an exponential backoff strategy is used for retries. This design effectively avoids exacerbating system pressure due to frequent retries when the server load is too high or the network is congested. Furthermore, by setting a maximum number of retries, resource waste caused by infinite retries is avoided while ensuring data reliability. Finally, by recording failure information, a basis is provided for subsequent anomaly investigation and data completion. This solution, combined with the generation of structured events and the writing of batch event queues in the event reporting method, provides a complete and efficient link from event generation to reliable reporting, ensuring that structured events carrying experimental dimension fields can be reported from the client to the server in an efficient and reliable manner.

[0083] For example, suppose a web front-end application contains a JavaScript SDK for collecting user behavior data. This SDK internally maintains a batch event queue to temporarily store various business behavior events of the user on the target page. These events, after processing, become structured events carrying experimental dimension fields. This batch event queue can be a JavaScript array. The system configures a maximum batch size, for example, set to 20. Simultaneously, a timer is started, for example, checking the queue every 5 seconds. When a user interacts with the target page, the corresponding structured events are pushed into the queue. If the queue length reaches 20, the system immediately triggers a reporting operation. If the queue length does not reach 20 within 5 seconds, a reporting operation will still be triggered when the timer expires, even if there are only a few events in the queue. Once the trigger condition is met, the system retrieves all current structured events from the queue. These events are serialized into an event array, usually converted into a JSON string array. Subsequently, this JSON string array is reported to the server via an HTTP POST request. After the request is sent, the client waits for the server's response. If the server returns a 200 status code, the reporting is considered successful, and the reported event is removed from the queue. If the server returns a 500 or 400 status code, or if a network error occurs, the system will initiate a retry mechanism. The first retry may occur after 1 second. If it fails again, the second retry will occur after 2 seconds. If it fails again, the third retry will occur after 4 seconds. The system will preset a maximum number of retries, for example, 3. If it still fails after the third retry, the system will discard the current batch of structured events and log the failure information, such as printing an error log in the browser's console or storing the failed event in local persistent storage.

[0084] In summary, when the batch event queue reaches its maximum batch size, multiple structured events can be merged into a single reporting request, significantly reducing the frequency of network requests and lowering network overhead and server processing pressure, especially in high-concurrency scenarios. Simultaneously, by using the expiration of the timer associated with the batch event queue as another trigger condition, it ensures that even with a small number of events, structured events are reported promptly within a preset time window, preventing prolonged data stagnation and guaranteeing timely reporting. Furthermore, to address potential server errors or network anomalies during reporting, this solution introduces an exponential backoff retry mechanism based on response status codes. This mechanism avoids exacerbating system burden due to frequent retries when server load is too high or network congestion occurs. Instead, it gradually extends the retry interval, giving the server or network time to recover, thereby improving the reporting success rate. Setting a maximum number of retries effectively prevents resource waste caused by infinite retries and records failure information when finally abandoning the attempt, providing a basis for subsequent troubleshooting and data recovery. By combining the generation of structured events and the writing of public context in the event reporting method, this solution ensures that structured events carrying experimental dimension fields can be reported from the client to the server in an efficient and reliable manner, providing a complete and high-quality data foundation for subsequent event analysis and processing, and avoiding data loss or analysis bias caused by reporting failure or delay.

[0085] Existing event reporting methods often fail to send timely asynchronous requests when the browser page is closed, switched to the background, or redirected, leading to data loss because the page lifecycle ends. Relying solely on timed reporting increases request frequency and lacks a reliable data transmission mechanism for page unloading scenarios. To address this, in this embodiment, after the step of reporting structured events in the batch event queue to the server based on the triggering conditions corresponding to the batch event queue, the method further includes: upon detecting a page hide event or page unloading event on the target page, canceling the timer and reading the current batch of structured events from the batch event queue; serializing the current batch of structured events into data packets and sending the data packets to the server through a page unloading data sending interface, wherein the page unloading data sending interface does not block page closure.

[0086] Specifically, detecting page hide events or page unload events of a target page refers to monitoring page lifecycle events emitted by the browser or operating system. Page hide events typically indicate a page changing from a visible to an invisible state, such as when a user switches to another tab, minimizes the browser window, or switches the browser application to the background. Page unload events indicate that the page is about to be destroyed, such as when a user closes a tab, closes the browser window, or navigates to another page. Those skilled in the art can achieve this by listening to relevant events provided by the browser. For example, they can listen to the `visibilitychange` event to detect changes in the page's hidden / shown state, or listen to the `pagehide`, `beforeunload`, or `unload` events to detect page unloading behavior. The triggering mechanisms and timing of these events may vary slightly in different browser environments, but their core purpose is to provide an opportunity to perform cleanup or data saving operations before the page's lifecycle ends.

[0087] Correspondingly, canceling a timer means stopping the timing mechanism previously set for the batch event queue for periodically reporting events. In the event reporting methods described above, the batch event queue is typically associated with a timer to ensure that events are reported after a certain time interval, even if the queue has not reached its maximum batch size. When a page hides or is unloaded, to avoid triggering redundant timed reporting logic when the page is about to be destroyed, the timer needs to be actively canceled. This can be achieved by calling functions such as clearTimeout() or clearInterval(), ensuring that all pending events can be reported all at once through a more reliable mechanism before the page is closed, avoiding duplicate or conflicting reporting operations.

[0088] Correspondingly, reading the current batch of structured events from the batch event queue means that after detecting a page hide or unload event, all currently accumulated structured events are immediately retrieved from the queue storing events to be reported. The batch event queue is a container used to temporarily store business behavior events; these events are only reported in batches when specific triggering conditions are met (such as queue length or timer expiration). In special scenarios where the page is about to close, it is necessary to ensure that all unreported events in the queue are processed in a timely manner. Therefore, the system reads all currently available structured events from the queue at once, forming a batch to be sent.

[0089] Correspondingly, serializing the current batch of structured events into data packets refers to converting the collection of structured events read from the batch event queue into a format suitable for network transmission. Structured events typically exist in memory as objects or arrays, containing event identifiers, time information, client platform information, and experiment dimension fields. For network transmission, this data needs to be serialized into a string format, such as a JSON (JavaScript Object Notation) string. Serialized data packets can be transmitted over the network more efficiently and stably.

[0090] Correspondingly, sending data packets to the server via the page unloading data sending interface refers to using a specific API provided by the browser to send data as the page is about to be unloaded. The characteristic of this interface is that its design goal is to reliably send a small amount of data at the end of the page's lifecycle without blocking the page closing process, thus ensuring a good user experience. For example, the `navigator.sendBeacon()` method can be used, which allows the browser to asynchronously send HTTP POST requests in the background, and the request can continue to complete even after the page has been unloaded. Another implementation is to use the `fetch()` API with the `keepalive: true` option set, which also ensures that the request continues after the page is unloaded and does not block the page closing process.

[0091] Correspondingly, the fact that the page unloading data sending interface does not block page closing is one of the key features of this technical solution. Traditional asynchronous requests (such as XMLHttpRequest or Fetch API in default mode) may be interrupted by the browser during page unloading, or if set as synchronous requests, they will block page closing, resulting in a poor user experience. However, the page unloading data sending interface (such as sendBeacon or fetch and keepalive) is designed to run independently in the background, independent of the page's liveness, and will not delay page closing or redirection, thus ensuring the reliability of data reporting while maintaining a smooth user interaction experience.

[0092] Based on this, upon detecting a page hiding or unloading event, the system proactively intervenes and cancels the original timer. This operation avoids triggering redundant timed reporting logic when the page is about to be destroyed, ensuring the orderly nature of the reporting process. By extracting the current batch of structured events from the batch event queue, the system can uniformly encapsulate the backlog of data to be reported and send it using a dedicated interface that does not block page closing. The unique aspect of this approach is that it tightly binds the triggering timing of data reporting to the page's lifecycle state. This ensures that as much data as possible is retained before the page is destroyed, while the non-blocking sending interface avoids the risk of page closing delays or forced interruptions due to network request timeouts, thus maintaining a good user experience while ensuring data integrity. Combined with basic event reporting methods, after responding to business behavior events and generating structured events, this approach can not only perform batch reporting via timed or queue length triggers, but also send all unreported events as a fallback before the page's lifecycle ends, greatly improving the completeness and reliability of data collection.

[0093] For example, suppose a web application integrates an event collection SDK. This SDK is responsible for collecting user behavior events on a target page and writing them to a batch event queue. This queue typically has a timer set to check it every 5 seconds, and if there are events in the queue, it reports them to the server. The queue may also have a maximum batch size, such as 100 events; once the queue length reaches this value, reporting is triggered immediately. While the user is browsing the target page, the SDK continuously collects events and adds them to the queue. If the user suddenly clicks an external link or closes a browser tab, this triggers a page unloading event (e.g., PageHide or BeforeUnload). At this point, the SDK immediately detects these events and performs the following actions: First, it cancels the previously set timer to prevent timed reporting from triggering again when the page is about to close. Next, the SDK reads all unreported structured events from the batch event queue. For example, if there are 7 events in the queue, the SDK will retrieve all 7 events at once. Then, the SDK serializes these structured events into a JSON data packet. Finally, the SDK calls the `navigator.sendBeacon()` interface to send this JSON data packet to the server. Due to the non-blocking nature of the `sendBeacon()` interface, sending the data packet will not delay page closing or redirection, ensuring a smooth user experience. It also guarantees that all unreported events are reliably sent before the page's lifecycle ends.

[0094] In summary, the above-described approach effectively addresses the issue of data loss that can occur with conventional asynchronous requests in scenarios such as browser page closure, background switching, or navigation, significantly improving the completeness and reliability of event data reporting. Furthermore, by employing a non-blocking sending interface for page closure, it avoids page closure delays or user experience degradation caused by data reporting, achieving a good balance between data collection and user experience. As a supplement to the basic event reporting mechanism, this solution ensures that all collected but not yet reported events are properly processed at the end of the page's lifecycle, thereby improving the accuracy of data analysis.

[0095] In practice, since multiple business components or modules within a page may simultaneously need to obtain experimental configurations, if each component initiates a request independently, it will lead to duplicate network overhead, resource contention, and inconsistent traffic distribution results obtained by different components, thereby causing page rendering logic conflicts or data attribution confusion. To address this, in this embodiment, creating a shared waiting object in the page instance of the target page includes: creating a globally unique waiting object in the page instance of the target page as the shared waiting object, wherein the shared waiting object is used to carry the settlement result of the experimental traffic distribution request; multiple callers associated with the target page obtain the shared waiting object through a unified reading interface, and the shared waiting object obtained by the multiple callers is the same; wherein, settling the shared waiting object according to the request execution information of the experimental traffic distribution request includes: settling the shared waiting object according to the response result or timeout status of the experimental traffic distribution request, so that the multiple callers simultaneously obtain the traffic distribution result or empty result corresponding to the shared waiting object.

[0096] Specifically, creating a globally unique wait object within the target page instance, as a shared wait object, means initializing a wait object whose only instance exists throughout the entire page's lifecycle within the context of the target page's loading and execution. This wait object can achieve global uniqueness in several ways. For example, it can be designed using the Singleton Pattern in JavaScript to ensure that the same object instance is always returned regardless of how many times it is requested; or it can be stored in a variable with a specific identifier defined in the page's global scope (such as the window object), initialized on the first access, and subsequently returned directly from the existing variable. This shared wait object is used to carry the settlement results of the experimental routing request, meaning it will serve as a container for the final processing status and data of the experimental routing request. This object can be a Promise object, whose resolve or reject state will carry the settled routing data or an empty result; or it can be a regular JavaScript object with specific state properties (such as status, data, error), which are updated after the experimental routing request is processed. Multiple callers associated with the target page obtain a shared waiting object through a unified reading interface, and the shared waiting object obtained by multiple callers is the same. This means that in order to ensure that all business components or modules within the page that need experimental routing results can access the same shared waiting object, the system provides a public and standardized access point.

[0097] For example, it could be a global function or a method exported by a module, which all callers use to obtain the shared wait object. The internal logic of this interface manages the creation and return of the shared wait object, ensuring that each call returns the same unique object instance. Settling the shared wait object based on the response result or timeout status of the experiment splitting request refers to updating the shared wait object according to its final state after the experiment splitting request's lifecycle ends. When the experiment splitting request successfully returns data, the system parses the response data, assigns the extracted splitting result (e.g., experiment grouping information) to the shared wait object, and marks its status as completed. When the request fails due to network errors, server errors, or other reasons, or if no response is received within the preset timeout period, the shared wait object will be settled with an empty result and marked with the corresponding failure or timeout status. Enabling multiple callers to simultaneously receive the routing result or null result corresponding to a shared wait object means that since all callers requiring the routing result hold a reference to the same shared wait object, once the object is settled (whether successfully, unsuccessfully, or through a timeout), all callers listening for changes in the object's state can immediately and synchronously obtain the latest settlement result. For example, if the shared wait object is a Promise, all callback functions registered using the `.then()` or `.catch()` methods will be executed after the Promise's state is determined, thus ensuring information consistency and synchronization.

[0098] Based on this, a globally unique shared wait object is created in the page instance of the target page, and a unified read interface is provided to achieve singleton management of experimental traffic splitting requests. Upon responding to a loading request for the target page, the system calls the target toolkit to read configuration information and creates this globally unique shared wait object in the page instance based on the experimental traffic splitting address information in the configuration information. Simultaneously, an asynchronous experimental traffic splitting request is initiated. All business components or modules within the page that require experimental traffic splitting results, regardless of when or where they initiate the request, will obtain the same shared wait object through the unified read interface. When the asynchronously initiated experimental traffic splitting request completes (whether with a successful response, a failed response, or a timeout), the system will settle the shared wait object based on the request's execution information, updating its status to include a traffic splitting result or an empty result. Since all callers reference the same shared wait object, once this object is settled, all callers can simultaneously and consistently obtain the final traffic splitting result or an empty result. This ensures that subsequent steps, such as extracting experimental dimension information based on settlement results and writing it into the public context, as well as generating structured events carrying experimental dimension fields in response to business behavior events, are all based on a unified and definite experimental routing result, thereby avoiding page rendering conflicts or event attribution errors caused by inconsistent routing results.

[0099] For example, suppose an e-commerce website's product detail page needs to display different product recommendation modules and promotional information based on the user's experiment group. When the page loads, a JavaScript library called ExperimentSDK is initialized. Internally, ExperimentSDK maintains a globally unique Promise object, for example, named _sharedExperimentPromise. When the page load request is responded to, ExperimentSDK asynchronously initiates an experiment routing request based on the configuration information. The product recommendation module and the promotional information module on the page, during their respective initialization, will call the ExperimentSDK.getExperimentResult() method to obtain the experiment routing result. The getExperimentResult() method checks whether _sharedExperimentPromise already exists and has not been settled. If it does not exist, it creates a new Promise, initiates a network request to obtain the experiment routing data, then stores the Promise in _sharedExperimentPromise and returns it. If _sharedExperimentPromise already exists, it directly returns that Promise. When the experiment splitting request successfully returns data, ExperimentSDK parses the data and calls `_sharedExperimentPromise.resolve(splitResult)` to resolve the Promise. If the request fails or times out, it calls `_sharedExperimentPromise.resolve(null)` or `_sharedExperimentPromise.reject(error)`. This way, both the product recommendation module and the promotion information module listen for the same Promise's resolution result using `_sharedExperimentPromise.then(result => { ...})`. Once the Promise is resolved, both modules will receive the same `splitResult` or `null`, ensuring they render and display based on consistent experiment grouping information.

[0100] In summary, by introducing a globally unique shared wait object and a unified read interface, the system ensures that all callers obtain the same experimental routing result, thus avoiding situations where different components obtain different routing results due to differences in asynchronous request timing. This not only reduces network load and resource consumption, but more importantly, it guarantees the consistency of experimental logic within the page, avoiding issues such as page rendering flickering, inconsistent event attribution, and the appearance of two experimental versions within the same page instance caused by inconsistent routing results. This significantly improves the accuracy of experimental data collection and the stability of system operation.

[0101] Existing event reporting methods, when performing experimental traffic splitting, often encounter situations where not all pages or business scenarios are configured with experimental traffic splitting addresses. If an experimental traffic splitting address is mandatory for event collection, normal business behavior events on pages without experimental settings cannot be collected and reported, resulting in missing data statistics. To address this, in this embodiment, before the steps of creating a shared waiting object in the page instance of the target page based on the experimental traffic splitting address information in the configuration information, and asynchronously initiating an experimental traffic splitting request based on the experimental traffic splitting address information, the method further includes: performing an event collection operation if the experimental traffic splitting address information is not present in the configuration information; during the execution of the event collection operation, generating a target structured event in response to a business behavior event triggered on the target page, wherein the target structured event does not carry an experimental dimension field; writing the target structured event without the experimental dimension field into the batch event queue, and reporting the target structured event to the server according to the triggering conditions.

[0102] To implement the above solution, firstly, it is necessary to determine whether experimental routing address information exists in the configuration information. This determination can be accomplished by parsing the internal structure of the configuration information. For example, checking for the existence of a specific field or key-value pair named "experimental routing address information"; if the field is missing or its value is empty, it is determined that it does not exist. Alternatively, the validity of the experimental routing address information can be verified using a preset verification function when loading or processing the configuration information; if the verification fails, it is considered that it does not exist. When it is confirmed that experimental routing address information does not exist in the configuration information, the system will perform an event collection operation. This operation may include initializing event listeners, such as binding click, input, and other event handlers to specific user interface elements on the target page, so as to capture relevant data when the user triggers these behaviors. At the same time, an event queue management module can also be started. This module is responsible for receiving, temporarily storing, and managing events to be reported, and preparing necessary information such as public context to ensure the readiness of the event collection chain. During the execution of the event collection operation, in response to business behavior events triggered on the target page, the system will generate target structured events. The business behavior events can be user interactions such as clicking, scrolling, and inputting on the target page, or system events such as changes in the state of internal components. The target structured event is event data encapsulated according to a predefined format, crucially excluding experimental dimension fields. This means that when constructing the event, any identifiers or attributes related to the experimental distribution results, such as experiment IDs or variant groups, are explicitly excluded. This can be achieved through an event constructor function that receives the raw business behavior data and generates a JSON object or data structure without experimental dimension fields according to the specification. Subsequently, the target structured event without experimental dimension fields is written to the batch event queue. The batch event queue is typically an in-memory data structure, such as an array or linked list, used to temporarily store multiple events to be reported. Writing events to the queue effectively reduces the number of communications with the server, improving reporting efficiency. Finally, based on the triggering conditions corresponding to the batch event queue, the target structured event is reported to the server. The triggering conditions may include, but are not limited to, the queue length of the batch event queue reaching a preset maximum batch size, or the expiration of a timer associated with the batch event queue. Once any triggering condition is met, the system will retrieve the current batch of events from the queue and send them to the server for processing.

[0103] Based on this, after the target page loads and the target toolkit is invoked to read the configuration information, the system first checks the configuration information. If the system finds that the experimental routing address information is missing from the configuration information, it intelligently skips the complex processes related to experimental routing, such as creating a shared waiting object, asynchronously initiating an experimental routing request, and subsequently extracting and writing experimental dimensions into the public context. Instead, the system directly enters the basic event collection mode. In this mode, when a user triggers any business behavior event on the target page, the system immediately responds and generates a target structured event. This event only contains information related to the business behavior itself, such as event type, timestamp, and client platform information, but explicitly does not contain any experimental dimension fields. This design ensures that even in scenarios without experimental routing, basic business data can be recorded completely and accurately. Subsequently, these structured events without experimental dimension fields are uniformly written into a batch event queue and reported to the server in batches according to preset triggering conditions (such as queue length or timer). In this way, the solution in this application forms a complementary and compatible mechanism with the basic event reporting method. When an experiment splitting configuration exists, the system performs experiment splitting, dimension injection, and reporting according to the basic scheme. When no experiment splitting configuration exists, the system automatically switches to the simplified path provided by this scheme, ensuring that the collection and reporting of basic events are unaffected. This design makes the entire event reporting system more robust and flexible, adapting to the needs of different configurations and business scenarios, avoiding data statistics blind spots caused by missing experiment configurations, and thus ensuring the comprehensiveness and continuity of data collection.

[0104] For example, suppose a product details page on an e-commerce website loads without any experimental routing address information in its associated configuration information, meaning the page is not currently participating in any A / B testing. When a user visits this page, the system will first read this configuration status. Since there is no experimental routing address information, the system will not attempt to initiate an experimental routing request, nor will it create a shared wait object. Instead, it will directly activate the basic event collection function. At this point, if the user clicks the "Add to Cart" button on the page, the system will immediately capture this business behavior event. The event collection module will generate a structured JSON object based on a preset event template, such as {"eventName": "addToCart","timestamp": 1678886400000, "productId": "P12345", "platform": "web"}. It is worth noting that this JSON object will not contain any experimental dimension fields such as "experimentId" or "variantGroup". Subsequently, this structured event without experimental dimension fields will be added to an array named eventQueue in memory. When the number of events in the eventQueue reaches, for example, 10, or when 5 seconds have passed since the last report, the system will package all events in the eventQueue and send them to the server via the browser's navigator.sendBeacon interface or an asynchronous XMLHttpRequest request. This method ensures that even on pages without event routing, key user actions can be recorded and reported promptly and accurately.

[0105] In summary, by introducing conditional checks before executing experiment routing requests, the system can intelligently select the event collection path based on the availability of configuration information. Without experiment routing configuration, the system can directly collect basic events, generate structured events without experiment dimension fields, and report them in batches, ensuring complete recording of all business behavior events and avoiding data blind spots. This significantly enhances the compatibility and robustness of the event reporting system, enabling it to flexibly adapt to the needs of different pages and business scenarios, guaranteeing the comprehensiveness and continuity of data collection, and providing a more reliable foundation for subsequent data analysis.

[0106] The following is in conjunction with the appendix Figure 2 Taking the application of the event reporting method provided in this specification in a video browsing page as an example, the event reporting method will be further explained. Figure 2 The present specification illustrates a flowchart of an event reporting method according to an embodiment, which includes the following steps.

[0107] In step S202, in response to the loading request for the target page, the target toolkit is invoked to read the configuration information corresponding to the target page.

[0108] Step S204: Based on the experimental routing address information in the configuration information, create a shared waiting object in the page instance of the target page, and asynchronously initiate an experimental routing request based on the experimental routing address information.

[0109] Step S206: Calculate the shared waiting object based on the request execution information of the experimental diversion request, extract the experimental dimension information based on the settlement result and write it into the public context.

[0110] Step S208: In response to a business behavior event triggered for the target page, read the public context snapshot corresponding to the public context.

[0111] Step S210: Assign an event identifier to the business behavior event, determine the event time information corresponding to the business behavior event, and identify the client platform information corresponding to the business behavior event.

[0112] Step S212: Based on the event identifier, event time information, client platform information, and public context snapshot, generate a structured event carrying the experiment dimension field, and write the structured event into the batch event queue.

[0113] Step S214: If the queue length of the batch event queue reaches the maximum batch number, or the timer of the associated batch event queue expires, determine that the triggering condition corresponding to the batch event queue is met.

[0114] Step S216: Retrieve the current batch of structured events from the batch event queue according to the triggering condition, serialize the current batch of structured events into an event array, and report the event array to the server.

[0115] Step S218: Determine the reporting result based on the response status code returned by the server.

[0116] In step S220, if the response status code is a non-success status code or a network anomaly occurs, the event array is retried and reported according to the exponential backoff strategy. After reaching the maximum number of retries, the current batch of structured events is abandoned and the failure information is recorded.

[0117] In summary, by creating a shared waiting object in the page instance of the target page and asynchronously initiating experimental routing requests, and calculating the shared waiting object based on the request execution information to ensure the consistency of experimental dimension information, and by combining a common context and a batch event queue to achieve reliable reporting of structured events, the system avoids duplicate initiation of experimental routing requests and inconsistent results, prevents interface flickering and context tampering caused by response delays, and improves the accuracy and reliability of event reporting.

[0118] Corresponding to the above method embodiments, this specification also provides an event reporting system embodiment. Figure 3 A schematic diagram of the structure of an event reporting system according to one embodiment of this specification is shown. Figure 3 As shown, the event reporting system 300 includes a client 310 and a server 320, including: The client 310 is configured to, in response to a loading request for a target page, call the target toolkit to read the configuration information corresponding to the target page; create a shared waiting object in the page instance of the target page according to the experimental routing address information in the configuration information, and asynchronously initiate an experimental routing request according to the experimental routing address information; settle the shared waiting object according to the request execution information of the experimental routing request, extract experimental dimension information according to the settlement result and write it into the public context; in response to a business behavior event triggered for the target page, read the public context snapshot corresponding to the public context, generate a structured event carrying an experimental dimension field according to the public context snapshot and the business behavior event, and write the structured event into a batch event queue; and report the structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue. The server 320 is used to receive structured events reported by the client and perform event analysis and processing based on the experiment dimension field in the structured events.

[0119] This embodiment combines a shared wait object with a public context snapshot mechanism on a page instance basis to ensure the uniqueness and consistency of experimental traffic splitting results. Specifically, by creating a shared wait object in the page instance, it ensures that multiple callers can obtain the same traffic splitting result, avoiding duplicate requests and result competition; by using configuration information to drive asynchronous traffic splitting requests and processing them in parallel with page loading, the impact of traffic splitting latency on page rendering is effectively reduced; by writing experimental dimension information into the public context and reading the context snapshot when triggering business behavior, it ensures that the generated structured events can automatically carry accurate experimental dimension fields, solving the problem of difficulty in associating experimental data with business behavior; the design of the batch event queue combines triggering conditions and reporting mechanisms, which not only optimizes the network request frequency but also ensures the consistency of data format through structured processing. Through the above technical solutions, accurate analysis of experimental effects is achieved, improving the accuracy of the data tracking and the stability of system operation.

[0120] The above is an illustrative scheme of an event reporting system according to this embodiment. It should be noted that the technical solution of this event reporting system and the technical solution of the event reporting method described above belong to the same concept. For details not described in detail in the technical solution of the event reporting system, please refer to the description of the technical solution of the event reporting method described above.

[0121] Corresponding to the above method embodiments, this specification also provides embodiments of an event reporting device. Figure 4 A schematic diagram of an event reporting device according to one embodiment of this specification is shown. Figure 4 As shown, the device includes: Module 402 is configured to invoke the target toolkit to read the configuration information corresponding to the target page in response to a loading request for the target page. The creation module 404 is configured to create a shared waiting object in the page instance of the target page according to the experimental routing address information in the configuration information, and asynchronously initiate an experimental routing request according to the experimental routing address information. The writing module 406 is configured to settle the shared waiting object according to the request execution information of the experimental diversion request, extract experimental dimension information according to the settlement result and write it into the public context; The reading module 408 is configured to, in response to a business behavior event triggered for the target page, read a public context snapshot corresponding to the public context, generate a structured event carrying an experimental dimension field based on the public context snapshot and the business behavior event, and write the structured event into a batch event queue. The reporting module 410 is configured to report the structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue.

[0122] The above is an illustrative scheme of an event reporting device according to this embodiment. It should be noted that the technical solution of this event reporting device and the technical solution of the event reporting method described above belong to the same concept. For details not described in detail in the technical solution of the event reporting device, please refer to the description of the technical solution of the event reporting method described above.

[0123] Figure 5 A structural block diagram of a computing device 500 according to one embodiment of this specification is shown. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and a database 550 is used to store data.

[0124] The computing device 500 also includes an access device 540, which enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 540 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.

[0125] In one embodiment of this specification, the above-described components of the computing device 500 and Figure 5 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 5The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0126] The computing device 500 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 500 can also be a mobile or stationary server.

[0127] The processor 520 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-described event reporting method.

[0128] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the event reporting method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the event reporting method described above.

[0129] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described event reporting method.

[0130] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the event reporting method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the event reporting method described above.

[0131] An embodiment of this specification also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described event reporting method.

[0132] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the event reporting method described above belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the event reporting method described above.

[0133] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0134] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0135] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0136] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0137] The preferred embodiments disclosed above are merely illustrative of this specification. Optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described in this specification. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification.

Claims

1. An event reporting method, characterized in that, include: In response to a request to load the target page, the target toolkit is invoked to read the configuration information corresponding to the target page; Based on the experimental routing address information in the configuration information, a shared waiting object is created in the page instance of the target page, and an experimental routing request is asynchronously initiated based on the experimental routing address information. The shared waiting object is settled according to the request execution information of the experimental diversion request, and the experimental dimension information is extracted and written into the public context according to the settlement result; In response to a business behavior event triggered for the target page, a public context snapshot corresponding to the public context is read, a structured event carrying an experiment dimension field is generated based on the public context snapshot and the business behavior event, and the structured event is written into a batch event queue. Based on the triggering conditions corresponding to the batch event queue, the structured events in the batch event queue are reported to the server.

2. The event reporting method according to claim 1, characterized in that, The step of asynchronously initiating an experimental traffic splitting request based on the experimental traffic splitting address information includes: A stop controller is created based on the experimental off-line address information, and a timer associated with the stop controller is started based on the timeout threshold information in the configuration information; The experimental traffic splitting request is initiated asynchronously in the background through the browser's network request interface, wherein the experimental traffic splitting request is executed in parallel with the loading of page resources of the target page; After the step of asynchronously initiating the experimental traffic splitting request based on the experimental traffic splitting address information is executed, the method further includes: When the timer is triggered, the experiment diversion request that is in the execution state is canceled by the stop controller.

3. The event reporting method according to claim 2, characterized in that, The step of settling accounts with the shared waiting object based on the request execution information of the experimental traffic splitting request includes: The response type corresponding to the shared waiting object is determined based on the request execution information of the experimental diversion request, wherein the response type includes at least one of the response success type, response failure type, and timeout type; If the response type is the response success type, verify the status code and service return code of the experimental traffic splitting request response. If both the status code and the service return code are successful and the response data contains an allocation set, extract the allocation set from the response data and calculate the shared waiting object as a traffic splitting result associated with the allocation set. If the response type is the response failure type, the shared wait object will be settled as an empty result; In the case where the response type is the timeout type, the in-transit request is canceled by the abort controller, the shared waiting object is settled as an empty result, and the settled status is marked.

4. The event reporting method according to claim 3, characterized in that, After the step of extracting the allocation set from the response data is performed, the method further includes: Iterate through each experimental key in the allocation set, and read the variant group field corresponding to each experimental key based on the iteration result; retain entries where the variant group field is a string type, and generate a dimension snapshot based on the retained entries, wherein the dimension snapshot contains the correspondence between experimental keys and variant group fields; calculate the shared wait object as a splitting result associated with the dimension snapshot; or, If none of the entries in the allocation set meet the constraints, the shared wait object will be settled as an empty result.

5. The event reporting method according to claim 4, characterized in that, The step of extracting experimental dimension information based on the settlement results and writing it into the public context includes: The dimension snapshot is serialized into a target string, and the target string is written into the experimental dimension field of the public context; After the step of extracting experimental dimension information based on the settlement result and writing it into the public context is executed, the method further includes: The experimental keys in the dimensional snapshot are sorted lexicographically, stable keys are generated in key-value concatenation form, and the stable keys are compared with the recorded stable keys. If the stabilizing key is different from the recorded stabilizing key, an exposure event is generated based on the dimensional snapshot, and the exposure event is written to the batch event queue.

6. The event reporting method according to claim 3, characterized in that, After the step of settling accounts with the shared waiting object based on the request execution information of the experimental diversion request is executed, the method further includes: If the shared waiting object has an empty settlement result and is marked as settled, and a late response to the experimental diversion request is received, check the settled status; If the settled status is settled, discard the late response and ensure that the public context does not contain experimental dimension information; If the settled status is unsettled, the late response is used as the response to the experimental traffic splitting request, and the steps of verifying the status code and service return code of the response to the experimental traffic splitting request are performed.

7. The event reporting method according to claim 1, characterized in that, The step of generating a structured event carrying an experiment dimension field based on the public context snapshot and the business behavior event includes: Assign an event identifier to the business behavior event, determine the event time information corresponding to the business behavior event, and identify the client platform information corresponding to the business behavior event; Based on the event identifier, the event time information, the client platform information, and the public context snapshot, a structured event carrying an experiment dimension field is generated.

8. The event reporting method according to claim 1, characterized in that, The step of reporting structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue includes: If the queue length of the batch event queue reaches the maximum batch size, or if the timer associated with the batch event queue expires, the triggering condition corresponding to the batch event queue is determined to be met. According to the triggering condition, the current batch of structured events is retrieved from the batch event queue, the current batch of structured events is serialized into an event array, and the event array is reported to the server. The step of reporting structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue further includes: The reporting result is determined based on the response status code returned by the server; If the response status code is a non-success status code or a network anomaly occurs, the event array is retried and reported according to the exponential backoff strategy. After reaching the maximum number of retries, the current batch of structured events is abandoned and the failure information is recorded.

9. The event reporting method according to claim 8, characterized in that, After the step of reporting the structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue is executed, the method further includes: If a page hide event or page unload event is detected on the target page, the timer is canceled and the current batch of structured events is read from the batch event queue; The structured events of the current batch are serialized into data packets, and the data packets are sent to the server through the page unload data sending interface, wherein the page unload data sending interface does not block page closing.

10. The event reporting method according to claim 1, characterized in that, Creating a shared wait object in the page instance of the target page includes: A globally unique wait object is created in the page instance of the target page as the shared wait object, wherein the shared wait object is used to carry the settlement result of the experimental diversion request; multiple callers associated with the target page obtain the shared wait object through a unified reading interface, and the shared wait object obtained by the multiple callers is the same; The step of settling accounts with the shared waiting object based on the request execution information of the experimental diversion request includes: The shared waiting object is settled based on the response result or timeout status of the experimental traffic splitting request, so that the multiple callers simultaneously obtain the traffic splitting result or empty result corresponding to the shared waiting object.

11. The event reporting method according to claim 1, characterized in that, Before the step of creating a shared wait object in the page instance of the target page according to the experimental traffic splitting address information in the configuration information, and asynchronously initiating an experimental traffic splitting request according to the experimental traffic splitting address information, the method further includes: If the experimental offload address information is not present in the configuration information, perform the event acquisition operation. During the execution of the event collection operation, a target structured event is generated in response to the business behavior event triggered for the target page, wherein the target structured event does not carry an experiment dimension field; The target structured event without the experimental dimension field is written into the batch event queue, and the target structured event is reported to the server according to the triggering condition.

12. An event reporting system, characterized in that, Including both client and server sides, including: The client is configured to, in response to a loading request for a target page, invoke the target toolkit to read the configuration information corresponding to the target page; create a shared waiting object in the page instance of the target page according to the experimental routing address information in the configuration information, and asynchronously initiate an experimental routing request according to the experimental routing address information; settle the shared waiting object according to the request execution information of the experimental routing request, extract experimental dimension information according to the settlement result and write it into the public context; in response to a business behavior event triggered for the target page, read the public context snapshot corresponding to the public context, generate a structured event carrying an experimental dimension field according to the public context snapshot and the business behavior event, and write the structured event into a batch event queue; and report the structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue. The server is used to receive structured events reported by the client and perform event analysis and processing based on the experiment dimension field in the structured events.

13. An event reporting device, characterized in that, include: The calling module is configured to call the target toolkit to read the configuration information corresponding to the target page in response to a loading request for the target page; The creation module is configured to create a shared waiting object in the page instance of the target page according to the experimental routing address information in the configuration information, and asynchronously initiate an experimental routing request according to the experimental routing address information; The writing module is configured to settle the shared waiting object according to the request execution information of the experimental diversion request, extract experimental dimension information according to the settlement result and write it into the public context; The reading module is configured to, in response to a business behavior event triggered for the target page, read a public context snapshot corresponding to the public context, generate a structured event carrying an experiment dimension field based on the public context snapshot and the business behavior event, and write the structured event into a batch event queue. The reporting module is configured to report the structured events in the batch event queue to the server according to the triggering conditions corresponding to the batch event queue.

14. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 11.

15. A computer-readable storage medium, characterized in that, It stores computer-executable instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 11.

16. A computer program product, characterized in that, It includes a computer program or instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 11.