DOM (Document Object Model) element click rate processing method and equipment, medium and program product
By obtaining and matching the click event report message of DOM elements in the computer test scenario, calculating the element similar values and accumulating historical clicks, the problem of low statistical accuracy of DOM elements after page status changes is solved, and higher statistical accuracy is achieved.
Patent Information
- Application Number
- CN202411943135.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-30
AI Technical Summary
In computer testing scenarios, it is difficult for the prior art to accurately count the number of clicks of DOM elements after page state changes, resulting in low statistical accuracy.
By obtaining the click event report message of the DOM element in the target page, obtaining the element path and image association information, matching the element path in the reported data set, calculating the element similarity value, and accumulating historical clicks when the similar value is greater than the preset threshold.
Improve the statistical accuracy of the number of clicks on DOM elements, avoiding inaccurate statistics of click events caused by page status changes.
Smart Images

Figure CN120066912A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer testing technologies, and in particular, to a method, device, medium, and program product for processing the click volume of DOM elements. Background Art
[0002] In a computer testing scenario, determining the click volume of relevant functions in an application to determine the usage of the functions based on the click volume is crucial for improving the service quality of the application.
[0003] In related technologies, for a DOM element to be observed in a page of an application, an element path (XML Path Language, Xpath) of the DOM element in the page is bound, and the click volume of the DOM element is counted by identifying the element path of the DOM element corresponding to the reported click event.
[0004] However, in actual applications, the state of the page will change, and the element paths in different states of the page will also change. Therefore, the above method of counting the click volume based on the element path of the DOM element will result in low statistical accuracy of the click volume of the DOM element. Summary of the Invention
[0005] To solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, device, medium, and program product for processing the click volume of DOM elements.
[0006] An embodiment of the present disclosure provides a method for processing the click volume of DOM elements. The method includes the following steps: in response to obtaining a click event reporting message of a first DOM element in a target page, obtaining a first element path of the first DOM element in the target page; obtaining a reporting data set corresponding to the target page, where the reporting data set includes element identification information packets and historical click volumes of at least one second DOM element that have been reported, and the element identification information packet includes a second element path and second element image association information of the second DOM element; matching the first element path with the second element path of each second DOM element in the reporting data set; in response to there being no second element path that matches the first element path, obtaining first element image association information of the first DOM element; determining an element similarity value between the first DOM element and each second DOM element according to the first element path, the first element image association information, the second element path, and the second element image association information; and in response to there being a second DOM element whose element similarity value is greater than a preset similarity threshold, performing an accumulation process on the historical click volume of the second DOM element whose element similarity value is greater than the preset similarity threshold.
[0007] An embodiment of the present disclosure also provides a device for processing the click volume of DOM elements. The device includes: a first acquisition module, configured to acquire a first element path of the first DOM element in the target page in response to reporting a message for a click event of the first DOM element in the target page; a second acquisition module, configured to acquire a reporting data set corresponding to the target page, where the reporting data set includes element identification information packets and historical click volumes of at least one second DOM element that have been reported, and the element identification information packet includes a second element path and second element image association information of the second DOM element; a matching module, configured to match the first element path with the second element paths of each second DOM element in the reporting data set; a third acquisition module, configured to acquire first element image association information of the first DOM element in response to the non-existence of a second element path that matches the first element path; a determination module, configured to determine an element similarity value between the first DOM element and each second DOM element according to the first element path, the first element image association information, the second element path, and the second element image association information; and a click volume processing module, configured to perform an accumulation process on the historical click volumes of the second DOM elements whose element similarity values are greater than a preset similarity threshold in response to the existence of a second DOM element whose element similarity value is greater than the preset similarity threshold.
[0008] An embodiment of the present disclosure also provides an electronic device. The electronic device includes: a processor; a memory for storing executable instructions of the processor; and the processor is configured to read the executable instructions from the memory and execute the instructions to implement the method for processing the click volume of DOM elements provided by the embodiment of the present disclosure.
[0009] An embodiment of the present disclosure also provides a computer-readable storage medium. The storage medium stores a computer program, and the computer program is used to execute the method for processing the click volume of DOM elements provided by the embodiment of the present disclosure.
[0010] An embodiment of the present disclosure also provides a computer program product, including a computer program, where the computer program, when executed by a processor, implements the above method for processing the click volume of DOM elements.
[0011] The technical solution provided by the embodiment of the present disclosure has the following advantages compared with the prior art:
[0012] The click volume processing solution for DOM elements provided by the embodiments of the present disclosure reports a message in response to obtaining a click event of a first DOM element in a target page, obtains a first element path of the first DOM element in the target page, and obtains a reporting data set corresponding to the target page. The reporting data set includes element identification information packets and historical click volumes of at least one second DOM element that have been reported. The element identification information packet includes a second element path and second element image association information of the second DOM element. The first element path is matched with the second element paths of each second DOM element in the reporting data set. Furthermore, in response to the non-existence of a second element path that matches the first element path, the first element image association information of the first DOM element is obtained, and the element similarity value between the first DOM element and each second DOM element is determined according to the first element path, the first element image association information, the second element path, and the second element image association information. In response to the existence of a second DOM element whose element similarity value is greater than a preset similarity threshold, the historical click volumes of the second DOM elements greater than the preset similarity threshold are cumulatively processed. In this technical solution, it is avoided that after the DOM element path changes, the click events of the DOM elements cannot be accurately counted, and the statistical accuracy of the click volumes of the DOM elements is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In combination with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the original and elements are not necessarily drawn to scale.
[0014] Figure 1 It is a schematic flowchart of a method for processing click volumes of DOM elements provided by the embodiments of the present disclosure;
[0015] Figure 2 It is a schematic diagram of click annotation information provided by the embodiments of the present disclosure;
[0016] Figure 3 It is a schematic diagram of a list element provided by the embodiments of the present disclosure;
[0017] Figure 4 It is a schematic flowchart of a method for processing click volumes of DOM elements in a specific embodiment provided by the present disclosure;
[0018] Figure 5 It is a schematic structural diagram of a device for processing click volumes of DOM elements provided by the embodiments of the present disclosure;
[0019] Figure 6 It is a schematic structural diagram of an electronic device provided by the embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.
[0021] It should be understood that the various steps recited in the method embodiments of the present disclosure can be executed in a different order and / or executed in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.
[0022] As used herein, the term "including" and its variants are open-ended, i.e., "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0023] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependent relationships.
[0024] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0025] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.
[0026] To solve the above problems, embodiments of the present disclosure provide a method for processing the click volume of DOM elements. The method will be introduced below in combination with specific embodiments. Among them, a DOM (Document Object Model) element is a node in an HTML or XML document. It can be the root node, element node, text node, comment node, etc. corresponding to the page.
[0027] Figure 1The flowchart of a method for processing the click volume of DOM elements provided by an embodiment of the present disclosure. This method can be executed by a device for processing the click volume of DOM elements, where the device can be implemented by software and / or hardware and is generally integrated in an electronic device. As Figure 1 shown, the method includes:
[0028] Step 101, in response to obtaining a click event reporting message of a first DOM element in a target page, obtain a first element path of the first DOM element in the target page.
[0029] In an embodiment of the present disclosure, after the first DOM element is clicked and triggered, the corresponding client reports a click event reporting message of the first DOM element. In response to obtaining the click event reporting message of the first DOM element in the target page, obtain a first element path of the first DOM element in the target page. Among them, the first element path can be understood as Xpath. As a possible example, the first element path is: html / body / div.class#id / button / button.
[0030] In the actual operation process, in order to avoid the problem of a large amount of reported data caused by all elements reporting, in an embodiment of the present disclosure, the DOM elements corresponding to the click event can be screened. That is, before obtaining the first element path of the first DOM element in the target page, it is determined that the first DOM element meets a preset reporting condition. Among them, the preset reporting condition can be set according to the scenario requirements. For example, the DOM element meeting the preset reporting condition includes: the first DOM element is pre-bound with a reporting event; and / or, the tag type of the first DOM element is a hyperlink tag, that is, the tag type of the first DOM element is an a tag type, etc.
[0031] Step 102, obtain a reporting data set corresponding to the target page, where the reporting data set includes element identification information packets and historical click volumes of at least one second DOM element that has been reported. The element identification information packet includes a second element path and second element image association information of the second DOM element.
[0032] It should be understood that for the convenience of click volume statistics, for each page, the reported DOM elements, their element identification information packets, and historical click volumes are statistically stored in a preset database. Therefore, in an embodiment of the present disclosure, when obtaining the reporting data set corresponding to the target page, the uniform resource locator of the target page can be obtained. Among them, the uniform resource locator (URL) can uniquely identify a page, and query the element identification information packets and historical click volumes of all DOM elements matching the uniform resource locator in the preset database to obtain the reporting data set.
[0033] It is easily understood that the reported data set includes the element identification information packet of at least one reported second DOM element and the historical click volume. The element identification information packet includes the second element path of the second DOM element and the second element image association information. Among them, the second DOM element is the DOM element reported previously in the target page, and the second element image association information can be any information associated with the visual display situation of the second DOM element. In some possible examples, the second element image association information may include the element style of each second DOM element, and the element style can be identified through the oxygen element style code in the page code corresponding to the second DOM element, and / or the second element image association information may include the second page image information where each second DOM element is located. Among them, the second page image information belongs to the same page as the target page, that is, the corresponding URLs are the same, but the page states may not be the same. Among them, the second page image information contains the click annotation information of each second DOM element, and the click annotation information can be any annotation information reflecting the click position of the second DOM element, including but not limited to one or more of icons, letters, texts, colors, animations, etc.
[0034] Among them, if only the click volume of the DOM element in the preset period is counted in the scenario, the reported data set corresponding to the target page in the preset period can also be obtained only.
[0035] Step 103, match the first element path with the second element paths of each second DOM element in the reported data set.
[0036] In this embodiment, matching the first element path with the second element paths of each second DOM element in the reported data set, that is, performing matching based on the Xpath of the first DOM element and the second DOM element to determine whether there is a second element path that matches the first element path.
[0037] Step 104, in response to the non-existence of a second element path that matches the first element path, obtain the first element image association information of the first DOM element.
[0038] In an embodiment of the present disclosure, in response to the existence of a second element path that matches the first element path, directly determine that the second DOM element corresponding to the matching second element path and the first DOM element are the same DOM element. Thus, in this embodiment, accumulate the historical click volume of the matching second DOM element. For example, preset a preset unit click volume increment value, and add the preset unit click volume increment value to the historical click volume of the matching second DOM element. The click volume after superposition is the current total click volume of the second DOM element (the first DOM element).
[0039] In an embodiment of the present disclosure, in response to the non - existence of a second element path that matches the first element path, it is not considered that the first DOM element is clicked for the first time. It can be understood that if the page state of the target page has changed compared with before, the first element path has changed accordingly. As a result, it is impossible to match a second DOM element identical to the first DOM element based on the first element path. Therefore, the first element image association information of the first DOM element is obtained, and it is further determined whether there is a second DOM element identical to the first DOM element based on the visual dimension.
[0040] Among them, the first element image association information may also include element styles; and / or, target page image information, where the click position of the first DOM element is marked in the target page image information.
[0041] In some possible examples, when the second element image association information includes the second page image information, obtaining the first element image association information of the first DOM element may include:
[0042] Step 1041: Obtain the DOM tree structure corresponding to the target page. Among them, each node in the DOM tree structure corresponds to each DOM element in the target page, and the attributes of each node include the element style and element path of each DOM element in the target page.
[0043] Among them, the DOM tree structure reflects the hierarchical relationship of all DOM elements included in the target page. The acquisition method of the DOM tree structure can be implemented by existing technologies and will not be elaborated here. Among them, each node in the DOM tree structure corresponds to each DOM element in the target page, and the attributes of each node include the element style and element path of each DOM element in the target page. In practical applications, the attributes of the nodes may also include other information. For example, they may also include the text information of each DOM element, the element type (such as whether it is a node element), etc., which will not be listed one by one here.
[0044] Step 1042: Serialize the DOM tree structure to obtain a structured data form, where the structured data form contains multiple key - value pairs. The keyword of each key - value pair corresponds to each DOM element in the DOM tree structure, and the value of each key - value pair includes the element style and element path of each DOM element in the DOM tree structure.
[0045] After obtaining the DOM tree structure, serialize the DOM tree structure to obtain a structured data form. The structured data form contains multiple key-value pairs. The keyword of each key-value pair corresponds to each DOM element in the DOM tree structure. The value of each key-value pair includes the element style and element path of each DOM element in the DOM tree structure. The structured data form can be in the JSON data format, etc.
[0046] Step 1043: Obtain the page size information of the target page and determine the click position corresponding to the click event of the first DOM element.
[0047] Among them, the page size information reflects the size of the target page displayed on the client. In this embodiment, in order to restore the click scenario, obtain the page size information of the target page and determine the click position corresponding to the click event of the first DOM element. The click position can be understood as the center point position where the first DOM element is located, or the actual click position of the user on the client.
[0048] Step 1044: Generate an initial page image of the target page according to the page size information and the structured data form, and set click annotation information according to the click position in the initial page image to obtain the first element image association information.
[0049] In this embodiment, generate an initial page image of the target page according to the page size information and the structured data form, and set click annotation information according to the click position in the initial page image to obtain the first element image association information. The style of the click annotation information can be set according to the scenario requirements. For example, Figure 2 As shown, in some possible embodiments, the "dot" style can be used as the click annotation information to mark the click position. Thus, the obtained first element image association information restores the click scenario of the first DOM element in the visual dimension. And the acquisition method of the first element image association information is obtained by processing the DOM tree structure corresponding to the target page, etc., rather than directly taking screenshots on the client, which reduces the performance consumption of taking screenshots and the data transmission volume of the client.
[0050] In this embodiment, when generating the initial page image of the target page according to the page size information and the structured data form, an initial page architecture can be generated first according to the page size information. Then, according to the element path of each DOM element in the structured data form, determine the element position of each DOM element in the initial page architecture. According to the element style of each DOM element in the structured data form, render each DOM element at the corresponding element position in the initial page architecture to generate the initial page image of the target page. Of course, in other possible ways, the initial page image of the target page can also be generated in other ways.
[0051] Of course, in some possible embodiments, a screenshot instruction may also be directly sent to the client, and the screenshot containing the relevant click annotation information of the click event of the first DOM element sent by the client is used as the first element image association information. Here, the style of the relevant click annotation information can also be set according to the scenario requirements.
[0052] In some possible examples, when the second element image association information includes element styles, obtaining the first element image association information of the first DOM element may include: extracting the element style attributes of the first DOM element from the page code of the target page. The element style attributes include the shape, color, transparency, etc. of the first DOM element, and the element style can be determined based on the element style attributes.
[0053] Step 105, determine the element similarity value between the first DOM element and each second DOM element according to the first element path, the first element image association information, the second element path, and the second element image association information.
[0054] In this embodiment, determining the element similarity value between the first DOM element and each second DOM element according to the first element path, the first element image association information, the second element path, and the second element image association information means that in addition to combining the element paths, relevant information in the image dimension is also combined to determine the element similarity value between the first DOM element and each second DOM element.
[0055] It should be emphasized that this calculation method of the element similarity value can not only determine the second DOM element that is the same element as the first DOM element, but also determine the second DOM element that belongs to the same list as the first DOM element (this second DOM element is also considered to be the same element as the first DOM). This second DOM element can be regarded as a sibling element of the first DOM element, and the click volumes of the two are integrated for calculation. For example, Figure 3 As shown, if the first DOM element A and the second DOM elements B, C, D, E, F all belong to the same list, and A, B, C, D, E, F are sibling elements and are basically the same visually. Therefore, based on the calculation method of the element similarity value in this embodiment, it can be considered that A, B, C, D, E, F are the same element, and the corresponding click volumes are integrated for calculation. The sum of the click volumes of A, B, C, D, E, F is used as the click volume of any one of A, B, C, D, E, F.
[0056] It should be noted that in different application scenarios, the method for determining the element similarity value between the first DOM element and each second DOM element according to the first element path, the first element image association information, the second element path, and the second element image association information is different. Examples are as follows:
[0057] In some possible embodiments, calculate the element path similarity between the first element path and the second element paths of each second DOM element, and calculate the image information similarity between the first element image association information and the second element image association information of each second DOM element. Wherein, if there are multiple pieces of second element image association information, the image information similarity between the first element image association information and each piece of second element image association information of each second DOM element can be calculated one by one to obtain multiple image information similarities corresponding to the multiple pieces of second element image association information.
[0058] Calculate the first product value of the element path similarity and the first preset weight, and calculate the second product value of the image information similarity and the second preset weight. Wherein, both the first preset weight and the second preset weight can be defined according to the scenario requirements. If there are multiple image information similarities, the second preset weight corresponds one by one to the multiple image information similarities, and calculate the second product value of each image information similarity and the corresponding image information similarity.
[0059] Further, sum the first product value and the second product value to obtain the element similarity value between the first DOM element and each second DOM element.
[0060] For example, referring to Figure 4 , in this embodiment, taking the first DOM element as element 1 and the second DOM element as element 2 as an example, the second element image association information includes element styles and second page image information. First, determine whether the first element path of element 1 is the same as the second element path of element 2. If they are the same, it is determined that element 1 and element 2 belong to the same element. If they are not the same, calculate the element path similarity between the first element path of element 1 and the second element path of element 2, calculate the image information similarity 1 between the element styles of element 1 and element 2, calculate the image information similarity 2 between the first page image information of element 1 and the second page image information of element 2, and calculate the element similarity value between element 1 and element 2 based on the element path similarity, image information similarity 1, and image information similarity 2.
[0061] In some possible embodiments, the element path similarity of the element paths of the first element path and the second element path can be calculated, the image information similarity between the first element image association information and the second element image association information of each second DOM element can be calculated, and the average value of the element path similarity and the image information similarity is used as the element similarity value.
[0062] In some possible embodiments, an element similarity value calculation model may also be pre-trained. The first element path, the first element image association information, the second element path, and the second element image association information are input into the element similarity value calculation model to obtain the element similarity value output by the element similarity value calculation model.
[0063] Of course, in other possible embodiments, other methods may also be used to calculate the element similarity value, which will not be enumerated one by one here.
[0064] Step 106: In response to the existence of a second DOM element whose element similarity value is greater than a preset similarity threshold, perform an accumulation process on the historical click volume of the second DOM element greater than the preset similarity threshold.
[0065] In this embodiment, in response to the existence of a second DOM element whose element similarity value is greater than a preset similarity threshold, it is considered that the second DOM element and the first DOM element are the same element. Therefore, an accumulation process is performed on the historical click volume of the second DOM element greater than the preset similarity threshold, where the click volume after the accumulation process is the current click volume of the second DOM element (the first DOM element).
[0066] In some possible embodiments, performing an accumulation process on the historical click volume of the second DOM element greater than the preset similarity threshold may include: obtaining a preset unit click volume increment value, calculating the sum of the historical click volume of the second DOM element greater than the preset similarity threshold and the preset unit click volume increment value, and performing an accumulation process on the historical click volume of the second DOM element greater than the preset similarity threshold according to the sum value. The click volume after the accumulation process is the sum value. Among them, the preset unit click volume increment value may be 1, etc., and the specific preset unit click volume increment value can be set according to the scene requirements.
[0067] In the actual execution process, considering that there are a large number of reported pages and a large number of DOM elements reported on each page, a data visualization query interface is also provided. The data visualization query interface can display an input area for the DOM elements to be queried on the query page. In this input area, a page screenshot marking the location of the DOM elements to be queried can be input. Based on the page screenshot, the URL of the page where the DOM elements to be queried are located is identified. Based on this URL, the preset database is queried to obtain the reported data set corresponding to this page. The element path and element image association information of the DOM elements to be queried can be obtained based on this page screenshot (it can also be obtained in the serialized manner in the above embodiments). The reported data set is queried based on the element path and element image association information of the DOM elements to be queried. Based on the above embodiments, the corresponding element similarity value can be obtained, so as to determine whether there are DOM elements identical to the DOM elements to be queried in the reported data set based on the element similarity value. If there are identical DOM elements, the click volume of the corresponding DOM elements is visually displayed on the query page, etc.
[0068] In summary, for the method for processing the click volume of DOM elements in the embodiments of the present disclosure, in response to obtaining a click event reporting message of a first DOM element in a target page, the first element path of the first DOM element in the target page is obtained, and the reported data set corresponding to the target page is obtained. Among them, the reported data set includes the element identification information packets and historical click volumes of at least one reported second DOM element. The element identification information packet includes the second element path and the second element image association information of the second DOM element. The first element path is matched with the second element paths of each second DOM element in the reported data set. Furthermore, in response to the non-existence of a second element path that matches the first element path, the first element image association information of the first DOM element is obtained. According to the first element path, the first element image association information, the second element path, and the second element image association information, the element similarity values between the first DOM element and each second DOM element are determined. In response to the existence of a second DOM element whose element similarity value is greater than a preset similarity threshold, the historical click volumes of the second DOM elements greater than the preset similarity threshold are cumulatively processed. In this technical solution, it is avoided that after the DOM element path changes, the click events of the DOM elements cannot be accurately counted, and the statistical accuracy of the click volume of the DOM elements is improved.
[0069] To implement the above embodiments, the present disclosure also proposes a device for processing the click volume of DOM elements.
[0070] Figure 5 FIG. [X] is a schematic structural diagram of a device for processing the click volume of DOM elements provided by an embodiment of the present disclosure. This device can be implemented by software and / or hardware and is generally integrated in an electronic device. As Figure 5 shown, this device includes:
[0071] The first acquisition module 510 is configured to report a message in response to obtaining a click event of a first DOM element in a target page, and acquire a first element path of the first DOM element in the target page;
[0072] The second acquisition module 520 is configured to acquire a set of reported data corresponding to the target page, where the set of reported data includes element identification information packets and historical click volumes of at least one reported second DOM element, and the element identification information packet includes a second element path and second element image association information of the second DOM element;
[0073] The matching module 530 is configured to match the first element path with the second element paths of each second DOM element in the set of reported data;
[0074] The third acquisition module 540 is configured to acquire first element image association information of the first DOM element in response to the non-existence of a second element path that matches the first element path;
[0075] The determination module 550 is configured to determine an element similarity value between the first DOM element and each second DOM element according to the first element path, the first element image association information, the second element path, and the second element image association information;
[0076] The click volume processing module 560 is configured to, in response to the existence of a second DOM element whose element similarity value is greater than a preset similarity threshold, perform an accumulation process on the historical click volumes of the second DOM elements whose element similarity values are greater than the preset similarity threshold.
[0077] In an embodiment of the present disclosure, the second acquisition module is specifically configured to:
[0078] Acquire a uniform resource locator of the target page;
[0079] Query, in a preset database, element identification information packets and historical click volumes of all DOM elements that match the uniform resource locator to obtain the set of reported data.
[0080] In an embodiment of the present disclosure, when the second element image association information includes second page image information, the third acquisition module is specifically configured to:
[0081] Acquire a DOM tree structure corresponding to the target page, where each node in the DOM tree structure corresponds to each DOM element in the target page, and the attributes of each node include the element style and element path of each DOM element in the target page;
[0082] Serialize the DOM tree structure to obtain a structured data form, where the structured data form contains multiple key-value pairs. The keyword of each key-value pair corresponds to each DOM element in the DOM tree structure, and the value of each key-value pair includes the element style and element path of each DOM element in the DOM tree structure;
[0083] Obtain the page size information of the target page and determine the click position corresponding to the click event of the first DOM element;
[0084] Generate an initial page image of the target page according to the page size information and the structured data form, and set click annotation information according to the click position in the initial page image to obtain the first element image association information.
[0085] In an embodiment of the present disclosure, the third acquisition module is specifically used for:
[0086] Generate an initial page architecture according to the page size information;
[0087] Determine the element position of each DOM element in the initial page architecture according to the element path of each DOM element in the structured data form;
[0088] Render each DOM element at the corresponding element position in the initial page architecture according to the element style of each DOM element in the structured data form to generate an initial page image of the target page.
[0089] In an embodiment of the present disclosure, it further includes: an element reporting determination module, which is used for:
[0090] Before obtaining the first element path of the first DOM element in the target page, determine that the first DOM element meets the preset reporting condition.
[0091] In an embodiment of the present disclosure, the click volume processing module is used for:
[0092] Calculate the element path similarity between the first element path and the second element paths of each second DOM element;
[0093] Calculate the image information similarity between the first element image association information and the second element image association information of each second DOM element;
[0094] Calculate the first product value of the element path similarity and the first preset weight, and calculate the second product value of the image information similarity and the second preset weight;
[0095] Sum the first product value and the second product value to obtain the element similarity value between the first DOM element and each second DOM element.
[0096] The click volume processing device for DOM elements provided by the embodiments of the present disclosure can execute the click volume processing method for DOM elements provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects for executing the method.
[0097] To implement the above embodiments, the present disclosure also proposes a computer program product, including a computer program, which when executed by a processor, implements the click volume processing method for DOM elements in the above embodiments. The embodiments of the present disclosure provide an electronic device, which includes: a memory, on which a computer program is stored; a processor, configured to execute the computer program in the memory to implement the steps of any method in the present disclosure.
[0098] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
[0099] Specifically refer to Figure 6 , which shows a schematic structural diagram of an electronic device 600 suitable for implementing the embodiments of the present disclosure. The electronic device 600 in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), PMPs (Portable Multimedia Players), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example, and should not impose any limitations on the functions and usage scopes of the embodiments of the present disclosure.
[0100] As Figure 6 shown, the electronic device 600 may include a processor (such as a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the memory 608 into the random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.
[0101] Generally, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a memory 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 6An electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices may be implemented or had.
[0102] In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program carried on a non-transitory computer-readable medium, the computer program including program code for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a memory 608, or installed from a ROM 602. When the computer program is executed by a processor 601, the above functions defined in the click volume processing method of the DOM elements of the embodiments of the present disclosure are performed.
[0103] In addition to the above methods and devices, an embodiment of the present disclosure can also be a computer program product, which includes computer program instructions that cause a processor to execute the methods provided by the embodiments of the present disclosure when the processor runs. The computer program product can be written in any combination of one or more programming languages for the program code to perform the operations of the embodiments of the present disclosure. The programming languages include object-oriented programming languages such as Java, C++, etc., and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on a user computing device, partially on a user device, executed as an independent software package, partially on a user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0104] Furthermore, an embodiment of the present disclosure can also be a computer-readable storage medium, on which computer program instructions are stored, and the computer program instructions cause a processor to execute the methods provided by the embodiments of the present disclosure when the processor runs. The computer-readable storage medium can adopt any combination of one or more readable media. The readable media can be a readable signal medium or a readable storage medium. The readable storage medium can, for example, include but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0105] The above computer-readable medium may be included in the above electronic device; or it may exist separately and not be assembled into the electronic device.
[0106] The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the electronic device, the electronic device is caused to:
[0107] In response to obtaining a click event of the first DOM element in the target page, report a message, obtain the first element path of the first DOM element in the target page, and obtain the reporting data set corresponding to the target page. Among them, the reporting data set includes the element identification information packet and historical click volume of at least one second DOM element that has been reported. The element identification information packet includes the second element path and the second element image association information of the second DOM element. Match the first element path with the second element paths of each second DOM element in the reporting data set. Furthermore, in response to the non-existence of a second element path that matches the first element path, obtain the first element image association information of the first DOM element. According to the first element path, the first element image association information, the second element path, and the second element image association information, determine the element similarity value between the first DOM element and each second DOM element. In response to the existence of a second DOM element whose element similarity value is greater than the preset similarity threshold, perform an accumulation process on the historical click volume of the second DOM element whose element similarity value is greater than the preset similarity threshold. In this technical solution, it is avoided that after the DOM element path changes, the click event of the DOM element cannot be accurately counted, and the statistical accuracy of the click volume of the DOM element is improved.
[0108] It can be understood that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, usage scopes, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0109] For example, when a user's active request is received, a prompt message is sent to the user to clearly prompt the user that the operation requested by the user will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, an application program, a server, or a storage medium that performs the operations of the technical solutions of the present disclosure according to the prompt message.
[0110] As an optional but non-limiting implementation manner, the manner of sending a prompt message to the user in response to receiving a user's active request may be, for example, in the form of a pop-up window, and the prompt message may be presented in text in the pop-up window. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0111] It should be understood that the above notification and the process of obtaining user authorization are only illustrative and do not limit the implementation manner of the present disclosure. Other manners that comply with relevant laws and regulations can also be applied to the implementation manner of the present disclosure.
[0112] It should be noted that in this text, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.
[0113] The above are only specific implementation manners of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to these embodiments herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing click volume of a DOM element, characterized in that: The following steps are involved: In response to obtaining a click event report message of a first DOM element in a target page, obtaining a first element path of the first DOM element in the target page; Acquire a reported data set corresponding to the target page, wherein the reported data set includes an element identification information package and a historical click volume of at least one second DOM element that has been reported, and the element identification information package includes a second element path and second element image association information of the second DOM element; Matching the first element path with the second element path of each second DOM element in the reported data set; In response to the absence of a second element path that matches the first element path, obtaining first element image association information of the first DOM element; determining an element similarity value between the first DOM element and each of the second DOM elements according to the first element path, the first element image association information, the second element path, and the second element image association information; In response to the existence of a second DOM element whose element similarity value is greater than a preset similarity threshold, the historical click volume of the second DOM element whose similarity value is greater than the preset similarity threshold is accumulated.
2. The method according to claim 1, characterized in that The second element image association information includes: the element style of each second DOM element; and / or, The second page image information where each second DOM element is located, wherein the second page image information includes click annotation information of each second DOM element.
3. The method according to claim 1, characterized in that When the second element image association information includes the second page image information, the acquiring the first element image association information of the first DOM element includes: Acquire a DOM tree structure corresponding to the target page, wherein each node in the DOM tree structure corresponds to each DOM element in the target page, and the attributes of each node include an element style and an element path of each DOM element in the target page; Serializing the DOM tree structure to obtain a structured data form, wherein the structured data form includes a plurality of key-value pairs, a keyword of each key-value pair corresponds to each DOM element in the DOM tree structure, and a value of each key-value pair includes an element style and an element path of each DOM element in the DOM tree structure; Obtaining page size information of the target page, and determining a click position corresponding to a click event of the first DOM element; An initial page image of the target page is generated according to the page size information and the structured data form, and click annotation information is set in the initial page image according to the click position to obtain the first element image association information.
4. The method according to claim 3, characterized in that The generating the initial page image of the target page according to the page size information and the structured data form includes: generating an initial page structure according to the page size information; Determine, according to the element path of each DOM element in the structured data form, the element position of each DOM element in the initial page architecture; According to the element style of each DOM element in the structured data form, each DOM element is rendered at a corresponding element position in the initial page architecture to generate an initial page image of the target page.
5. The method according to claim 1, characterized in that Before obtaining the first element path of the first DOM element in the target page, the method further includes: Determine whether the first DOM element meets a preset reporting condition, wherein the preset reporting condition includes: The first DOM element is pre-bound with a reporting event; and / or, The tag type of the first DOM element is a hyperlink tag.
6. The method according to any one of claims 1 to 5, characterized in that: The determining, according to the first element path, the first element image association information, the second element path, and the second element image association information, an element similarity value between the first DOM element and each of the second DOM elements includes: Calculating an element path similarity between the first element path and the second element path of each of the second DOM elements; Calculating the image information similarity between the first element image association information and the second element image association information of each of the second DOM elements; Calculating a first product value of the element path similarity and a first preset weight, and calculating a second product value of the image information similarity and a second preset weight; The first product value and the second product value are summed to obtain an element similarity value between the first DOM element and each of the second DOM elements.
7. The method according to any one of claims 1 to 5, characterized in that: The accumulating the historical clicks of the second DOM element greater than the preset similarity threshold comprises: Get the preset unit click volume increase value; The historical click volume of the second DOM element greater than the preset similarity threshold and the preset unit click volume increase value are summed and calculated, and the historical click volume of the second DOM element greater than the preset similarity threshold is accumulated according to the sum value.
8. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the method for processing the click volume of the DOM element described in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to execute the method for processing the click volume of a DOM element as described in any one of claims 1 to 7.
10. A computer program product, characterized in that It includes a computer program, which, when executed by a processor, implements the method for processing the click volume of a DOM element as described in any one of claims 1 to 7.