Webpage residence time acquisition method and device, electronic equipment and storage medium

By introducing independent web worker threads into browser applications, the problem of blocking the main thread when the web page dwell time data acquisition is solved, improving the user experience and ensuring the accuracy of the data.

CN120295874APending Publication Date: 2025-07-11DUXIAOMAN TECH (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510348614.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

When obtaining the dwell time of web pages, the existing technology can easily block the main thread of the browser application, resulting in page lag, affecting the user experience, and inaccurate data acquisition.

Method used

The web worker thread is introduced into the browser application, making it independent of the main thread, and the operation data of the target object is monitored and processed through the web worker thread, and the collection and processing of web page residence time is independently completed.

Benefits of technology

It avoids the main thread being blocked, improves the experience of browser applications, and ensures the accuracy and acquisition efficiency of web page residence time data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295874A_ABST
    Figure CN120295874A_ABST
Patent Text Reader

Abstract

The invention provides a webpage residence time obtaining method and device, electronic equipment and a storage medium, and relates to the front-end technical field, the method comprises the following steps: after a starting operation of a target object on a browser application is received, initializing a web worker thread, the web worker thread and a main thread running by the browser application being mutually independent; monitoring a target object operation of the target object on the browser application through a web worker thread; and determining webpage residence time data of the target object in the browser application through the web worker thread based on the monitored target object operation. According to the method, the influence on the normal operation of the browser application main thread when the webpage stay time data is captured can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of front-end technologies, and particularly to a method, apparatus, electronic device, and storage medium for obtaining the web page stay time. Background Art

[0002] Browser applications are application programs used to retrieve, display, and transfer web page information resources, and are one of the indispensable applications for users to obtain resource information daily. During the use of browser applications, collecting and analyzing user behavior data in browser applications helps business personnel understand the usage of browser applications and provides data support for the improvement of browser applications. Summary of the Invention

[0003] This application provides a method, apparatus, electronic device, and storage medium for obtaining the web page stay time, which can avoid affecting the normal operation of the main thread of the browser application when capturing web page stay time data. The technical solutions are as follows:

[0004] According to one aspect of this application, a method for obtaining the web page stay time is provided. The method includes:

[0005] After receiving the opening operation of the browser application by the target object, initialize a web worker thread, where the web worker thread is independent of the main thread on which the browser application runs;

[0006] Monitor the target object operation of the target object on the browser application through the web worker thread;

[0007] Based on the monitored target object operation, determine the web page stay time data of the target object in the browser application through the web worker thread.

[0008] According to another aspect of this application, a device for obtaining the web page stay time is provided. The device includes:

[0009] An initialization module, configured to initialize a web worker thread after receiving the opening operation of the browser application by the target object, where the web worker thread is independent of the main thread on which the browser application runs;

[0010] A first monitoring module, configured to monitor the target object operation of the target object on the browser application through the web worker thread;

[0011] A first determination module, configured to determine the web page stay time data of the target object in the browser application based on the monitored target object operation through the web worker thread.

[0012] According to one aspect of the present application, there is provided an electronic device, including: a processor and a memory storing a program, the program including instructions which, when executed by the processor, cause the processor to execute the method for obtaining the web page stay time as described above.

[0013] According to another aspect of the present application, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the method for obtaining the web page stay time as described above.

[0014] According to another aspect of the present application, there is provided a computer program product, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method for obtaining the web page stay time as described above.

[0015] The beneficial effects brought by the technical solution provided by the embodiments of the present application at least include:

[0016] By introducing a web worker into a browser application, and initializing and creating a web worker thread after receiving an opening operation of a browser application by a target object, and the web worker thread is independent of the main thread on which the browser application runs, it is possible to run in the background and collect and process operation data corresponding to an operation of the target object on the browser application by the target object, and then obtain the required web page stay time data. Since the web worker thread is independent of the main thread, the acquisition of a large amount of web page stay time data will not block the operation of the main thread, thereby avoiding problems such as page freezing during browsing and improving the user experience of using the browser application; moreover, it is also possible to prevent the main thread from affecting the data collection and data processing of the web worker thread, and ensure the accuracy of the acquisition of the web page stay time data. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In the following description of exemplary embodiments with reference to the accompanying drawings, more details, features and advantages of the present application are disclosed. In the drawings:

[0018] Figure 1 A flowchart showing a method for obtaining a web page stay time according to an exemplary embodiment of the present application is shown;

[0019] Figure 2 A flowchart showing another method for obtaining a web page stay time according to an exemplary embodiment of the present application is shown;

[0020] Figure 3It is a schematic diagram of the complete system framework for monitoring web page residence time provided by an embodiment of the present application;

[0021] Figure 4 It is a schematic structural diagram of an apparatus for obtaining web page residence time provided by an embodiment of the present application;

[0022] Figure 5 It shows a block diagram of an exemplary electronic device that can be used to implement the embodiments of the present application. Detailed implementation manners

[0023] Embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not used to limit the protection scope of the present application.

[0024] It should be understood that the steps recorded in the method embodiments of the present application can be executed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this regard.

[0025] As used herein, the term "including" and its variants are open-ended, that is, "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts such as "first" and "second" mentioned in the present application are only used to distinguish different devices, modules or units, and are not used to limit the order of the functions performed by these devices, modules or units or their interdependent relationships. It should be noted that the modifications of "one" and "multiple" mentioned in the present application are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly stated in the context, it should be understood as "one or more". The names of the messages or information exchanged between multiple devices in the embodiments of the present application are only for illustrative purposes and are not used to limit the scope of these messages or information.

[0026] The following describes the solution of the present invention with reference to the accompanying drawings, and details the technical solutions provided by the embodiments of the present invention through specific embodiments and their application scenarios.

[0027] Please refer to Figure 1, which shows a flowchart of a method for obtaining the web page residence time according to an exemplary embodiment of the present application. Taking the application of this method to an electronic device as an example for illustration. As Figure 1 shown, the method includes:

[0028] Step 101, after receiving the opening operation of the browser application by the target object, initialize the web worker thread, and the web worker thread is independent of the main thread where the browser application runs.

[0029] Among them, web worker allows JavaScript scripts to run in the background without blocking the main thread (UI thread). Moreover, web worker runs in an independent thread, separated from the main thread, and does not affect the rendering and interaction of the page. By introducing web worker in the browser application, during the running of the browser application, some time-consuming tasks can be handed over to webworker to execute in an independent thread, thereby avoiding time-consuming tasks from blocking the main thread (the UI thread of the browser application), and further avoiding page lags and improving the user experience of using the browser application. Based on the characteristics of web worker, when collecting and processing the operation data of the target object on the browser application, in order to avoid the collection and processing of a large amount of operation data from affecting the normal operation of the main thread of the browser application, by introducing web worker in the browser application and initializing and creating a web worker thread after receiving the opening operation of the browser application by the target object, and the web worker thread is independent of the main thread where the browser application runs, it can run in the background to collect and process the operation data of the target object on the browser application.

[0030] Among them, the main thread where the browser application runs is mainly the UI thread, that is, the thread used to execute functions such as page rendering, display, and interaction of the web page corresponding to the browser application.

[0031] Step 102, monitor the target object operation of the target object on the browser application through the web worker thread.

[0032] After creating the web worker thread, the target object operation of the target object on the browser application can be monitored through the web worker thread to collect relevant operation data and process the operation data to obtain the required web page residence time data, providing reliable support for subsequent application analysis.

[0033] In order to obtain the web page residence time data, the target object operation can specifically be operations such as the user opening the web page, leaving the web page, switching back to the web page, closing the web page, and refreshing the web page.

[0034] Step 103: Based on the monitored operations of the target object, determine the web page residence time data of the target object in the browser application through a web worker thread.

[0035] After the web worker thread monitors the operation data corresponding to the target object operation, the web worker thread can also process the operation data to obtain the web page residence time data of the target object in the browser application. Exemplarily, this data processing can include data format verification, data deduplication, outlier detection, data verification and repair, etc., to obtain more accurate and reliable web page residence time data of the browser application.

[0036] In summary, the embodiment of the present application provides a method for obtaining the web page residence time: by introducing a web worker in the browser application, and after receiving the opening operation of the target object on the browser application, initializing and creating a web worker thread, and this web worker thread is independent of the main thread in which the browser application runs, and can run in the background and collect and process the operation data corresponding to the target object operation of the target object on the browser application, and then obtain the required web page residence time data. Since the web worker thread is independent of the main thread, the acquisition of a large amount of web page residence time data will not block the operation of the main thread, thus avoiding problems such as page lag during browsing, and improving the user experience of using the browser application; moreover, it can also prevent the main thread from affecting the data collection and data processing of the web worker thread, and can ensure the accuracy of obtaining the web page residence time data.

[0037] In order to effectively identify the user's real residence behavior on the web page, an event monitor is also introduced to capture operations such as user mouse movement, keyboard input, and page scrolling, so as to eliminate the no-operation time and obtain more accurate web page residence time data.

[0038] Please refer to Figure 2 , which shows a flowchart of another method for obtaining the web page residence time according to an exemplary embodiment of the present application. This method is described by taking it as an example applied to an electronic device. As Figure 2 shown, this method includes:

[0039] Step 201: After receiving the opening operation of the target object on the browser application, initialize the web worker thread, and the web worker thread is independent of the main thread in which the browser application runs.

[0040] The implementation manner of Step 201 can refer to Step 101, and this embodiment will not be elaborated here.

[0041] Step 202, when it is detected by the web worker thread that the target object enters the target browsing web page of the browser application, start the target timer and record the entry time.

[0042] The residence time of the target object on the web page is mainly related to the two times when the target object enters and leaves the web page. To obtain the web page residence time data, in a possible implementation, when it is detected by the web worker thread that the target object enters the target browsing web page of the browser application, the target timer can be started and the entry time can be recorded, and then it is monitored whether the target object leaves the target browsing web page. Specifically, for the method of monitoring how the target object enters the target browsing web page, the window.onfocus() method can be used to monitor the target object entering the target browsing web page. That is, when it is detected by the web worker thread that the target object triggers the window.onfocus event, it is determined that the target object enters the target browsing web page.

[0043] Optionally, when it is detected by the web worker thread that the target object leaves and then switches back to the target browsing web page, start a new target timer and record the switch-back time. This switch-back time is the new entry time of the target browsing web page, and there is also a corresponding departure time.

[0044] Step 203, when it is detected by the web worker thread that the target object leaves the target browsing web page, stop the target timer and record the departure time.

[0045] Taking the target browsing web page as the monitoring object, after detecting that the target object enters the target browsing web page, it is also necessary to monitor when the target object leaves the target browsing web page, so as to calculate the web page residence time of the target object on the target browsing web page. In a possible implementation, when it is detected by the web worker thread that the target object leaves the target browsing web page, the target timer can be stopped and the departure time can be recorded.

[0046] Specifically, for the method of monitoring how the target object leaves the target browsing web page, the window.onblur() method can be used to monitor the target object exiting the target browsing web page, and the window.onbeforeunload() method can also be used to monitor the browser closing (which also means leaving the target browsing web page) or refreshing the page. That is, when it is detected by the web worker thread that the target object triggers the window.onblur event or the window.onbeforeunload event, it is determined that the target object leaves the target browsing web page.

[0047] Step 204, after the target object enters the target browsing web page, monitor the target web page operations of the target object on the target browsing web page through an event listener. The target web page operations include at least mouse movement operations, keyboard input operations, and page scrolling operations.

[0048] There may be some periods of inactivity between the time when the user enters and leaves the target browsing web page. To ensure the accuracy of the subsequent acquisition of web page stay time data and accurately reflect the user's web page operation behavior, in a possible implementation manner, after the target object enters the target browsing web page, an event listener is also started to monitor whether the target object has target web page operations on the target browsing web page. For example, whether there are mouse movement operations, whether there are keyboard input operations, whether there are page scrolling operations, whether there are page click and press operations, etc.

[0049] Step 205, based on the target web page operations, determine the inactivity time between the entry time and the departure time.

[0050] Furthermore, based on the time of the detected target web page operations, determine the inactivity time between entering and leaving the target browsing page, that is, the inactivity time between a set of entry time and departure time.

[0051] Exemplarily, for the same target browsing web page, the web worker thread can collect at least a set of data: entry time, departure time, and inactivity time.

[0052] Step 206, through the web worker thread, based on the entry time, departure time, and inactivity time corresponding to the monitored same target timer, determine the web page stay time data of the target object in the browser application.

[0053] After the web worker thread collects at least a set of data, the web page stay time data of the target object in the browser application can be determined based on the entry time, departure time, and inactivity time corresponding to the monitored same target timer. Exemplarily, the web page stay time corresponding to the target browsing web page = departure time - entry time - inactivity time.

[0054] Step 207, after the amount of the web page stay time data is greater than a preset quantity threshold, perform data deduplication and data anomaly verification on the web page stay time data to obtain the updated web page stay time data.

[0055] The web worker thread repeats the above steps 202 to 206 to obtain several web page residence time data of the browser application, and can also encapsulate the user name, browser information, etc. of the corresponding target object. Then, after meeting the preset conditions, the web page residence time data is uploaded to the background server so that the background server can perform application analysis based on this data.

[0056] In a possible implementation, when the data volume of the web page residence time data is greater than the preset quantity threshold, data deduplication and data anomaly verification can be performed on the web page residence data to obtain the updated web page residence time data, and then it is uploaded to the background server. Among them, data deduplication is to remove the duplicate web page residence time data obtained by the user opening multiple identical target browsing web pages; data anomaly verification is mainly to avoid obvious format and numerical anomalies in the obtained web page residence time data. For example, data with a negative time in the web page residence time data is removed.

[0057] Exemplarily, the preset quantity threshold can be 50 items.

[0058] Optionally, the web page residence time data can also be uploaded to the background server every preset time. The preset time can be ten minutes. Or, when it is detected that the target object leaves the target browsing page, the corresponding web page residence time data can be uploaded to the background server.

[0059] Step 209, upload the updated web page residence time data to the server.

[0060] Upload the web page residence time data that has undergone data cleaning (data deduplication and data anomaly verification) to the background server.

[0061] In this embodiment, methods such as the window.onfocus() method, window.onblur() method, and window.onbeforeunload() method are used to monitor operations such as the user leaving the web page, entering the web page, and closing the web page, and event listeners are added to monitor the user's web page operations on the web page to eliminate the no-operation time between the entry time and the departure time, so as to obtain more accurate web page residence time data.

[0062] Please refer to Figure 3 , Figure 3 which is the complete system framework schematic diagram provided by the embodiment of the present application for monitoring the web page residence time. As Figure 3 shown, in this application scenario, under the vue framework, JavaScript technology is used to monitor the web page entry time, departure time, whether there are operation actions, etc., to achieve the purpose of monitoring the user's residence time record on the web page. The system framework mainly includes two parts: a data collection part and a data processing part.

[0063] 1. Data collection part, which is used to monitor actions such as whether the user is operating or leaving, etc., to control the pause and start of the timer, so as to achieve the purpose of recording the stay time. The specific implementation is as follows:

[0064] 1) Use the window.onfocus() and window.onblur() methods to monitor whether the user switches out and back to the page. When the user switches out of the page, stop the timer; when the user switches back to the page, start the timer.

[0065] 2) Use window.onbeforeunload() to monitor the closing or refreshing of the browser page, and close the timer when triggered.

[0066] 3) Add event listeners to capture operations such as user mouse movement, keyboard input, and page scrolling. Through these times, determine whether the user is operating the web page. Eliminate the time of no operation to obtain more accurate data.

[0067] 2. Data processing part, which is used for data assembly and upload. The specific implementation is as follows:

[0068] 1) Data assembly: Assemble the required data such as username, browser information, entry time into the web page, and exit time from the web page into an array and save it in localStorage.

[0069] 2) Active trigger upload: When the user leaves the page, this component will automatically fetch the data in the cache and upload it to the backend server.

[0070] 3) Time trigger upload: Automatically execute the upload interface every ten minutes to upload the data to the server.

[0071] 4) Quantity trigger upload: When the number of items reaches the set quantity, such as 50 items, when it is detected that the number of data in the cache is 50, the upload interface will be automatically executed. Upload the data to the server.

[0072] 5) Data cleaning and correction: Multiple upload methods may generate duplicate data. Before uploading, data cleaning (data format verification, duplicate removal, outlier detection, etc.) will be performed. Through data cleaning, the data can be made more accurate.

[0073] Based on the above complete system framework, the specific implementation process of the solution can be:

[0074] 1. After the user enters the page, initialize (start) the monitoring thread, start the timer, and record the entry time; obtain the user's basic information and record the username.

[0075] Among them, the main thread is the UI thread that displays the browser page.

[0076] 2. The monitoring thread listens to user operations in real time. When the user triggers the window.onblur() or window.onbeforeunload() event or has not operated for a long time, it stops the timer, records the leaving time, assembles the existing data, and generates a piece of data.

[0077] 3. The monitoring thread obtains all the previously stored data through the storage.get() method. Parsing these data will result in an array. It pushes the data generated in step 2 into this array and then stores the data into the local cache through the storage.set() method.

[0078] 4. When the user triggers the window.onfocus() event, it starts the timer, records the time of switching back, and the subsequent steps are the same as those in steps 2 and 3.

[0079] 5. Data upload: When the user leaves the page, or the number of data items reaches 50, or the browsing time of the web page exceeds ten minutes, the monitoring thread will first clean and correct the data, and then upload it to the server by calling the backend interface through ajax technology.

[0080] Please refer to Figure 4 , which is a schematic structural diagram of a device for obtaining the web page stay time provided by an embodiment of the present application.

[0081] Exemplarily, as Figure 4 shown, the device 400 includes:

[0082] An initialization module 401, configured to initialize a webworker thread after receiving an opening operation of a browser application by a target object, and the web worker thread is independent of the main thread in which the browser application runs;

[0083] A first monitoring module 402, configured to monitor a target object operation of the target object on the browser application through the web worker thread;

[0084] A first determination module 403, configured to determine web page stay time data of the target object in the browser application based on the monitored target object operation through the web worker thread.

[0085] Optionally, the first monitoring module 402 is further configured to:

[0086] When it is monitored through the web worker thread that the target object enters a target browsing web page of the browser application, start a target timer and record the entry time;

[0087] When it is detected by the web worker thread that the target object leaves the target browsing web page, turn off the target timer and record the leaving time.

[0088] Optionally, the device further includes:

[0089] A second determination module, configured to determine that it is detected that the target object enters the target browsing web page when it is detected by the web worker thread that the target object triggers the window.onfocus event;

[0090] A second determination module, configured to determine that it is detected that the target object leaves the target browsing web page when it is detected by the web worker thread that the target object triggers the window.onblur event or the window.onbeforeunload event.

[0091] Optionally, the device further includes:

[0092] A second monitoring module, configured to, after the target object enters the target browsing web page, monitor the target web page operations of the target object on the target browsing web page through an event listener, where the target web page operations at least include a mouse movement operation, a keyboard input operation, and a page scrolling operation;

[0093] A third determination module, configured to determine the no-operation time between the entry time and the leaving time based on the target web page operations.

[0094] Optionally, the first determination module 403 is further configured to:

[0095] Determine the web page stay time data of the target object in the browser application through the web worker thread based on the entry time, the leaving time, and the no-operation time corresponding to the monitored same target timer.

[0096] Optionally, the device further includes:

[0097] A third monitoring module, configured to, when it is detected by the web worker thread that the target object leaves and then switches back to the target browsing web page, start a new target timer and record the switching-back time.

[0098] Optionally, the device further includes:

[0099] A data processing module, configured to, after the data volume of the web page stay time data is greater than a preset quantity threshold, perform data deduplication and data anomaly verification on the web page stay time data to obtain updated web page stay time data;

[0100] An upload module for uploading the updated web page residence time data to a server.

[0101] In summary, in the embodiments of the present application, by introducing a web worker into a browser application, and initializing and creating a web worker thread after receiving an opening operation of a target object on the browser application, and the web worker thread is independent of the main thread in which the browser application runs, it can run in the background and collect and process operation data corresponding to the target object operation of the target object on the browser application, so as to obtain the required web page residence time data. Since the web worker thread is independent of the main thread, the acquisition of a large amount of web page residence time data will not block the operation of the main thread, thereby avoiding problems such as page freezing during browsing and improving the user experience of using the browser application; moreover, the main thread can also be prevented from affecting the data collection and data processing of the web worker thread, and the accuracy of obtaining the web page residence time data can be guaranteed.

[0102] An exemplary embodiment of the present application further provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program that can be executed by the at least one processor, and when the computer program is executed by the at least one processor, it is used to cause the electronic device to execute the method for obtaining the web page residence time according to the embodiment of the present application.

[0103] An exemplary embodiment of the present application further provides a non-transitory computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor of a computer, it is used to cause the computer to execute the method for obtaining the web page residence time according to the embodiment of the present application.

[0104] An exemplary embodiment of the present application further provides a computer program product, including a computer program, wherein when the computer program is executed by a processor of a computer, it is used to cause the computer to execute the method for obtaining the web page residence time according to the embodiment of the present application.

[0105] Reference Figure 5, a structural block diagram of an electronic device 500 that can be used as a server or a client of the present application will now be described. It is an example of a hardware device that can be applied to various aspects of the present application. The electronic device is intended to represent various forms of digital electronic computer devices, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.

[0106] As Figure 5 shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0107] Multiple components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, an output unit 507, a storage unit 508, and a communication unit 509. The input unit 506 can be any type of device that can input information into the electronic device 500. The input unit 506 can receive input digital or character information, and generate key signal inputs related to the user settings and / or function controls of the electronic device. The output unit 507 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 508 can include but is not limited to a magnetic disk, an optical disk. The communication unit 509 allows the electronic device 500 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0108] The computing unit 501 can be various general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 executes the various methods and processes described above. For example, in some embodiments, Figure 1 , Figure 2 The method shown can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 500 via the ROM 502 and / or the communication unit 509. In some embodiments, the computing unit 501 can be configured to execute Figure 1 , Figure 2 the method shown in any other suitable manner (e.g., by means of firmware).

[0109] The program code for implementing the methods of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program code is executed by the processor or controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0110] In the context of the present application, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0111] As used in this application, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device that provides machine instructions and / or data to a programmable processor (e.g., a magnetic disk, an optical disk, a memory, a programmable logic device (PLD)), including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal that provides machine instructions and / or data to a programmable processor.

[0112] In order to provide an interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide an interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).

[0113] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0114] A computer system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The client-server relationship is created by computer programs that run on the respective computers and have a client-server relationship with each other.

Claims

1. A method for obtaining the web page residence time, characterized in that, The method includes: After receiving the opening operation of the browser application by the target object, initialize a web worker thread, where the web worker thread is independent of the main thread on which the browser application runs; Monitor the target object operation of the browser application by the target object through the web worker thread; Based on the monitored target object operation by the web worker thread, determine the web page stay time data of the target object in the browser application.

2. The method according to claim 1, wherein The monitoring of the target object operation of the browser application by the target object through the web worker thread includes at least one of the following: When it is monitored by the web worker thread that the target object enters the target browsing web page of the browser application, start a target timer and record the entry time; When it is monitored by the web worker thread that the target object leaves the target browsing web page, stop the target timer and record the departure time.

3. The method according to claim 2, wherein The method further includes: When it is monitored by the web worker thread that the target object triggers the window.onfocus event, determine that the target object enters the target browsing web page; When it is monitored by the web worker thread that the target object triggers the window.onblur event or the window.onbeforeunload event, determine that the target object leaves the target browsing web page.

4. The method according to claim 2, wherein The method further includes: After the target object enters the target browsing web page, monitor the target web page operation of the target browsing web page by the target object through an event listener, where the target web page operation includes at least a mouse movement operation, a keyboard input operation, and a page scrolling operation; Based on the target web page operation, determine the no-operation time between the entry time and the departure time.

5. The method according to claim 4, characterized in that, The determining of the web page stay time data of the target object in the browser application by the web worker thread based on the monitored target object operation includes: Based on the entry time, the departure time, and the no-operation time corresponding to the same target timer monitored by the web worker thread, determine the web page stay time data of the target object in the browser application.

6. The method according to claim 2, wherein The method further includes: When it is monitored by the web worker thread that the target object leaves and then switches back to the target browsing web page, start a new target timer and record the switch-back time.

7. According to the method described in any one of claims 1 to 6, characterized in that, The method further includes: After the data volume of the web page stay time data is greater than a preset quantity threshold, perform data deduplication and data anomaly verification on the web page stay time data to obtain updated web page stay time data; Upload the updated web page stay time data to the server.

8. An apparatus for obtaining the web page residence time, characterized in that, The device includes: An initialization module, configured to initialize a web worker thread after receiving an opening operation of a browser application by a target object, where the web worker thread is independent of the main thread on which the browser application runs; A first monitoring module, configured to monitor, by the web worker thread, a target object operation of the target object on the browser application; A first determination module, configured to determine, by the web worker thread and based on the monitored target object operation, web page residence time data of the target object in the browser application.

9. An electronic device, comprising: A processor; And A memory storing a program, wherein the program includes instructions that, when executed by the processor, cause the processor to execute the method for obtaining web page residence time according to any one of claims 1-7.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method for obtaining web page residence time according to any one of claims 1-7.