A file loading method and apparatus
By monitoring users' historical browsing behavior and combining it with reinforcement learning, the optimal JavaScript loading sequence is generated, solving the problem of insufficient user behavior prediction and achieving faster page loading and a better user experience.
Patent Information
- Application Number
- CN202311666484.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-12-06
AI Technical Summary
Existing technologies fail to adequately predict user behavior during page loading, resulting in inaccurate resource loading and impacting page loading speed and user experience.
By monitoring users' historical browsing behavior, and using a combination of code tracking and reinforcement learning, the optimal JavaScript loading sequence is generated. This includes monitoring user behavior, data cleaning, classification, and prediction to generate a resource loading order sequence.
Reduce page load time, avoid resource conflicts, ensure normal page operation, and improve user experience.
Smart Images

Figure CN117873583B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of file loading technology, and particularly relates to a file loading method, apparatus, electronic device and storage medium. Background Technology
[0002] Due to the rapid development of current internet technology, excessive HTTP (Hypertext Transfer Protocol) requests, prolonged occupation of JavaScript threads, and congestion during resource loading cause slow page loading, impacting user experience. Currently, there are numerous front-end performance optimization solutions, such as resource compression and merging, and optimization of network connectivity and resource loading. While most inventions focus on data identification design for quick locating cached and resource modules during front-end page loading, there are relatively few inventions related to JavaScript resource loading based on recording and predicting user behavior and actual needs. Therefore, this invention is motivated by the need for such a solution.
[0003] Existing inventions related to page loading optimization typically involve resource data identification design, cache query operations, and DOM (Document Object Model) tree construction methods to improve page loading speed and thus enhance user experience. Patent CN112181532A designs a page resource loading scheme that obtains pre-loading parameters for page resources based on a page resource loading request, and retrieves resource files based on whether the pre-loading parameters meet the pre-loading conditions. This includes retrieving resources from local storage and loading page resources corresponding to the pre-loading parameters from resource files. Patent CN111666497A primarily designs page access instructions, searching for relevant files in a pre-stored resource database based on these instructions. These patents focus on the design of the resource side and rendering side, emphasizing how to efficiently acquire resources to optimize user needs and experience.
[0004] Patent CN110377361A designs different data representations and displays corresponding data according to these representations, thereby saving memory space and improving user experience. Patent CN116225567A predicts the preload of pages by collecting user behavior data and uses a multilayer perceptron for prediction. However, multilayer perceptrons may experience overfitting and difficulty in parameter tuning as the number of layers increases. The above patents primarily focus on the selection of preloaded resources, but they offer limited consideration for user behavior and needs.
[0005] Existing inventions related to user behavior in the context of page rendering typically employ strategies such as event tracking, real-view scroll detection, and recording user operation trajectories. These inventions mostly focus on recording user actions, with less emphasis on predicting them. Therefore, this invention proposes a hybrid JavaScript file loading method based on user behavior. Through modules such as user history behavior perception, actual user needs acquisition, user behavior prediction, and resource loading order decision-making, combined with resource preloading and on-demand loading methods, a final resource loading sequence is obtained. During page loading, a portion of JavaScript files are preloaded according to the resource loading sequence, while other files are loaded on demand, achieving more precise resource loading control and optimization. Summary of the Invention
[0006] In view of the shortcomings of the prior art, the purpose of the invention is to provide a method, device, electronic device and storage medium for handling repeated key presses on a cloud desktop. By combining the user's historical behavior trajectory with reinforcement learning, reasonable resource loading prediction is performed to obtain the optimal JavaScript loading sequence. This method can reduce page loading time and avoid blocking rendering, thereby avoiding resource conflicts between different scripts, ensuring normal page operation and improving user experience.
[0007] A first aspect of the present invention provides a file loading method, comprising:
[0008] The system monitors users' historical browsing behavior using code-based tracking. This historical browsing behavior includes page navigation, clicks, scrolling, searching, and dwell time.
[0009] Different reporting methods and timings should be set for different user browsing history behaviors;
[0010] By monitoring users' historical browsing behavior to obtain their historical browsing trajectory, the data is cleaned, analyzed, and categorized. The actual needs of users are then confirmed through statistics.
[0011] The actual needs of users are mapped to the state space and behavior space in reinforcement learning, user behavior is predicted, and the weights of user needs for different resources are output.
[0012] An initial resource loading sequence is generated based on the user's historical browsing history. The predicted user behavior is combined with the weights of different user behaviors. The initial resource loading sequence is iterated multiple times by the user behavior prediction module to obtain the resource loading order sequence.
[0013] Furthermore, in the aforementioned file loading method, code-based monitoring of user browsing history is employed, including:
[0014] Manually add event tracking code at key behavior nodes;
[0015] For user click, scroll, and search behaviors, use JavaScript event listeners and callback functions to introduce tracking scripts;
[0016] For dwell time, user_id and user_name represent user ID and username, page_path and page_title represent the path and title of the current page, and event_type, act_tag, begin_time, and end_time represent the event type, resource tag, start time, and end time, respectively.
[0017] Furthermore, in the aforementioned file loading method, different reporting methods and timings are set for different user browsing history behaviors, including:
[0018] Page redirection behavior is reported synchronously using the WebSocket reporting mechanism. The front-end and back-end establish a long connection, and the front-end sends the relevant data of the user's page redirection to the server.
[0019] Click behavior and search behavior are reported asynchronously using a batch mechanism. The batch mechanism caches the user trajectory collected by the front end using a data queue and reports it when the data volume reaches the threshold data_threshold.
[0020] Scrolling and dwell behaviors, corresponding to resources reaching the page's preset virtual view area or users dwelling on a resource for more than the preset time, will be reported using the Beacon API to provide performance data.
[0021] For the reported content, a unified field identifier and table structure are used.
[0022] Furthermore, in the aforementioned file loading method, the embedded data is cleaned and analyzed, and the user's historical browsing behavior is categorized. The user's actual needs are confirmed through statistical analysis, including:
[0023] Clean the collected data on users' historical browsing behavior.
[0024] The cleaned data is categorized according to preset resource types;
[0025] For all resources, sort them in ascending order by begin_time to represent the user's behavior trajectory over time. Sort the categorized resources by dwell time to determine the user's interest preferences for the same type of resource.
[0026] The cleaning process for the collected user browsing history data includes deleting duplicate records and searching for outliers. The rules for deleting duplicate records are as follows:
[0027] During scrolling, delete user behavior data related to the first screen of page rendering;
[0028] If both scrolling and dwell behavior data exist for the same resource, only the dwell user behavior data will be retained.
[0029] If click behavior and dwell behavior data exist for the same resource, only the click behavior data will be retained;
[0030] If search behavior and dwell behavior data exist for the same resource, only the search behavior data will be retained;
[0031] The operation searches for outliers and determines whether the dwell time exceeds a preset threshold.
[0032] Furthermore, in the aforementioned file loading method, the user's actual needs are mapped to a state space and behavior space in reinforcement learning, and the weights under different user behaviors are output by predicting user behavior, including:
[0033] The actual user needs are mapped to the state space of reinforcement learning, where the state space is characterized by a unified resource label. The resource label includes at least: scripts, style sheets, JSON, XML, images and audio and video files, etc. The number of resources depends on the current user's browsing environment and resources.
[0034] The behavior space is defined as the user browsing behavior in the actual user needs, and the user browsing behavior is represented as A={a1,a2,…,a…} n}, where A represents the set of resources currently being viewed by the user, a n This indicates the nth resource viewed by the user;
[0035] Predict user behavior based on behavior space and state space, and output the weights for different user behaviors.
[0036] Furthermore, in the aforementioned file loading method, an initial resource loading sequence is generated based on the user's historical browsing history. The predicted user behavior is combined with weights for different user behaviors. The user behavior prediction module iterates through the initial resource loading sequence multiple times to obtain a resource loading order sequence, including:
[0037] Define the reward function as follows: Where R represents the reward generated under the current resource loading sequence, This indicates the time when the user viewed resource i. This indicates the time it takes for resource i to finish loading on the front-end page. This represents the difference between the user's browsing and rendering time for resource i, and the reward function is the sum of the time differences for all resources;
[0038] The predicted user behavior is combined with the weights of different user behaviors. The user behavior prediction module iterates the initial resource loading sequence multiple times. The reward function tests the user experience of the resource loading sequence and finally outputs the optimal resource loading decision sequence.
[0039] Furthermore, in the above-mentioned file loading method, the preset resource types include:
[0040] act_tag1: JavaScript script file;
[0041] act_tag2: CSS stylesheet file;
[0042] act_tag3: JSON file;
[0043] act_tag4: XML file;
[0044] act_tag5: Image file. The image file type must include at least: jpg, png, and gif.
[0045] act_tag6: Audio file. The file type of the audio file must include at least: mp3 or opp.
[0046] act_tag7: Video file. The file type of the video file must include at least: mp4 or webm.
[0047] act_tag8: Other files. Other file types include at least: PDF files, SVG vector files, data files, and compressed files.
[0048] A second aspect of the present invention provides a file loading device, comprising:
[0049] Monitoring module: Used to monitor users' historical browsing behavior using code-based tracking. The user's historical browsing behavior includes: page navigation behavior, click behavior, scrolling behavior, search behavior, and dwell time.
[0050] Settings module: Used to set different reporting methods and timings for different user browsing history behaviors;
[0051] The statistics module is used to obtain users' historical browsing history by monitoring their browsing behavior, clean and analyze the data, classify users' historical browsing behavior, and confirm users' actual needs through statistics.
[0052] Prediction module and output module: used to map the user's actual needs to the state space and behavior space in reinforcement learning, predict user behavior, and output the user's demand weights for different resources;
[0053] The acquisition module is used to generate an initial resource loading sequence based on the user's historical browsing trajectory. It combines the predicted user behavior with the weights of different user behaviors, and iterates the initial resource loading sequence multiple times through the user behavior prediction module to obtain the resource loading order sequence.
[0054] A third aspect of the present invention also provides an electronic device comprising: a processor and a memory;
[0055] The processor executes a file loading method as described above by invoking programs or instructions stored in the memory.
[0056] In a fourth aspect, the present invention also provides a computer-readable storage medium storing a program or instructions that cause a computer to perform a file loading method as described in any of the above claims.
[0057] The beneficial effects of this invention are as follows: This invention monitors users' historical browsing behavior using code-based tracking, including page navigation, clicks, scrolling, searching, and dwell time. Different reporting methods and timings are set for different historical browsing behaviors. By monitoring users' historical browsing behavior, the invention obtains their browsing trajectories, cleans and analyzes the tracking data, classifies the historical browsing behaviors, and statistically confirms users' actual needs. Users' actual needs are mapped to the state and behavior spaces in reinforcement learning, and user behavior is predicted, outputting the weights of users' needs for different resources. An initial resource loading sequence is generated based on the user's historical browsing trajectory. The predicted user behavior is combined with the weights under different user behaviors, and the initial resource loading sequence is iterated multiple times through a user behavior prediction module to obtain the resource loading order sequence. This invention combines user historical behavior trajectories with reinforcement learning to perform reasonable resource loading prediction, thereby obtaining the optimal JavaScript loading sequence. This method can reduce page loading time, avoid blocking rendering, avoid resource conflicts between different scripts, ensure normal page operation, and improve user experience. Attached Figure Description
[0058] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts. It is obvious that the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings.
[0059] Figure 1 A file loading method provided in this embodiment of the invention Figure 1 ;
[0060] Figure 2 This is a schematic diagram illustrating the monitoring of a user's historical browsing behavior provided in an embodiment of the present invention;
[0061] Figure 3 A file loading method provided in this embodiment of the invention Figure 2 ;
[0062] Figure 4 A file loading device diagram provided for an embodiment of the present invention;
[0063] Figure 5 This is a schematic block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0064] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. It should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0065] Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts disclosed in this invention.
[0066] In the description of this invention, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance. The terms "installed," "connected," and "linked" should be interpreted broadly; for example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0067] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of methods and systems consistent with some aspects of the invention as detailed in the appended claims.
[0068] This invention proposes a file loading method, apparatus, electronic device, and storage medium that combines user historical behavior trajectories with reinforcement learning to make reasonable resource loading predictions, thereby obtaining the optimal JavaScript loading sequence. This method can reduce page loading time while avoiding rendering blocking, thus avoiding resource conflicts between different scripts, ensuring normal page operation, and improving user experience.
[0069] Method Implementation Examples
[0070] Before introducing this invention, let's first introduce the technical terms involved in this invention.
[0071] JavaScript (JS) is a lightweight, interpreted or just-in-time (JIT) programming language with a function-first approach. It is a prototype-based, multi-paradigm dynamic scripting language that supports object-oriented, imperative, declarative, and functional programming paradigms. Its main functions include embedding dynamic text in HTML (Hypertext Markup Language) pages, responding to browser events, and reading and writing HTML elements. As a high-level scripting language for the web, it is widely used in front-end application development.
[0072] Reinforcement Learning (RL): As a branch of machine learning, reinforcement learning is used to describe and solve problems in which intelligent agents learn strategies through interaction with the environment to maximize rewards or achieve specific goals.
[0073] Preloading: As a performance optimization technique, resource preloading requests and loads all necessary resources into the local machine in advance. During the page loading process, these resources are retrieved directly from the cache, providing a better user experience and reducing the waiting time during page loading.
[0074] On-demand loading: As a performance optimization technique, on-demand loading loads the corresponding code based on the user's current need for the desired functionality. Browsers can only make a limited number of requests at a time; loading all the code for a single function at once can cause a prolonged blank screen on the homepage of a single-page application. In JavaScript, loading is typically triggered by user actions or scheduled tasks to optimize the user experience.
[0075] Figure 1 A file loading method provided in this embodiment of the invention Figure 1 .
[0076] Figure 2 This is a schematic diagram illustrating the monitoring of a user's historical browsing behavior as provided in an embodiment of the present invention.
[0077] In a first aspect, the present invention proposes a file loading method, combined with Figure 1 and Figure 2 It includes five steps, S1 to S5:
[0078] S1: Monitor user browsing history using code-based tracking. User browsing history includes page navigation, clicks, scrolling, searching, and dwell time.
[0079] Specifically, in this embodiment of the invention, code-based monitoring is used on the front end to track user browsing history. It should be understood that page navigation is the starting point for a user's browsing of the current page; clicks and searches indicate a user's significant interest in a particular resource; and scrolling behavior can be monitored by listening to the user's scrolling actions on the page, thus revealing the user's reading and browsing behavior. Dwell time can be used to measure user interest.
[0080] S2: Set different reporting methods and timings for different users' historical browsing behaviors.
[0081] Specifically, in this embodiment of the invention, different reporting methods and timings are set for page jump behavior, click behavior, scrolling behavior, search behavior and dwell time. For example, page jump behavior is reported synchronously using the WebSocket reporting mechanism, with a long connection established between the front end and the back end, and the front end transmits the relevant data of the user's page jump to the server.
[0082] S3: By monitoring users' historical browsing behavior, the system obtains users' historical browsing trajectory, cleans and analyzes the data, classifies users' historical browsing behavior, and confirms users' actual needs through statistics.
[0083] Specifically, in this embodiment of the invention, the method for cleaning, analyzing, and classifying the data collected at tracking points, and then statistically confirming the actual needs of users, is described in detail below.
[0084] S4: Map the user's actual needs to the state space and behavior space in reinforcement learning, predict user behavior, and output the weights of the user's needs for different resources.
[0085] Specifically, in this embodiment of the invention, the method of mapping the user's actual needs to the state space and behavior space in reinforcement learning, predicting user behavior, and outputting the user's demand weights for different resources is described in detail below.
[0086] S5: Generate an initial resource loading sequence based on the user's historical browsing history, combine the predicted user behavior with the weights of different user behaviors, and iterate the initial resource loading sequence multiple times through the user behavior prediction module to obtain the resource loading order sequence.
[0087] Specifically, in this embodiment of the invention, an initial resource loading sequence is generated based on the user's historical browsing trajectory. The predicted user behavior is combined with the weights under different user behaviors. The user behavior prediction module iterates the initial resource loading sequence multiple times to obtain the resource loading order sequence. The method is described in detail below.
[0088] Furthermore, in the aforementioned file loading method, code-based monitoring of user browsing history is employed, including:
[0089] Manually add event tracking code at key behavior nodes;
[0090] For user click, scroll, and search behaviors, use JavaScript event listeners and callback functions to introduce tracking scripts;
[0091] For dwell time, user_id and user_name represent user ID and username, page_path and page_title represent the path and title of the current page, and event_type, act_tag, begin_time, and end_time represent the event type, resource tag, start time, and end time, respectively.
[0092] Specifically, in this embodiment of the invention, code-based tracking is used to monitor users' historical browsing behavior, and the way tracking code is added varies for different behaviors.
[0093] Furthermore, in the aforementioned file loading method, different reporting methods and timings are set for different user browsing history behaviors, including:
[0094] Page redirection behavior is reported synchronously using the WebSocket reporting mechanism. The front-end and back-end establish a long connection, and the front-end sends the relevant data of the user's page redirection to the server.
[0095] Click and search behaviors are reported asynchronously using a batch mechanism. The batch mechanism caches the user trajectory collected by the front end using a data queue and reports it when the data volume reaches the threshold data_threshold.
[0096] Scrolling and dwell behaviors, corresponding to resources reaching the page's preset virtual view area or users dwelling on a resource for more than the preset time, will be reported using the Beacon API to provide performance data.
[0097] For the reported content, a unified field identifier and table structure are used.
[0098] Specifically, in this embodiment of the invention, data is reported after the data volume reaches the threshold data_threshold. Since there may be many user interactions, a batch reporting method is used to reduce the number of network requests. The Beacon API is used to report such critical performance data. As a new feature of HTML5, it allows data to be sent to the server before the page is unloaded, and data can be sent even if the page has been closed, without affecting the page loading speed.
[0099] It should be understood that this invention sets different timing and methods for reporting data points, and sets specific reporting methods for different user behaviors and JavaScript resource types. Considering the front-end pressure during the front-end rendering process, it can better decouple business operations from behavior collection. It uses HTML5 and other related technologies for reporting, avoids unnecessary server processing and bandwidth consumption, saves resources and costs, does not block the main thread or delay page unloading, and does not affect the user experience during page browsing.
[0100] Figure 3 A file loading method provided in this embodiment of the invention Figure 2 .
[0101] Furthermore, in the aforementioned file loading method, user browsing history is obtained by collecting user browsing behavior data. The data is then cleaned, analyzed, and categorized based on the user's browsing history. Statistical analysis confirms the user's actual needs, and this is combined with... Figure 3 It includes three steps, S31 to S33:
[0102] S31: Clean the collected data on users' historical browsing behavior.
[0103] Specifically, in this embodiment of the invention, the method for cleaning the collected data of users' historical browsing behavior includes: deleting duplicate records and searching for outliers.
[0104] S32: Classify the cleaned data according to the preset resource type.
[0105] Specifically, in this embodiment of the invention, the preset resource types include the following eight:
[0106] act_tag1: JavaScript script file;
[0107] act_tag2: CSS stylesheet file;
[0108] act_tag3: JSON file;
[0109] act_tag4: XML file;
[0110] act_tag5: Image file. The image file type must include at least: jpg, png, and gif.
[0111] act_tag6: Audio file. The file type of the audio file must include at least: mp3 or opp.
[0112] act_tag7: Video file. The file type of the video file must include at least: mp4 or webm.
[0113] act_tag8: Other files. Other file types include at least: PDF files, SVG vector files, data files, and compressed files.
[0114] S33: For all resources, sort them in ascending order by begin_time to represent the user's behavior trajectory over time; sort the categorized resources by dwell time to determine the user's interest preferences for the same type of resource.
[0115] Specifically, in this embodiment of the invention, all resources are sorted in ascending order of begin_time to represent the user's behavioral trajectory over time; at the same time, the resources after data classification are sorted according to the dwell time to determine the user's interest preferences for the same type of resource.
[0116] The cleaning process for the collected user browsing history data includes deleting duplicate records and searching for outliers. The rules for deleting duplicate records are as follows:
[0117] During scrolling, delete user behavior data related to the first screen of page rendering;
[0118] If both scrolling and dwell behavior data exist for the same resource, only the dwell user behavior data will be retained.
[0119] If click behavior and dwell behavior data exist for the same resource, only the click behavior data will be retained;
[0120] If search behavior and dwell behavior data exist for the same resource, only the search behavior data will be retained;
[0121] The operation searches for outliers and determines whether the dwell time exceeds a preset threshold.
[0122] Specifically, in this embodiment of the invention, the operation on outliers mainly involves determining whether the dwell time is greater than 5 seconds, i.e., end_time-begin_time>5. It should be understood that the size of the preset threshold can be flexibly set according to the actual situation and is not intended to limit the scope of protection of this invention.
[0123] It should be understood that the present invention can effectively improve data quality, reduce misleading analysis, and more accurately obtain user behavior through data cleaning, classification, sorting and other methods. The cleaned and classified data is more standardized and accurate, and the data has completeness and rationality, which can reduce subsequent data processing and save computing resources and time.
[0124] Furthermore, in the aforementioned file loading method, the user's actual needs are mapped to a state space and behavior space in reinforcement learning, and the weights under different user behaviors are output by predicting user behavior, including:
[0125] The actual user needs are mapped to the state space of reinforcement learning, where the state space is characterized by a unified resource label. The resource label includes at least: scripts, style sheets, JSON, XML, images and audio and video files, etc. The number of resources depends on the current user's browsing environment and resources.
[0126] The behavior space is defined as the user browsing behavior in the actual user needs, and the user browsing behavior is represented as A={a1,a2,…,a…} n}, where A represents the set of resources currently being viewed by the user, a n This indicates the nth resource viewed by the user;
[0127] Predict user behavior based on behavior space and state space, and output the weights for different user behaviors.
[0128] Specifically, in this embodiment of the invention, the state space is used to represent a set of features or states of the user and the environment, and the user browsing behavior represents the browsing behavior according to the user's actual needs. The user browsing behavior can be represented as A = {a1, a2, ..., a...} n}, where A represents the set of resources currently being viewed by the user, an This represents the nth resource viewed by the user. Based on the behavior space and state space, the user's behavior is predicted, and the weights of different user behaviors are output.
[0129] Furthermore, in the aforementioned file loading method, an initial resource loading sequence is generated based on the user's historical browsing history. The predicted user behavior is combined with weights for different user behaviors. The user behavior prediction module iterates through the initial resource loading sequence multiple times to obtain a resource loading order sequence, including:
[0130] Define the reward function as follows: Where R represents the reward generated under the current resource loading sequence, This indicates the time when the user viewed resource i. This indicates the time it takes for resource i to finish loading on the front-end page. This represents the difference between the user's browsing and rendering time for resource i, and the reward function is the sum of the time differences for all resources;
[0131] The predicted user behavior is combined with the weights of different user behaviors. The user behavior prediction module iterates the initial resource loading sequence multiple times. The reward function tests the user experience of the resource loading sequence and finally outputs the optimal resource loading decision sequence.
[0132] It should be understood that this invention combines users' historical behavior with reinforcement learning, employing a lightweight iterative approach and prediction algorithm to perform weighted analysis on user behavior and obtain resource-related loading order. Lightweight reinforcement learning applied to user behavior analysis offers advantages such as high computational efficiency, ease of implementation and debugging, enabling developers to better apply the algorithm in their work. Furthermore, lightweight learning has a low response time, allowing for real-time decision-making based on the environment, resulting in better performance for time-sensitive applications.
[0133] In summary, this invention addresses user behavior collection, behavior data reporting, related data cleaning, and user trajectory prediction. It can effectively predict the loading of JavaScript-related resources based on users' historical behavior trajectories, make reasonable resource loading order decisions for different page resources and user behavior habits, has a low response time, does not block the main thread loading, reduces unnecessary resource consumption, and improves the user's browsing experience.
[0134] Device Examples
[0135] Figure 4 A diagram of a file loading device provided in an embodiment of the present invention.
[0136] In a second aspect, the present invention provides a file loading device, combined with Figure 4 ,include:
[0137] Monitoring module 41: Used to monitor user browsing history using code-based tracking. The user browsing history includes page navigation behavior, click behavior, scrolling behavior, search behavior, and dwell time.
[0138] Setting module 42: Used to set different reporting methods and reporting times for different user browsing history behaviors;
[0139] Statistics module 43: Used to obtain the user's historical browsing trajectory by monitoring the user's historical browsing behavior, clean and analyze the data, classify the user's historical browsing behavior, and confirm the user's actual needs through statistics.
[0140] Prediction module 44 and output module 45 are used to map the user's actual needs to the state space and behavior space in reinforcement learning, predict the user's behavior, and output the user's demand weights for different resources.
[0141] Module 46: This module generates an initial resource loading sequence based on the user's historical browsing history. It combines the predicted user behavior with the weights of different user behaviors and iterates the initial resource loading sequence multiple times through the user behavior prediction module to obtain the resource loading order sequence.
[0142] Figure 5 This is a schematic block diagram of an electronic device provided in an embodiment of the present invention.
[0143] like Figure 5 As shown, the electronic device includes at least one processor 501, at least one memory 502, and at least one communication interface 503. The various components in the electronic device are coupled together via a bus system 504. The communication interface 503 is used for information transmission with external devices. It is understood that the bus system 504 is used to implement communication between these components. In addition to a data bus, the bus system 504 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 5 The general designated all buses as Bus System 504.
[0144] It is understood that the memory 502 in this embodiment can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
[0145] In some implementations, memory 502 stores elements such as executable units or data structures, or subsets thereof, or extended sets thereof: operating systems and applications.
[0146] The operating system includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application programs include various applications, such as media players and browsers, used to implement various application functions. A program implementing any method in the file loading method provided in this embodiment of the invention can be included in the application programs.
[0147] In this embodiment of the invention, the processor 501 executes the steps of various embodiments of a file loading method provided by the present invention by calling the program or instructions stored in the memory 502, specifically, the program or instructions stored in the application program.
[0148] The system monitors users' historical browsing behavior using code-based tracking. This historical browsing behavior includes page navigation, clicks, scrolling, searching, and dwell time.
[0149] Different reporting methods and timings should be set for different user browsing history behaviors;
[0150] By monitoring users' historical browsing behavior to obtain their historical browsing trajectory, the data is cleaned, analyzed, and categorized. The actual needs of users are then confirmed through statistics.
[0151] The actual needs of users are mapped to the state space and behavior space in reinforcement learning, user behavior is predicted, and the weights of user needs for different resources are output.
[0152] An initial resource loading sequence is generated based on the user's historical browsing history. The predicted user behavior is combined with the weights of different user behaviors. The initial resource loading sequence is iterated multiple times by the user behavior prediction module to obtain the resource loading order sequence.
[0153] Any of the methods in the file loading method provided in this embodiment of the invention can be applied to, or implemented by, the processor 501. The processor 501 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the integrated logic circuits in the hardware of the processor 501 or by instructions in software form. The processor 501 can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0154] The steps of any method in the file loading method provided in this embodiment of the invention can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software units in the decoding processor. The software units can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 502, and processor 501 reads the information in memory 502 and combines it with its hardware to complete the steps of the method.
[0155] Those skilled in the art will understand that although some embodiments described herein include certain features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention and form different embodiments.
[0156] Those skilled in the art will understand that the descriptions of the various embodiments have different focuses, and for parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0157] Although embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention. All such modifications and variations fall within the scope defined by the appended claims. The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
[0158] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A file loading method, characterized in that, include: The system monitors users' historical browsing behavior using code-based tracking. This historical browsing behavior includes page navigation, clicks, scrolling, searching, and dwell time. Different reporting methods and timings should be set for different user browsing history behaviors; By monitoring users' historical browsing behavior to obtain their historical browsing trajectory, the data is cleaned, analyzed, and categorized, and users' actual needs are confirmed through statistics. The actual needs of users are mapped to the state space and behavior space in reinforcement learning, user behavior is predicted, and the weights of user needs for different resources are output. An initial resource loading sequence is generated based on the user's historical browsing trajectory. The predicted user behavior is combined with the weights of different user behaviors. The initial resource loading sequence is iterated multiple times by the user behavior prediction module to obtain the resource loading order sequence. The process of generating an initial resource loading sequence based on the user's historical browsing history combines predicted user behavior with weights for different user behaviors. The user behavior prediction module iterates through the initial resource loading sequence multiple times to obtain a resource loading order sequence, including: Define the reward function as follows: ,in, This represents the reward generated under the current resource loading sequence. This indicates that the user has browsed the resource. Time, This indicates that the front-end page has finished loading resources. Time, Representing resources The difference between user browsing and rendering time is the reward function, which is the sum of the time differences of all resources. User browsing behavior is represented as... , This represents the set of resources currently being viewed by the user. Indicates the user's browsing history. One resource, Indicates the user's browsing history. One resource; The predicted user behavior is combined with the weights of different user behaviors. The user behavior prediction module iterates the initial resource loading sequence multiple times. The reward function tests the user experience of the resource loading sequence and finally outputs the optimal resource loading decision sequence.
2. The file loading method according to claim 1, characterized in that, Monitoring user browsing history behavior using code-based event tracking includes: Manually add event tracking code at key behavior nodes; For user click, scroll, and search behaviors, use JavaScript event listeners and callback functions to introduce tracking scripts; For dwell time, user_id and user_name represent user ID and username, page_path and page_title represent the path and title of the current page, and event_type, act_tag, begin_time, and end_time represent the event type, resource tag, start time, and end time, respectively.
3. The file loading method according to claim 1, characterized in that, The method of setting different reporting methods and timings for different user browsing history behaviors includes: The page redirection behavior is reported synchronously using the WebSocket reporting mechanism. The front end and back end establish a long connection, and the front end transmits the relevant data of the user's page redirection to the server. The click behavior and the search behavior are reported asynchronously using a batch mechanism. The batch mechanism caches the user trajectory collected by the front end using a data queue, and reports it when the data volume reaches the threshold data_threshold. The scrolling and dwell behaviors correspond to the resource reaching the preset virtual view area of the page and the user dwelling on a resource for more than the preset time. The performance data is reported using the Beacon API. For the reported content, a unified field identifier and table structure are used.
4. The file loading method according to claim 1, characterized in that, The process of cleaning and analyzing the embedded data, classifying users' historical browsing behavior, and statistically confirming users' actual needs includes: Clean the collected data on users' historical browsing behavior. The cleaned data is categorized according to preset resource types; For all resources, sort them in ascending order by begin_time to represent the user's behavior trajectory over time. Sort the categorized resources by dwell time to determine the user's interest preferences for the same type of resource. The cleaning process for the collected user browsing history data includes deleting duplicate records and searching for outliers. The rules for deleting duplicate records are as follows: During scrolling, delete user behavior data related to the first screen of page rendering; If both scrolling and dwell behavior data exist for the same resource, only the dwell user behavior data will be retained. If click behavior and dwell behavior data exist for the same resource, only the click behavior data will be retained; If search behavior and dwell behavior data exist for the same resource, only the search behavior data will be retained; The operation searches for outliers and determines whether the dwell time exceeds a preset threshold.
5. The file loading method according to claim 1, characterized in that, The process of mapping the user's actual needs to a state space and behavior space in reinforcement learning, and predicting user behavior to output weights for different user behaviors, includes: The actual user needs are mapped to the state space of reinforcement learning, where the state space is characterized by a unified resource label. The resource label includes at least: scripts, style sheets, JSON, XML, images and audio and video files, etc. The number of resources depends on the current user's browsing environment and resources. The behavior space is defined as the user's browsing behavior in the actual needs of the user; Predict user behavior based on behavior space and state space, and output the weights for different user behaviors.
6. The file loading method according to claim 4, characterized in that, The preset resource types include: act_tag1: JavaScript script file; act_tag2: CSS stylesheet file; act_tag3: JSON file; act_tag4: XML file; act_tag5: Image file. The image file type must include at least: jpg, png, and gif. act_tag6: Audio file. The file type of the audio file must include at least: mp3 or opp. act_tag7: Video file. The file type of the video file must include at least: mp4 or webm. act_tag8: Other files. Other file types include at least: PDF files, SVG vector files, data files, and compressed files.
7. A file loading device, characterized in that, include: Monitoring module: Used to monitor users' historical browsing behavior using code-based tracking. The user's historical browsing behavior includes: page navigation behavior, click behavior, scrolling behavior, search behavior, and dwell time. Settings module: Used to set different reporting methods and timings for different user browsing history behaviors; The statistics module is used to obtain users' historical browsing history by monitoring their browsing behavior, clean and analyze the data, classify users' historical browsing behavior, and confirm users' actual needs through statistics. Prediction module and output module: used to map the user's actual needs to the state space and behavior space in reinforcement learning, predict user behavior, and output the user's demand weights for different resources; The acquisition module is used to generate an initial resource loading sequence based on the user's historical browsing trajectory. It combines the predicted user behavior with the weights of different user behaviors, and iterates the initial resource loading sequence multiple times through the user behavior prediction module to obtain the resource loading order sequence. The process of generating an initial resource loading sequence based on the user's historical browsing history combines predicted user behavior with weights for different user behaviors. The user behavior prediction module iterates through the initial resource loading sequence multiple times to obtain a resource loading order sequence, including: Define the reward function as follows: ,in, This represents the reward generated under the current resource loading sequence. This indicates that the user has browsed the resource. Time, This indicates that the front-end page has finished loading resources. Time, Representing resources The difference between user browsing and rendering time is the reward function, which is the sum of the time differences of all resources. User browsing behavior is represented as... , This represents the set of resources currently being viewed by the user. Indicates the user's browsing history. One resource, Indicates the user's browsing history. One resource; The predicted user behavior is combined with the weights of different user behaviors. The user behavior prediction module iterates the initial resource loading sequence multiple times. The reward function tests the user experience of the resource loading sequence and finally outputs the optimal resource loading decision sequence.
8. An electronic device, characterized in that, include: Processor and memory; The processor executes a file loading method as described in any one of claims 1 to 6 by invoking programs or instructions stored in the memory.
9. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a program or instructions that cause a computer to perform a file loading method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Data loading method and device, computer equipment and storage medium
CN110377361A
Application program loading method and device, electronic equipment and readable storage medium
CN111666497A
Page resource loading method and device, electronic equipment and readable storage medium
CN112181532A
Page loading method and device, storage medium and computer equipment
CN116225567A
Functional module loading method and device, storage medium and electronic device
CN111190654A