CN114880185A - Page data collection method and device, electronic equipment and storage medium - Google Patents

Page data collection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114880185A
CN114880185A CN202210438376.5A CN202210438376A CN114880185A CN 114880185 A CN114880185 A CN 114880185A CN 202210438376 A CN202210438376 A CN 202210438376A CN 114880185 A CN114880185 A CN 114880185A
Authority
CN
China
Prior art keywords
target
node
event
information
target node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210438376.5A
Other languages
Chinese (zh)
Inventor
胡志伟
陈琳
林叶新
陶凯伦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202210438376.5A priority Critical patent/CN114880185A/en
Publication of CN114880185A publication Critical patent/CN114880185A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • G06F11/3093Configuration details thereof, e.g. installation, enabling, spatial arrangement of the probes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3438Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment monitoring of user actions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/86Event-based monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method and a device for collecting page data, electronic equipment and a storage medium. The method comprises the following steps: responding to a collection request aiming at a target node in a page, and acquiring a collection instruction bound by the target node; acquiring node information of the target node through a collection instruction, wherein the node information comprises a target event corresponding to the collection request; determining whether the target event is registered in the target node according to the node information, and if the target event is registered in the target node, using an agent class to proxy the target event to determine a target agent instance; in response to the target event being executed, page data for the target node is collected according to the target agent instance. Through the transparent registration, the embedded point code is prevented from being written into the service code, so that the embedded point code and the service code are completely decoupled, the development efficiency is improved, the maintenance cost is reduced, and the flexibility of the code is enhanced.

Description

Page data collection method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for collecting page data, an electronic device, and a storage medium.
Background
In the related art, in order to obtain detailed data of specific events of each element on a page, the detailed data is usually implemented by means of command type embedding. For the command type embedding point, a program for collecting embedding point data needs to be written on a service code, the coupling degree with the service is high, the embedding point code invades the service code, so that the whole service code becomes complicated and is easy to make mistakes, and the subsequent codes expand increasingly, so that the whole service code is difficult to maintain.
Disclosure of Invention
In view of the above, an object of the present application is to provide a method and an apparatus for collecting page data, an electronic device, and a storage medium.
Based on the purpose, in a first aspect, the application provides a method for collecting page data, including:
responding to a collection request aiming at a target node in a page, and acquiring a collection instruction bound by the target node;
acquiring node information of the target node through the collection instruction, wherein the node information comprises a target event corresponding to the collection request;
determining whether the target event is registered in the target node according to the node information, and if the target event is registered in the target node, using an agent class to proxy the target event to determine a target agent instance;
in response to the target event being executed, collecting page data of the target node according to the target agent instance.
In a possible implementation manner, the obtaining node information of the target node through the collection instruction further includes:
registering the collection instruction to the global environment where the target node is located;
and binding the collection instruction with the target node.
In one possible implementation, the collecting instruction includes: a first hook function;
the obtaining node information of the target node through the collection instruction includes:
and in response to a binding instruction aiming at the target node and the collection instruction, hooking the node information of the target node by utilizing the first hook function.
In one possible implementation, the collecting instruction includes: a second hook function;
the obtaining node information of the target node through the collection instruction further includes:
and hooking the node information of the target node by utilizing the second hook function in response to the updating instruction aiming at the target node.
In one possible implementation, the hooking node information of the target node by using the first hook function in response to the binding instruction for the target node and the collection instruction includes:
constructing a virtual node corresponding to the target node; wherein the virtual node is used to describe the node information of the target node;
and hooking the node information of the target node through the virtual node by using the first hook function.
In one possible implementation manner, the obtaining, by using the second hook function, node information of the target node in response to the update instruction for the target node includes:
constructing a virtual node corresponding to the target node; wherein the virtual node is used to describe the node information of the target node;
updating the virtual node to determine an updated virtual node in response to an update instruction for the target node;
and hooking the updated node information of the target node by using the updated virtual node of the second hook function.
In a possible implementation manner, the node information further includes: event object information;
the acquiring node information of the target node according to the collecting instruction further comprises:
determining dependency information of the target node;
and determining the event object information according to the subordinate information.
In one possible implementation, the dependent information includes: the component information of a target component to which the target node belongs, the module information of a target module to which the target component belongs, the first page information of a target second-level navigation page to which the target module belongs, and the second page information of a target first-level navigation page to which the target second-level navigation page belongs; the event object information includes: an ID corresponding to the target node;
the determining the event object information according to the subordinate information further includes:
determining the component numbers of the target components in all the components according to the component information;
determining module numbers of the target module in all modules according to the module information;
determining the first page number of the target second-level navigation page in all second-level navigation pages according to the first page information;
determining a second page number of the target first-level navigation page in all first-level navigation pages according to the second page information;
and determining the ID corresponding to the target node according to the component number, the module number, the first page number and the second page number.
In a possible implementation manner, the node information includes: a set of names of registered events; the name set of the registered events comprises names of all events registered in the target node; the information of the target event comprises: a name of the target event;
the determining whether the target event has been registered in the target node according to the node information further includes:
determining whether the name of the target event exists in the set of names of registered events;
in response to the name of the target event being present in the set of names of registered events, the target event has been registered with the target node.
In one possible implementation, the determining whether the name of the target event exists in the name set of the registered event further includes:
in response to the name of the target event not being present in the set of names of registered events, the target event is not registered with the target node.
In a possible implementation manner, the node information includes: a registered event;
said proxying said target event with a proxy class to determine a target proxy instance in response to said target event having been registered with said target node, further comprising:
in response to the target event having been registered with the target node, determining a target event function corresponding to the target event;
proxying the target event function using the proxy class to determine the target proxy instance.
In one possible implementation, the collecting page data of the target node according to the target agent instance in response to the target event being executed further includes:
overriding the registered event with the target agent instance;
intercepting, with the target proxy instance, a call operation of the target event function in response to the target event being executed;
and collecting page data of the target node by utilizing the target agent instance.
In a possible implementation manner, the determining whether the target event is registered in the target node according to the node information further includes:
registering the target event with the target node in response to the target event not being registered with the target node;
invoking the target event function in response to the target event being executed;
and collecting page data of the target node according to the target event function.
In a second aspect, the present application provides a target node buried point data collecting apparatus, including:
the first acquisition module is configured to respond to a collection request aiming at a target node in a page, and acquire a collection instruction bound by the target node;
a second obtaining module configured to obtain node information of the target node through the collection instruction, where the node information includes a target event corresponding to the collection request;
an agent module configured to determine whether the target event is registered in the target node according to the node information, and if the target event is registered in the target node, to determine a target agent instance by using an agent class to proxy the target event;
a collection module configured to collect page data of the target node according to the target agent instance in response to the target event being executed.
In a third aspect, the present application provides an electronic device, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the program to implement the method for collecting page data according to the first aspect.
In a fourth aspect, the present application provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of collecting page data according to the first aspect.
From the above description, it can be seen that the page data collection method, apparatus, electronic device and storage medium provided by the present application construct a collection instruction that can be registered in a global environment, when a collection request sent by a user is received, obtain node information of a target node according to the collection instruction, bind the collection instruction to the target node, determine whether a target event has been registered on the target node according to the node information of the target node, once it is determined that the target event has been registered on the target node, proxy the target event using a proxy class to determine a target proxy instance, and when the target event is executed, collect page data of the target node according to the target proxy instance. Through the transparent registration, the embedded point code is prevented from being written into the service code, so that the embedded point code and the service code are completely decoupled, the development efficiency is improved, the maintenance cost is reduced, and the flexibility of the code is enhanced.
Drawings
In order to more clearly illustrate the technical solutions in the present application or the related art, the drawings needed to be used in the description of the embodiments or the related art will be briefly introduced below, and it is obvious that the drawings in the following description are only embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 illustrates an exemplary flowchart of a method for collecting page data according to an embodiment of the present application.
Fig. 2 shows an exemplary structural diagram of a device for collecting page data provided by an embodiment of the present application.
Fig. 3 shows an exemplary structural schematic diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is further described in detail below with reference to the accompanying drawings in combination with specific embodiments.
It should be noted that technical terms or scientific terms used in the embodiments of the present application should have a general meaning as understood by those having ordinary skill in the art to which the present application belongs, unless otherwise defined. The use of "first," "second," and similar terms in the embodiments of the present application do not denote any order, quantity, or importance, but rather the terms are used to distinguish one element from another. The word "comprising" or "comprises", and the like, means that the element or item preceding the word comprises the element or item listed after the word and its equivalent, but does not exclude other elements or items. The terms "connected" or "coupled" and the like are not restricted to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "upper", "lower", "left", "right", and the like are used merely to indicate relative positional relationships, and when the absolute position of the object being described is changed, the relative positional relationships may also be changed accordingly.
As described in the background section, one type of requirement is from the standpoint of the need for a buried point to obtain detailed data for each element-specific event in the page. Generally, the related art can be solved by two schemes.
One of the related technologies is realized by a command type point burying mode, which is a common mode, a JS method is used for collecting data of the point burying data at a place where a user generates a behavior, a developer needs to manually bury the point at a node where the point needs to be buried, and the coupling degree with a service is high. For example, when a button or a linked callback function is clicked, or when a page ready is clicked, the request is sent.
However, through research, the applicant finds that, because the embedded point code needs to be written into the service code, the embedded point code is likely to be invaded into the service code, so that the whole service code becomes complicated and is easy to make mistakes, and the subsequent code becomes more expansive and is difficult to maintain.
Another related technology is implemented by a backend in a embedded point manner, where the backend collects embedded points by acting on a response to a request, for example, clicking a certain button requests a certain interface in service, and when receiving the interface request, the backend can know that the button is clicked, thereby collecting the embedded point data.
However, the applicant has found through research that there are inaccurate situations for the backend buried point to communicate the event response of the front end to the backend completely through the service interface. For example, some front-end operations may not trigger a request of a certain service interface, but require a great deal of detail on user behavior statistics, and the back-end cannot capture the details. In addition, the request of the service interface does not necessarily come from only one front-end operation.
In summary, if a backend buried point is used, there is a problem that data collection of the buried point is inaccurate, and a more common declarative buried point has poor flexibility and low development efficiency, while coupling of a command buried point and a service is deep, and there are problems that a service code is cumbersome and easy to make mistakes, and the service code is difficult to maintain and maintenance cost is high due to expansion of subsequent codes.
Accordingly, the present application provides a method, an apparatus, an electronic device, and a storage medium for collecting page data, which construct a collection instruction that can be registered in a global environment, obtain node information of a target node according to the collection instruction when receiving a collection request from a user, bind the collection instruction to the target node, determine whether a target event has been registered in the target node according to the node information of the target node, and determine a target agent instance by proxying the target event using a proxy class once it is determined that the target event has been registered in the target node. Through the transparent registration, the embedded point code is prevented from being written into the service code, so that the embedded point code and the service code are completely decoupled, the development efficiency is improved, the maintenance cost is reduced, and the flexibility of the code is enhanced. The following describes a method for collecting page data provided by the embodiments of the present application in detail by using specific embodiments.
Fig. 1 illustrates an exemplary flowchart of a method for collecting page data according to an embodiment of the present application.
Referring to fig. 1, a method for collecting page data provided in the embodiment of the present application specifically includes the following steps:
s102: and responding to a collection request aiming at a target node in a page, and acquiring a collection instruction bound by the target node.
S104: and acquiring node information of the target node through the collection instruction, wherein the node information comprises a target event corresponding to the collection request.
S106: and determining whether the target event is registered in the target node according to the node information, and if the target event is registered in the target node, using an agent class to proxy the target event to determine a target agent instance.
S108: in response to the target event being executed, collecting page data of the target node according to the target agent instance.
With respect to step S102, the application takes an implementation under the Vue framework as an example, the Vue framework is a set of progressive frameworks for constructing the user interface, and the Vue page refers to a web application developed based on the Vue framework. Since the target node needs to be collected with the buried point data, a collection instruction, such as Vue custom instruction, can be constructed for performing the bottom layer operation on the target node.
In some embodiments, a custom instruction, i.e., a collection instruction, may be defined in item Vue, and the collection instruction is registered to the global environment where the target node is located, which may be named v-record. Further, the collection instruction can be bound with the target node, so that the collection of the buried point data of the target node is facilitated in the subsequent steps.
With respect to step S104, when a user or a developer wants to collect data of buried points of a certain or some target nodes, a collection request is issued, and when receiving the collection request, node information of the target node may be obtained according to a collection instruction bound to the target node. Since the buried point data is generated by triggering a specific event on the target node, the collection request from the user or developer may include information for the target event that can generate the buried point data after being triggered.
In some embodiments, optional hooking functions are generally provided in the gather instruction, and different hooking functions may be used to handle operations that a target node needs to perform at different times. In particular, a first hook function, such as a bind hook function, may be included in the gather instruction. If the target node is determined to be bound to the gather instruction for the first time, the node information in the target node may be hooked using a first hook function. In general, the first hook function may be used to hook the node information of the target node only when the target node is bound with the collection instruction for the first time, so that for one target node, the first hook function only needs to be called once.
In some embodiments, the information of the target node may be described in the buried point code with a virtual node because the buried point code is not written in the service code. When the node information is hooked by using the first hook function, a virtual node corresponding to the target node may be constructed, and the virtual node may specifically be the target node described with the JS object, so that the node information of the target node is described in the virtual node. Specifically, Vue may be utilized to compile a virtual node corresponding to the target node, and the virtual node may read all node information of the target node currently bound by the collection instruction. Further, the node information of the target node is hooked through the hooking virtual node by utilizing the first hook function.
In some embodiments, a second hook function, such as an update hook function, may also be included in the gather instruction. If the target node is detected to be updated, the node information of the target node is updated after the target node is updated, so that the node information of the target node can be hooked by using the second hook function. It is understood that, each time the target node performs an update, the node information of the target node may be re-hooked using the second hooking function, so as to update the node information of the target node that has been hooked. The node information of the hooked target node is updated, the hooked updated node information can directly cover the previously hooked non-updated node information, or the updated node information and the non-updated node information can be compared to determine the difference between the updated node information and the non-updated node information, so that the updated node information and the non-updated node information are covered in the non-updated node information.
In some embodiments, as well, because the buried point code is not written in the service code, the information of the target node can be described in the buried point code by a virtual node. Therefore, when the node information is hooked by using the second hook function, a virtual node corresponding to the target node may be constructed, and the virtual node may specifically be the target node described with the JS object, so that the node information of the target node is described in the virtual node. Specifically, Vue may be utilized to compile a virtual node corresponding to the target node, and the virtual node may read all node information of the target node currently bound by the collection instruction. After detecting that the target node is updated, updating the node information of the target node described in the virtual node, thereby determining the updated node information of the target node.
In some embodiments, the node information of the target node may include event object information. In the process of acquiring the node information of the target node according to the collection instruction, the dependent information of the target node may be determined, and further, the event object information in the node information may be determined according to the dependent information. Specifically, the dependent information may include component information of a target component to which the target node belongs, module information of a target module to which the target component belongs, first page information of a target second-level navigation page to which the target module belongs, and second page information of a target first-level navigation page to which the target second-level navigation page belongs. And the event object information may include an ID corresponding to the target node, which may be represented by a code.
It should be noted that, determining the event object information according to the dependency information may specifically include the following steps:
s202: and determining the component number of the target component in all the components according to the component information.
S204: and determining the module numbers of the target module in all the modules according to the module information.
S206: and determining the first page number of the target second-level navigation page in all the second-level navigation pages according to the first page information.
S208: and determining the second page number of the target first-level navigation page in all the first-level navigation pages according to the second page information.
S210: and determining the ID corresponding to the target node according to the component number, the module number, the first page number and the second page number.
Specifically, the ID is composed of a component number, a module, a first page number, and a second page number, for example, a first-level number is a first-level navigation page corresponding to a page group, and the second page number indicates which page of the page group the target node is in; the second layer of numbers are second-level navigation pages corresponding to one page, the first page number is a classification module indicating which target node belongs to which current page, for example, the page is composed of four large-class modules, and the first page number is a module for indicating which large-class the target node belongs to; the third layer of numbers are module numbers, namely, modules in a large class are divided into different functional modules, and the module numbers are used for indicating the sub-modules of the modules in which the target nodes are in the large class; the number of the fourth layer is a component number, which is the serial number of the specific component where the target node is located, and is used for indicating which specific component the target node is located in.
It should be noted that, for example, the first-level navigation page corresponds to a board, and the board can be divided into three pages, namely public opinion analysis-1, public opinion intervention-2 and all comments-3, wherein 1, 2 and 3 are corresponding second page numbers; the second-level navigation page corresponds to a classification module, and the classification module in public opinion analysis-1 can be divided into overall analysis-1, live broadcast analysis-2, game hot word analysis-3, keyword analysis-4, vulnerability statistics-5, contest analysis-6, whole network customized monitoring-7 and a heat conference propagation chain-8, wherein 1-8 are corresponding first page numbers; the modules correspond to specific functional modules, and the specific functional modules in the overall analysis-1 can be divided into a sound volume trend-1, a public praise proportion-2, a related word cloud-3, a main page top-4, a public opinion overview-5, a game hot word ranking-6, a key channel wind direction-7, a live broadcast hot word list-8 and a public opinion report-9, wherein 1-9 are corresponding module numbers; the components correspond to specific components, and the specific components in the volume trend-1 can be divided into channel screening-1, time screening-2, icon-channel clicking-3 and icon-restoring-4, wherein 1-4 are corresponding component numbers. Assuming that the target node is an icon-channel click in the specific function module of the sound volume trend in the overall analysis classification module in the public opinion analysis plate, the ID corresponding to the target node may be (1, 1, 1, 3), so that a corresponding ID may be set for each node, thereby distinguishing different nodes.
With respect to step S106, it may be determined whether the target event has been registered on the target node according to the node information based on the information of the target event. In some embodiments, the node information may further include: the name set of the registered event comprises the names of all events registered in the target node. The information of the target event in the collection request may include a name of the target event.
Further, it may be determined whether the target event has been registered on the target node by determining whether the name of the target event already exists in the name set of registered events. If the name of the target event exists in the name set of the registered event, the target time is proved to have been registered on the target node. For example, if the name of the target event is "mouse click", it is determined whether the name of the target event "mouse click" exists in the name set of the registered event.
In some embodiments, if the name of the target event does not exist in the set of names of registered events, the target event is proved to be unregistered on the target node.
With respect to step S108, when it is determined that the target event has been registered on the target node, the target event may be proxied using the proxy class, thereby determining a target proxy instance. Specifically, the node information may further include a registered event, and when it is determined that the target event has been registered on the target node, a target event function corresponding to the target event may be determined, because the manner of triggering the target event is generally implemented by executing the target event function. After determining the target event function corresponding to the target event, the target event function may be proxied using the proxy class to determine the target proxy instance. The Proxy class may select a Proxy agent, and specifically, if the target event is already registered on the target node, the Proxy agent may determine a Proxy instance (which may be denoted as an app) by using a target event function defined in the service code that a click on the button may execute the target event function, for example, if a button is on a page.
With respect to step S110, page data of the target node may be collected from the proxy instance when the target event is executed. Specifically, the proxy instance may be used to override the registered event described on the virtual node, that is, replace the original registered target event with the proxy instance, and when the target event is executed, the proxy instance may be used to intercept the call operation of the target event function, so as to collect the detailed data of the target node at this time by using the proxy instance. For example, a button is provided on a page, when a user clicks the button, a target event function is triggered, that is, a time function corresponding to an event of "mouse click" is clicked, the target event function executes a call operation, which indicates that the target event is executed at this time, that is, the event of "mouse click" is executed at this time, then the original call operation of the target event function is intercepted by using the proxy instance app, and the logic for collecting page data is called outside the original processing function (that is, the step after the original target event function is called is still executed), so that the page data of the target node is collected without affecting the operation step after the original target event function is executed.
It should be noted that, for example, for a button, an event of "mouse click" needs to be collected, the event may be represented as a click, and a click event is also registered in the service of the button itself, and the function name may be handleClick, at this time, only the event name of "mouse click" or "click" and the id (code) corresponding to the target node need to be transmitted in the collection instruction (v-record) already bound to the target node (i.e., the button), and then page data of the target node needs to be collected.
In some embodiments, if the target event is not registered on the target node, the target event may be directly registered on the target node through a registration program, and when the target event is executed, a target event function corresponding to the target event may be called, and the buried point data of the target node may be collected according to the target event function. For example, if the registered event of the target node does not include the target event of "mouse hover", but the behavior of "mouse hover" needs to be recorded, the target event of "mouse hover" can be directly registered to the target node by using a registration program, the logic for collecting page data is processed, and then the page data of the target event of "mouse hover" executed by the target node is collected.
From the above description, it can be seen that the page data collection method, apparatus, electronic device and storage medium provided by the present application construct a collection instruction that can be registered in a global environment, when a collection request sent by a user is received, obtain node information of a target node according to the collection instruction, bind the collection instruction to the target node, determine whether a target event has been registered on the target node according to the node information of the target node, once it is determined that the target event has been registered on the target node, proxy the target event using a proxy class to determine a target proxy instance, and when the target event is executed, collect page data of the target node according to the target proxy instance. Through the transparent registration, the embedded point code is prevented from being written into the service code, so that the embedded point code and the service code are completely decoupled, the development efficiency is improved, the maintenance cost is reduced, and the flexibility of the code is enhanced.
It should be noted that the method of the embodiment of the present application may be executed by a single device, such as a computer or a server. The method of the embodiment can also be applied to a distributed scene and completed by the mutual cooperation of a plurality of devices. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiment, and the multiple devices interact with each other to complete the method.
It should be noted that the description describes some embodiments of the present application. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the described embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Fig. 2 shows an exemplary structural diagram of a device for collecting page data provided by an embodiment of the present application.
Based on the same inventive concept, corresponding to the method of any embodiment, the application also provides a device for collecting page data.
Referring to fig. 2, the target node buried point data collecting apparatus includes: the system comprises a first acquisition module, a second acquisition module, an agent module and a collection module; wherein the content of the first and second substances,
the first acquisition module is configured to respond to a collection request aiming at a target node in a page, and acquire a collection instruction bound by the target node;
a second obtaining module configured to obtain node information of the target node through the collection instruction, where the node information includes a target event corresponding to the collection request;
an agent module configured to determine whether the target event is registered in the target node according to the node information, and if the target event is registered in the target node, to determine a target agent instance by using an agent class to proxy the target event;
a collection module configured to collect page data of the target node according to the target agent instance in response to the target event being executed.
In one possible implementation, the apparatus further includes: a binding module;
the binding module is further configured to:
registering the collection instruction to the global environment where the target node is located;
and binding the collection instruction with the target node.
In one possible implementation, the collecting instruction includes: a first hook function;
the acquisition module is further configured to:
and responding to a binding instruction aiming at the target node and the collection instruction, and acquiring node information of the target node by utilizing the first hook function.
In one possible implementation, the collecting instruction includes: a second hook function;
the acquisition module is further configured to:
and responding to an updating instruction aiming at the target node, and acquiring node information of the target node by utilizing the second hook function.
In one possible implementation, the obtaining module is further configured to:
constructing a virtual node corresponding to the target node; wherein the virtual node is used to describe the node information of the target node;
and hooking the node information of the target node through the virtual node by using the first hook function.
In one possible implementation, the obtaining module is further configured to:
constructing a virtual node corresponding to the target node; wherein the virtual node is used to describe the node information of the target node;
in response to detecting the target node update, updating the virtual node to determine an updated virtual node;
and hooking the updated node information of the target node through the updated virtual node by using the second hook function.
In a possible implementation manner, the node information further includes: event object information;
the acquisition module is further configured to:
determining dependency information of the target node;
and determining the event object information according to the subordinate information.
In one possible implementation, the dependent information includes: the component information of a target component to which the target node belongs, the module information of a target module to which the target component belongs, the first page information of a target second-level navigation page to which the target module belongs, and the second page information of a target first-level navigation page to which the target second-level navigation page belongs; the event object information includes: an ID corresponding to the target node;
the acquisition module is further configured to:
determining the component numbers of the target components in all the components according to the component information;
determining module numbers of the target module in all modules according to the module information;
determining the first page number of the target second-level navigation page in all second-level navigation pages according to the first page information;
determining a second page number of the target first-level navigation page in all first-level navigation pages according to the second page information;
and determining the ID corresponding to the target node according to the component number, the module number, the first page number and the second page number.
In a possible implementation manner, the node information includes: a set of names of registered events; the name set of the registered events comprises names of all events registered in the target node; the information of the target event comprises: a name of the target event;
the determination module is further configured to:
determining whether the name of the target event exists in the set of names of registered events;
in response to the name of the target event being present in the set of names of registered events, the target event has been registered with the target node.
In one possible implementation, the determining module is further configured to:
in response to the name of the target event not being present in the set of names of registered events, the target event is not registered with the target node.
In a possible implementation manner, the node information includes: a registered event;
the agent module is further configured to:
in response to the target event having been registered with the target node, determining a target event function corresponding to the target event;
proxying the target event function using the proxy class to determine the target proxy instance.
In one possible implementation, the collection module is further configured to:
overriding the registered event with the target agent instance;
intercepting, with the target proxy instance, a call operation of the target event function in response to the target event being executed;
and collecting buried point data of the target node by utilizing the proxy instance.
In one possible implementation, the determining module is further configured to:
registering the target event with the target node in response to the target event not being registered with the target node;
invoking the target event function in response to the target event being executed;
and collecting page data of the target node according to the target event function.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, the functionality of the various modules may be implemented in the same one or more software and/or hardware implementations as the present application.
The apparatus of the embodiment is used to implement the method for collecting corresponding page data in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Fig. 3 shows an exemplary structural schematic diagram of an electronic device provided in an embodiment of the present application.
Based on the same inventive concept, corresponding to the method of any embodiment, the application further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, the method for collecting the target node buried point data according to any embodiment is implemented. Fig. 3 is a schematic diagram illustrating a more specific hardware structure of an electronic device according to this embodiment, where the electronic device may include: a processor 310, a memory 320, an input/output interface 330, a communication interface 340, and a bus 350. Wherein the processor 310, memory 320, input/output interface 330, and communication interface 340 are communicatively coupled to each other within the device via bus 350.
The processor 310 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present specification.
The Memory 320 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 320 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 320 and called to be executed by the processor 310.
The input/output interface 330 is used for connecting an input/output module to realize information input and output. The input/output module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 340 is used for connecting a communication module (not shown in the figure) to implement communication interaction between the present device and other devices. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 350 includes a path that transfers information between the various components of the device, such as processor 310, memory 320, input/output interface 330, and communication interface 340.
It should be noted that although the device only shows the processor 310, the memory 320, the input/output interface 330, the communication interface 340 and the bus 350, in a specific implementation, the device may also include other components necessary for normal operation. Moreover, those skilled in the art will appreciate that the apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
The electronic device of the embodiment is used for implementing the corresponding page data collection method in any one of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Based on the same inventive concept, corresponding to the method of any of the embodiments, the present application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method for collecting page data according to any of the embodiments.
Computer-readable media of the present embodiments, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
The computer instructions stored in the storage medium of the embodiment are used to enable the computer to execute the method for collecting page data according to any one of the above embodiments, and have the beneficial effects of the corresponding method embodiment, which are not described herein again.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, is limited to these examples; within the context of the present application, features from the above embodiments or from different embodiments may also be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of brevity.
In addition, well-known power/ground connections to Integrated Circuit (IC) chips and other components may or may not be shown in the provided figures for simplicity of illustration and discussion, and so as not to obscure the embodiments of the application. Furthermore, devices may be shown in block diagram form in order to avoid obscuring embodiments of the application, and this also takes into account the fact that specifics with respect to implementation of such block diagram devices are highly dependent upon the platform within which the embodiments of the application are to be implemented (i.e., specifics should be well within purview of one skilled in the art). Where specific details (e.g., circuits) are set forth in order to describe example embodiments of the application, it should be apparent to one skilled in the art that the embodiments of the application can be practiced without, or with variation of, these specific details. Accordingly, the description is to be regarded as illustrative instead of restrictive.
While the present application has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic ram (dram)) may use the discussed embodiments.
The present embodiments are intended to embrace all such alternatives, modifications and variances which fall within the broad scope of the appended claims. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present application are intended to be included within the scope of the present application.

Claims (16)

1. A method for collecting page data is characterized by comprising the following steps:
responding to a collection request aiming at a target node in a page, and acquiring a collection instruction bound by the target node;
acquiring node information of the target node through the collection instruction, wherein the node information comprises a target event corresponding to the collection request;
determining whether the target event is registered in the target node according to the node information, and if the target event is registered in the target node, using an agent class to proxy the target event to determine a target agent instance;
in response to the target event being executed, collecting page data of the target node according to the target agent instance.
2. The method according to claim 1, wherein the obtaining node information of the target node by the collecting instruction further comprises:
registering the collection instruction to the global environment where the target node is located;
and binding the collection instruction with the target node.
3. The method of claim 1, wherein the collecting instructions comprises: a first hook function;
the obtaining node information of the target node through the collection instruction includes:
and responding to a binding instruction aiming at the target node and the collection instruction, and acquiring node information of the target node by utilizing the first hook function.
4. The method of claim 1, wherein the collecting instructions comprises: a second hook function;
the obtaining node information of the target node through the collection instruction further includes:
and responding to an updating instruction aiming at the target node, and acquiring node information of the target node by utilizing the second hook function.
5. The method according to claim 3, wherein the obtaining node information of the target node by using the first hook function in response to a binding instruction for the target node and the collection instruction comprises:
constructing a virtual node corresponding to the target node; wherein the virtual node is used to describe the node information of the target node;
and hooking the node information of the target node through the virtual node by using the first hook function.
6. The method according to claim 4, wherein the obtaining node information of the target node by using the second hook function in response to the update instruction for the target node comprises:
constructing a virtual node corresponding to the target node; wherein the virtual node is used to describe the node information of the target node;
updating the virtual node to determine an updated virtual node in response to an update instruction for the target node;
and hooking the updated node information of the target node through the updated virtual node by using the second hook function.
7. The method of claim 1, wherein the node information further comprises: event object information;
the obtaining node information of the target node through the collecting instruction further includes:
determining dependency information of the target node;
and determining the event object information according to the subordinate information.
8. The method of claim 7, wherein the dependency information comprises: the component information of a target component to which the target node belongs, the module information of a target module to which the target component belongs, the first page information of a target second-level navigation page to which the target module belongs, and the second page information of a target first-level navigation page to which the target second-level navigation page belongs; the event object information includes: an ID corresponding to the target node;
the determining the event object information according to the subordinate information further comprises:
determining the component number of the target component in all the components according to the component information;
determining module numbers of the target module in all modules according to the module information;
determining the first page number of the target second-level navigation page in all second-level navigation pages according to the first page information;
determining a second page number of the target first-level navigation page in all first-level navigation pages according to the second page information;
and determining the ID corresponding to the target node according to the component number, the module number, the first page number and the second page number.
9. The method of claim 1, wherein the node information comprises: a set of names of registered events; the name set of the registered events comprises names of all events registered in the target node; the information of the target event comprises: a name of the target event;
the determining whether the target event has been registered in the target node according to the node information further includes:
determining whether the name of the target event exists in the set of names of registered events;
in response to the name of the target event being present in the set of names of registered events, the target event has been registered with the target node.
10. The method of claim 9, wherein determining whether the name of the target event is present in the set of names of the registered events further comprises:
in response to the name of the target event not being present in the set of names of registered events, the target event is not registered with the target node.
11. The method of claim 1, wherein the node information comprises: a registered event;
said proxying said target event with a proxy class to determine a target proxy instance in response to said target event having been registered with said target node, further comprising:
in response to the target event having been registered with the target node, determining a target event function corresponding to the target event;
proxying the target event function using the proxy class to determine the target proxy instance.
12. The method of claim 11, wherein collecting page data of the target node according to the target agent instance in response to the target event being executed further comprises:
overriding the registered event with the target agent instance;
intercepting, with the target proxy instance, a call operation of the target event function in response to the target event being executed;
and collecting page data of the target node by utilizing the target agent instance.
13. The method of claim 11, wherein determining whether the target event has been registered with the target node according to the node information further comprises:
registering the target event with the target node in response to the target event not being registered with the target node;
invoking the target event function in response to the target event being executed;
and collecting page data of the target node according to the target event function.
14. A target node buried point data collecting apparatus, comprising:
the first acquisition module is configured to respond to a collection request aiming at a target node in a page, and acquire a collection instruction bound by the target node;
a second obtaining module configured to obtain node information of the target node through the collection instruction, where the node information includes a target event corresponding to the collection request;
an agent module configured to determine whether the target event is registered in the target node according to the node information, and if the target event is registered in the target node, to determine a target agent instance by using an agent class to proxy the target event;
a collection module configured to collect page data of the target node according to the target agent instance in response to the target event being executed.
15. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 13 when executing the program.
16. A non-transitory computer readable storage medium storing computer instructions for causing a computer to implement the method of any one of claims 1 to 13.
CN202210438376.5A 2022-04-20 2022-04-20 Page data collection method and device, electronic equipment and storage medium Pending CN114880185A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210438376.5A CN114880185A (en) 2022-04-20 2022-04-20 Page data collection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210438376.5A CN114880185A (en) 2022-04-20 2022-04-20 Page data collection method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114880185A true CN114880185A (en) 2022-08-09

Family

ID=82671677

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210438376.5A Pending CN114880185A (en) 2022-04-20 2022-04-20 Page data collection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114880185A (en)

Similar Documents

Publication Publication Date Title
CN107273266B (en) Application log processing method and device
EP3436943B1 (en) Validating stateful dynamic links in mobile applications
US9811679B2 (en) Electronic system with access management mechanism and method of operation thereof
KR101798697B1 (en) File access with different file hosts
CN104077387A (en) Webpage content display method and browser device
EP2656249A1 (en) Methods, apparatuses and computer program products for converting a geographical database into a map tile database
US10275398B2 (en) Content display device, content display method, and content display program
EP3230867B1 (en) Browser provided website statistics
CN111581069A (en) Data processing method and device
WO2018149383A1 (en) Page display method and apparatus, storage medium, and electronic apparatus
CN109086429B (en) IVR voice navigation method, system, equipment and storage medium
CN111309743A (en) Report pushing method and device
US9977703B2 (en) Subscriber-based event subscription
CN116841978A (en) Path analysis method, device and storage medium based on distributed file system
CN114880185A (en) Page data collection method and device, electronic equipment and storage medium
US9998341B2 (en) Method of constructing data collector, server performing the same and storage medium for the same
CN105262829B (en) Geographical position monitoring method and system
US9269280B2 (en) Apparatus for analyzing geographic information and method thereof
KR20190074552A (en) Mash-up method for integrating heterogeneous data and apparatus thereof
JP6641936B2 (en) Information processing apparatus, information processing program, and information processing method
CN116561735B (en) Mutual trust authentication method and system based on multiple authentication sources and electronic equipment
CN116820354B (en) Data storage method, data storage device and data storage system
CN111104626B (en) Information storage method and device
CN112733145B (en) Android application detection and analysis method, electronic equipment and storage medium
US20130185734A1 (en) Subscriber-based event subscription

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination