Data reporting methods, devices, electronic equipment and computer-readable storage media
By scanning the view tree of the target application, obtaining and comparing the set of visible elements, and determining the target set of elements, the problem of inaccurate timing of exposure data reporting is solved, and the accuracy and consistency of data reporting are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-31
- Publication Date
- 2026-03-10
AI Technical Summary
In existing technologies, the timing of exposure data reporting is inaccurate and difficult to standardize, resulting in low accuracy of data reporting. This is especially true in custom user interface frameworks and special business scenarios, where it is impossible to ensure accurate data collection and reporting.
By scanning the view tree of the target application, the set of visible elements is obtained and compared with the historical set of visible elements to determine the target set of elements. Based on this set, exposure data is obtained and reported, and an exposure data reporting scheme based on the difference between two adjacent scan results is formulated.
It improved the accuracy of exposure data reporting, solved the problem of inaccurate timing of exposure data reporting, and ensured the consistency and accuracy of data reporting under different business and interface frameworks.
Smart Images

Figure CN115480851B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a data reporting method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] When reporting data to an application, the data to be reported can be divided into several categories such as visits, clicks, and impressions. This type of reported data can be used to comprehensively evaluate the promotion effect of various types of content and is the foundation for in-depth promotion optimization.
[0003] Data on behaviors such as visits and clicks is relatively easy to collect and report. However, for exposure data, there are currently no clear standards for reporting timing. Generally, exposure reporting is done directly using the callback interface provided by the system. This reporting method makes it difficult to ensure the accuracy of the data reporting timing. Summary of the Invention
[0004] The purpose of this application is to at least address the aforementioned technical deficiencies, particularly the technical deficiency of low accuracy in data reporting.
[0005] Firstly, a data reporting method is provided, which includes:
[0006] Scan at least one view of the target application and obtain the scan results, which include the set of visible elements obtained in this scan.
[0007] Retrieve the set of historically visible elements, which is based on the previous scan results of the target application;
[0008] Compare the set of visible elements with the set of historically visible elements, and determine the target set of elements from the set of visible elements;
[0009] Exposure data of the target application is obtained based on the target element set, and the exposure data is reported.
[0010] In an optional embodiment of the first aspect, at least one view of the target application is scanned to obtain a scan result. The scan result includes a set of visible elements obtained in this scan, including: when a change is detected in the view tree of the target application, the view tree is scanned to determine the current page and at least one element to be detected; based on the current page, each element in the view tree is detected to determine whether the element in the view tree meets a preset visibility condition; at least one element that meets the visibility condition is taken as a visible element to obtain a set of visible elements.
[0011] In an optional embodiment of the first aspect, determining the target element set by comparing the set of visible elements with the set of historically visible elements includes:
[0012] If any element in the set of visible elements is not in the set of historical visible elements, then that element is determined as the target element;
[0013] A set of target elements is constructed based on the determined target elements.
[0014] In an optional embodiment of the first aspect, obtaining exposure data of the target application based on the target element set and reporting the exposure data includes: determining a real-time reporting element set and a delayed reporting element set based on the type of each target element in the target element set;
[0015] Obtain the first exposure data corresponding to the set of real-time reporting elements, and report the first exposure data; the first exposure data includes the exposure data corresponding to each real-time reporting element in the set of real-time reporting elements;
[0016] For each delayed reporting element in the delayed reporting element set, if the delayed reporting element meets the preset delayed reporting conditions, the second exposure data corresponding to the delayed reporting element is obtained and the second exposure data is reported.
[0017] In an optional embodiment of the first aspect, before the delayed reporting element meets the preset delayed reporting conditions, the method further includes: determining the minimum exposure time corresponding to each delayed reporting element based on the type of each delayed reporting element in the set of delayed reporting elements;
[0018] For each delayed element in the delayed reporting element set, after waiting for the minimum exposure time corresponding to the delayed reporting element, it is determined whether the delayed reporting element meets the delayed reporting conditions.
[0019] In an optional embodiment of the first aspect, determining whether a delayed reporting element meets the delayed reporting conditions includes:
[0020] If the delayed reporting element is not in the historical visible element set, and the delayed reporting element meets the visibility condition, then the delayed reporting element is determined to meet the delayed reporting condition.
[0021] In an alternative embodiment of the first aspect, it further includes:
[0022] Secondly, a data reporting device is provided, the device comprising:
[0023] The scanning module is used to scan at least one view of the target application and obtain the scan results, which include the set of visible elements obtained in this scan.
[0024] The acquisition module is used to obtain the set of historically visible elements, which is obtained based on the results of the previous scan.
[0025] The comparison module is used to compare the set of visible elements with the set of historically visible elements to determine the set of target elements;
[0026] The reporting module is used to obtain the exposure data of the target application based on the target element set and report the exposure data.
[0027] In an optional embodiment of the second aspect, when the scanning module scans at least one view of the target application and obtains the scan results, it is specifically used for:
[0028] When a change is detected in the view tree of the target application, the view tree is scanned to determine the current page and at least one element to be detected. Based on the current page, each element in the view tree is detected to determine whether the elements in the view tree meet the preset visibility conditions. At least one element that meets the visibility conditions is taken as a visible element to obtain a set of visible elements.
[0029] In an optional embodiment of the second aspect, when the comparison module determines the target element set by comparing the set of visible elements and the set of historically visible elements, it is specifically used for:
[0030] If any element in the set of visible elements is not in the set of historical visible elements, then that element is determined as the target element;
[0031] A set of target elements is constructed based on the determined target elements.
[0032] In an optional embodiment of the second aspect, when the reporting module obtains the exposure data of the target application based on the target element set and reports the exposure data, it is specifically used for:
[0033] Based on the type of each target element in the target element set, determine the real-time reporting element set and the delayed reporting element set;
[0034] Obtain the first exposure data corresponding to the set of real-time reporting elements, and report the first exposure data; the first exposure data includes the exposure data corresponding to each real-time reporting element in the set of real-time reporting elements;
[0035] For each delayed reporting element in the delayed reporting element set, if the delayed reporting element meets the preset delayed reporting conditions, the second exposure data corresponding to the delayed reporting element is obtained and the second exposure data is reported.
[0036] In an optional embodiment of the second aspect, a delay module is further included, specifically for:
[0037] Based on the type of each delayed reporting element in the delayed reporting element set, determine the minimum exposure time corresponding to each delayed reporting element;
[0038] For each delayed element in the delayed reporting element set, after waiting for the minimum exposure time corresponding to the delayed reporting element, it is determined whether the delayed reporting element meets the delayed reporting conditions.
[0039] In an optional embodiment of the second aspect, when determining whether a delay reporting element meets the delay reporting conditions, the delay module is specifically used for:
[0040] If the delayed reporting element is not in the historical visible element set, and the delayed reporting element meets the visibility condition, then the delayed reporting element is determined to meet the delayed reporting condition.
[0041] In an optional embodiment of the second aspect, a mandatory reporting module is further included, specifically for:
[0042] Based on the received exposure request for at least one target view, the target view is set to a visible state; when the target view is visible, the visibility condition is met.
[0043] Retrieve at least one target reporting element from the target view that is in a visible state;
[0044] Obtain third exposure data based on the target reporting elements, and report the third exposure data.
[0045] Thirdly, an electronic device is provided, the electronic device comprising:
[0046] A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data reporting method of any of the above embodiments.
[0047] Fourthly, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the data reporting method of any of the above embodiments.
[0048] Fifthly, embodiments of this application provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to implement the methods provided in the first or second aspect embodiments.
[0049] The aforementioned data reporting method scans the target application's view tree to obtain scan results, including the set of visible elements acquired in the current scan. It then compares this set of visible elements with the historical set of visible elements from the previous scan to determine the target set of elements. Based on this target set, the corresponding exposure data is reported. By establishing a set of exposure data reporting schemes based on the differences between two adjacent scans, different businesses, platforms, and interface frameworks can use the same set of data reporting rules. This solves the problems of inaccurate and inconsistent timing of exposure data reporting, thus improving the accuracy of data reporting. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.
[0051] Figure 1 A flowchart illustrating a data reporting method provided in an embodiment of this application;
[0052] Figure 2 A schematic diagram of a page view in a data reporting method provided in an embodiment of this application;
[0053] Figure 3 A schematic diagram of a view tree in a data reporting method provided in an embodiment of this application;
[0054] Figure 4 A schematic diagram of a page view in a data reporting method provided in an embodiment of this application;
[0055] Figure 5 This is a schematic diagram illustrating the determination of the current page in a data reporting method provided in an embodiment of this application.
[0056] Figure 6 A schematic diagram illustrating the determination of a target element set in a data reporting method provided in an embodiment of this application;
[0057] Figure 7 This is a schematic diagram illustrating the determination of the minimum exposure time corresponding to a delayed reporting element in a data reporting method provided in an embodiment of this application.
[0058] Figure 8 A flowchart illustrating a data reporting method provided in an embodiment of this application;
[0059] Figure 9 A flowchart illustrating a data reporting method provided in an embodiment of this application;
[0060] Figure 10 This is a schematic diagram of the structure of a data reporting device provided in an embodiment of this application;
[0061] Figure 11 This is a schematic diagram of the structure of an electronic device for data reporting provided in an embodiment of this application. Detailed Implementation
[0062] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0063] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0064] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0065] Currently, obtaining information through various applications on mobile devices has become an important way for people to understand the world. Promoting different sections and services within these applications has also become a new marketing strategy. Collecting and reporting data such as visits, clicks, and exposures within these applications can effectively measure the effectiveness of business promotion and facilitate further optimization of marketing strategies.
[0066] Exposure data can reveal patterns in user attention spans, making it easier to adjust promotional content in a more targeted manner.
[0067] For exposure data, existing reporting solutions generally use system-provided callback interfaces for exposure reporting. However, callbacks are a two-way calling pattern, which may lead to duplicate reporting due to the inability to distinguish between system callbacks and manually triggered calls, or false reporting due to system calls being triggered when the view is no longer visible. Furthermore, in some special business scenarios, when developers customize the user interface (UI) framework without a clear exposure timing, it may be difficult to receive system callback information, making data reporting impossible.
[0068] The data reporting method, apparatus, electronic device, and computer-readable storage medium provided in this application are intended to solve the above-mentioned technical problems of the prior art.
[0069] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0070] The data reporting method provided in this application embodiment can be applied to a server or a terminal.
[0071] Those skilled in the art will understand that the “terminal” used herein can be a mobile phone, tablet computer, PDA (Personal Digital Assistant), MID (Mobile Internet Device), etc.; and the “server” can be implemented using a standalone server or a server cluster composed of multiple servers.
[0072] This application provides a data reporting method, such as... Figure 1 As shown, the method includes:
[0073] Step S101: Scan at least one view of the target application and obtain the scan results, which include the set of visible elements obtained in this scan.
[0074] In the embodiments of this application, the target application can refer to an application (app) in a mobile terminal, while the view can refer to a visual interface element, which is generally a rectangular area. All screen displays in this area can be managed through the view. The view object can be composed of a single component or a combination of multiple components.
[0075] When scanning a target application, all views of the application can be scanned, and views that are visible are considered visible elements. A set of visible elements corresponding to this scan consists of at least one visible element. A unified rule can be set to determine whether a view is visible, facilitating the accurate acquisition of visible element combinations.
[0076] Step S102: Obtain the set of historically visible elements. The set of historically visible elements is obtained based on the previous scan result of the target application.
[0077] In this embodiment of the application, the historical visible element set can be obtained from the last scan of the target application. That is, it can be composed of the views that were visible when the target application was last scanned. In the subsequent data reporting process, the historical visible element set can be continuously updated according to the processing method of visible elements corresponding to different services, so as to facilitate more accurate data reporting. For example, when certain special services force the exposure of a specified view, that is, the target view is changed from an invisible state to a visible state.
[0078] Step S103: Compare the set of visible elements with the set of historical visible elements, and determine the set of target elements from the set of visible elements.
[0079] In this embodiment of the application, the target element set can be determined from the visible element set by comparing the visible element set and the historical visible element set. The visible element set and the historical visible element set can be compared using different comparison schemes based on different business requirements.
[0080] For example, we can compare the element categories contained in the visible element set and the historical visible element set. Element categories can be determined based on the content displayed by each element, such as commercial promotion or popular science literature. Element categories can also be determined based on the way the content is displayed, such as text content display, video content display, image content display, and hybrid content display. Compared to the historical visible element set, we can use new element categories appearing in the visible element set as target categories, and the elements corresponding to the target categories in the visible element set can be used as target elements, forming a target element set. By identifying new element categories (target categories) appearing in the visible element set and the target elements corresponding to these new element categories, we can evaluate the effectiveness of various promotional methods and content.
[0081] Alternatively, elements in the visible element set can be compared with elements in the historical visible element set to determine which elements have been added or removed from the visible element set compared to the historical visible element set. Specifically, the historical visible element set can be obtained from the previous scan of all views of the target application, while the visible element set is obtained from the current scan of all views of the target application. By comparing the scan results of the two scans, views that changed from an invisible state to a visible state in the current scan can be identified, and these views can be used as target elements to form the target element set.
[0082] Meanwhile, the set of invisible elements can be determined by comparing the set of visible elements with the set of historical visible elements. Elements that exist in the set of historical visible elements but are not in the set of visible elements are considered as invisible elements, forming the set of invisible elements. The set of historical visible elements can be updated based on the set of invisible elements, and invisible elements can be removed from the set of historical visible elements.
[0083] Step S104: Obtain the exposure data of the target application based on the target element set, and report the exposure data.
[0084] In this embodiment of the application, the exposure data may include corresponding parameters such as exposure time. When reporting exposure data, these parameter information will be collected and reported to the data backend.
[0085] Specifically, the steps for collecting parameter information corresponding to elements may include: starting from the selected current element, scanning upwards along the parent node until the page is reached, concatenating the parameter information corresponding to all elements in the scanning path, and finally concatenating the parameter information of the page as the complete reported parameters. When elements in the scanning path have the same parameter information, whether the parameter information corresponding to the child element overwrites the parameter information corresponding to the parent element, or the parameter information corresponding to the parent element overwrites the parameter information corresponding to the child element, or whether all parameter information is retained, can be determined according to the actual business needs.
[0086] In specific application projects, exposure data reporting can be achieved through exposure tracking.
[0087] In the above embodiments, the view tree of the target application is scanned to obtain scan results, which include the set of visible elements obtained in the current scan. Then, the set of visible elements obtained in the current scan is compared with the historical set of visible elements obtained in the previous scan to determine the target set of elements. Based on this target set, the corresponding exposure data is reported. By developing an exposure data reporting scheme based on the differences between two adjacent scans, the problems of inaccurate and inconsistent timing of exposure data reporting are solved, thus improving the accuracy of data reporting.
[0088] In this embodiment of the application, scanning at least one view of the target application and obtaining the scanning results, which include the set of visible elements obtained in this scan, may include the following steps:
[0089] (1) When the view tree of the target application is detected to change, the view tree is scanned to determine the current page; based on the current page, each element in the view tree is detected to determine whether the elements in the view tree meet the preset visibility conditions.
[0090] In this embodiment, views can be divided into pages and elements, logically distinguished by whether page IDs and element IDs are set. Pages and elements are functional components or controls used in mobile applications to display information, assist page layout, or guide user operations. For end users, pages and elements can be visible or invisible. Regarding the relationship between pages and elements, at the physical level, an element can be a subview of a page, and a page can be a container for many elements. Pages and elements are also independent; a view can set both page IDs and element IDs according to different business needs.
[0091] The pages and elements of a target application in a mobile terminal can be summarized into a tree structure called a view tree. The view tree can reflect the page layout and view information of the target application, including the hierarchical relationship between various pages and elements. Specifically, each page can have only one parent element and one or more child elements. The view tree can have an abstract root node. The direct child elements of the root node can be the various windows of the target application in the mobile terminal. The child elements of each window can be views, lists, etc., and the child elements of the list are various lists.
[0092] In one example, such as Figure 2 As shown, in a page displayed to users, there is a video display area A, square promotion areas B and C, and bar promotion areas D and E, which correspond to elements 1, 2, 3, 4, and 5 respectively. Among them, elements 1, 2, 3, 4, and 5 are subviews of page 1.
[0093] When setting how to trigger a scan, you can set a fixed scan interval. That is, at fixed scan intervals, the view tree of the target application will be automatically scanned to obtain the set of visible elements in the scan results of this scan, and the set of visible elements in the scan results of the previous scan will be combined as historical visible elements.
[0094] When setting how to trigger a scan, you can also preset relevant trigger conditions based on business needs. When the preset trigger conditions are met, the view tree of the target application will be scanned to obtain the scan results.
[0095] In some embodiments, a scan can be automatically triggered when a change in the view tree is detected. Specifically, a change in the view tree is indicated when any view is removed from its parent view, when a view switches between a hidden and open state, when the view's opacity changes, when a dynamic component changes, when the target application switches between foreground and background states, and when the view displayed on the screen changes as the page is scrolled. Interfaces that detect changes in the view tree can be accessed using hook technology. When a change in the view tree is detected, a scan is marked as necessary, and the scan is triggered when the main thread is idle. This ensures a smooth user experience for the target application while significantly reducing the performance overhead of scanning the view tree.
[0096] In this embodiment of the application, when scanning the view tree, it can start from the root view at the top level of the target application and scan in a preorder traversal manner. Preorder traversal means passing through all nodes on the path in the order of root left and right. For example, first visit the root view, then traverse the left subview, and finally traverse the right subview.
[0097] Pages and elements in the view tree can be scanned separately. Specifically, scanning a page will find the current page, which can be the page with the highest view hierarchy and is visible. Scanning all elements will retrieve all views with element IDs, i.e., the elements to be detected. Then, each element to be detected can be detected to determine whether it meets the visibility condition.
[0098] Pages and elements in the view tree can also be scanned sequentially. In this case, a complete view tree scan process can include two steps: First, a scan is performed to identify the highest-level and visible page in the view tree as the current page; then, a second scan is performed to obtain all elements to be detected. Data from the first scan is cached to speed up the second scan and reduce performance overhead. Similarly, after identifying the elements to be detected, each element can be evaluated to determine whether it meets the visibility criteria.
[0099] In this embodiment, while scanning pages and elements in the view tree, each scanned element can be detected simultaneously. For example, starting from the root view at the top level of the target application and scanning using a pre-order traversal, each element in the view tree is immediately detected to determine whether it meets the visibility condition. This eliminates the need to identify the element to be detected first and then detect each element individually. Based on the ability to scan and detect elements in the view tree simultaneously, the scanning scheme can be further optimized by adopting a pruning strategy. If scanning starts from the root view and reaches an element (view) of a certain view node, it is determined whether the element meets the visibility condition. If not, the element is invisible, and all other elements (subviews) under that element are also determined to be invisible. Scanning all other elements (subviews) under that element can be abandoned, reducing performance loss caused by invalid scanning and improving scanning efficiency.
[0100] In one example, such as Figure 3 As shown, there are pages 0, 1, and 2, where page 2 is the current page. Page 2 contains elements 20, 21, 22, 23, 24, and 25. The blank box represents a normal view, which is neither a page nor an element. When scanning this view tree, page 2 is identified as the current page. Pages 0 and 1 are obscured by the current page and do not meet the basic visibility conditions, so they are invisible. According to the pruning principle, scanning the elements under pages 0 and 1 can be abandoned to minimize system performance loss and reduce the impact on the smoothness of the interface interaction.
[0101] Data in the form of "KXXX:VXXX" next to pages and elements represents parameter information, which is stored as key-value pairs. This parameter information is collected and reported to the data backend when exposure data is reported. Specifically, the steps for collecting parameter information corresponding to elements may include: starting from the selected current element, scanning upwards along the parent node until the page is reached; concatenating the parameter information corresponding to all elements in the scan path; and finally concatenating the page's parameter information as the complete reporting parameters. When elements in the scan path have the same parameter information, whether the parameter information of the child element overwrites the parameter information of the parent element, or vice versa, or whether all parameter information is retained, can be determined based on actual business needs.
[0102] (3) Take at least one element that satisfies the visibility condition as a visible element to obtain a set of visible elements.
[0103] In the embodiments of this application, visibility conditions may include basic visibility conditions and logical visibility conditions.
[0104] The basic visibility conditions can be set based on the properties of the target application or the element itself, and can include at least one of the following:
[0105] ① The target application is active or in the foreground;
[0106] ② The element is not hidden, that is, the "hidden" option is "NO";
[0107] ③ The element's transparency is greater than the preset minimum transparency threshold visible to the human eye;
[0108] ④ The size of the element is larger than the preset minimum size threshold visible to the human eye;
[0109] ⑤ The element exists within the screen and is displayed in the parent view area.
[0110] Logical visibility conditions can be set based on business requirements or logical relationships between views, and can include at least one of the following:
[0111] ① The ratio of the visible area of an element on the screen to the invisible area of the element on the screen is greater than the specified minimum ratio.
[0112] ② The current element is not obscured by the current page.
[0113] For each element in the view tree, if the element satisfies both the basic visibility condition and the logical visibility condition mentioned above, the element can be regarded as a visible element. After traversing all elements in the view tree, all the visible elements determined constitute the set of visible elements for this scan.
[0114] In one example, such as Figure 4 As shown, page 2 is the current page. Elements 1, 2, 4, 5, 6, 7, and 8 meet the visibility condition and are visible. For element 3, which is an area that can be scrolled and rotated on the screen, it is necessary to further determine whether the ratio of the visible area to the invisible area of the element on the screen is greater than the specified minimum ratio. Only when it is greater than the minimum ratio can element 3 be considered to meet the visibility condition.
[0115] In one example, such as Figure 5 As shown, the current page is the floating layer page 2, which has the highest layer and is visible. Other pages that are obscured by the current page are determined to not meet the visibility conditions and are invisible.
[0116] In this embodiment of the application, determining the target element set by comparing the visible element set and the historical visible element set may include the following steps: if any element in the visible element set is not in the historical visible element set, then that element is determined as the target element; and the target element set is constructed based on the determined target element.
[0117] The comparison can refer to determining which elements have been added or removed from the set of visible elements compared to the historical set of visible elements, and then taking appropriate action on the added or removed elements.
[0118] If any element in the set of visible elements is not in the set of historical visible elements, it means that the element is a newly added visible element in the current scan result, and this element can be identified as the target element. After comparing the set of visible elements and the set of historical visible elements, all the identified target elements can form the target element set.
[0119] If any element in the historical set of visible elements is not in the set of visible elements, it means that the element changed from a visible state to an invisible state in the current scan result, and this element can be identified as an invisible element. After comparing the set of visible elements and the historical set of visible elements, all the identified invisible elements can form an invisible element set.
[0120] In one example, such as Figure 6 As shown in region T1, the set of historically visible elements S is determined based on the previous scan results, including elements A, B, C, D, and E; as... Figure 6 As shown in region T2, the set of visible elements G determined based on the current scan results includes elements C, D, E, F, and G. Comparing the set of visible elements with the historical set of visible elements, it can be determined that elements F and G are in the set of visible elements G but not in the historical set of visible elements S. Therefore, elements F and G can be designated as target elements, forming the target element set. Conversely, elements A and B are in the historical set of visible elements but not in the set of visible elements S. Therefore, elements A and B can be designated as invisible elements, forming the invisible element set.
[0121] In this embodiment of the application, obtaining exposure data of the target application based on the target element set and reporting the exposure data may include the following steps:
[0122] (1) Based on the type of each target element in the target element set, determine the real-time reporting element set and the delayed reporting element set.
[0123] The target element can be of either a business type or a functional type.
[0124] Business types can be included in the business information corresponding to each target element. This business information can be determined based on the business party's display requirements. When the business information indicates that a target element requires delayed reporting, the target element is assigned to the delayed reporting element set. If no delayed reporting is specified, the target element is assigned to the real-time reporting element set. For example, for some special promotional businesses, if the business party believes that displaying promotional content through a certain target element requires an exposure time of 3 seconds to meet the condition for reporting exposure data (effective exposure), then the business information corresponding to that target element can include the attribute of a minimum exposure time of 3 seconds. Furthermore, when classifying target elements, this target element can be assigned to the delayed reporting element set.
[0125] The function type of a target element can be set based on its displayed content. Specifically, target element function types can be categorized into text content display, image content display, video content display, and other content display. Image content display can be further subdivided into static image content display and dynamic image content display. For target elements of the text content display, static image content display, and other content display types, short exposure time can be considered as effective exposure, and these types of target elements are classified into the real-time reporting element set. For target elements of the dynamic image content display and video content display types, longer exposure time is considered to be effective exposure, and these types of target elements are classified into the delayed reporting element set. For target elements requiring delayed reporting, different minimum exposure times can be set based on different types. For example, the minimum exposure time to achieve effective exposure can be set to 3 seconds when the target element displays dynamic image content, and 5 seconds when the target element displays video content.
[0126] When dividing the target element set into real-time reporting elements and delayed reporting elements, both the business type and function type of the target elements can be considered simultaneously. The priority of the business type can be higher than that of the function type. When the business type of a target element does not indicate whether the target element needs delayed reporting, it is classified based on the function type of the target element. For example, if the business type of any target element indicates that the element needs delayed reporting, the function type of the element can be disregarded, and the delayed reporting process can be directly initiated. If the business type of any target element does not indicate whether the element needs delayed reporting, the corresponding function type of the element can be queried, and the element can be classified and processed accordingly.
[0127] In other embodiments, it is possible to directly determine which target elements can be directly reported and which target elements need to enter the delayed reporting process based on the type of each target element in the target element set, and to perform corresponding processing for different types of target elements.
[0128] (2) Perform different processing on the real-time reporting element set and the delayed reporting element set respectively:
[0129] ① Obtain the first exposure data corresponding to the set of real-time reporting elements, and report the first exposure data; the first exposure data includes the exposure data corresponding to each real-time reporting element in the set of real-time reporting elements.
[0130] Specifically, for each real-time reporting element, the exposure data corresponding to that element can be obtained. Although each real-time reporting element is visible during this scan, the actual exposure data between elements may differ. Therefore, for each real-time reporting element, the exposure data corresponding to each element can be obtained separately, and then packaged into the first exposure data for reporting. In some embodiments, after obtaining the exposure data corresponding to each real-time reporting element, the exposure data can be further processed and statistically analyzed before data reporting.
[0131] In addition, other interaction data, such as user click data and user access data, can be obtained at the same time as the exposure data for each real-time reporting element and reported together with the exposure data.
[0132] After determining the set of real-time reported elements, the set of historically visible elements can be updated based on the real-time reported set. This means that after the real-time reported elements complete the reporting of exposure data, they can be added to the set of historically visible elements as historically visible elements.
[0133] ② For each delayed reporting element in the delayed reporting element set, if the delayed reporting element meets the preset delayed reporting conditions, then obtain the second exposure data corresponding to the delayed reporting element and report the second exposure data.
[0134] After the delayed reporting element undergoes delayed reporting processing, it can be re-evaluated whether the delayed reporting element meets the preset delayed reporting conditions. For each delayed reporting element, if the element meets the delayed reporting conditions, it can be considered that the delayed reporting element has completed effective exposure, and the corresponding second exposure data can be obtained and reported based on the delayed reporting element; if the element does not meet the delayed reporting conditions, it can be considered that the delayed reporting element has not completed effective exposure, and no further data reporting is required.
[0135] After any delayed reporting element completes effective exposure and reports data, the set of historically visible elements and the set of delayed reporting elements can be updated. Similarly, if any delayed reporting element fails to complete effective exposure and the data reporting process is terminated, the delayed reporting element can be updated. The above method can achieve more accurate data reporting and avoid duplicate reporting.
[0136] In this embodiment of the application, before the delayed reporting element meets the preset delayed reporting conditions, the method further includes: determining the minimum exposure time corresponding to each delayed reporting element based on the type of each delayed reporting element in the delayed reporting element set; and for each delayed element in the delayed reporting element set, after waiting for the minimum exposure time corresponding to the delayed reporting element, determining whether the delayed reporting element meets the delayed reporting conditions.
[0137] The type of delayed reporting elements can be categorized based on business or function. Specifically, the type can refer to either business type or function type. The business type can be included in the business information corresponding to each target element, and this business information can be determined based on the display requirements of the business party. The function type can be set based on the display content of the target element. Delayed reporting elements can possess both of these type attributes simultaneously. The priority of the business type can be higher than that of the function type, and the following situations may occur:
[0138] ① For any delayed reporting element, if the business type corresponding to the element only marks that a delayed reporting operation is required for the element, but does not specify the minimum exposure time corresponding to the delayed reporting element, the preset default value can be used as the minimum exposure time corresponding to the element, and the function type of the delayed reporting element can be ignored.
[0139] ② For any delayed reporting element, if the business type mark corresponding to the element requires a delayed reporting operation for the element, and the business information corresponding to the element contains the minimum exposure time, then the minimum exposure time corresponding to the element can be obtained based on the business information, and the functional type of the delayed reporting element can be disregarded.
[0140] ③ For any delayed reporting element, if the business type corresponding to the element does not mark that the element needs to perform a delayed reporting operation, then the minimum exposure time corresponding to the function type is determined based on the function type of the element. For example, when the function type of the delayed reporting element is dynamic image content display, the minimum exposure time to achieve effective exposure can be set to 3 seconds, and when the function type of the delayed reporting element is video content display, the minimum exposure time to achieve effective exposure can be set to 5 seconds.
[0141] For each delayed element in the delayed reporting element set, after waiting for the minimum exposure time corresponding to the delayed reporting element, it can be re-evaluated to determine whether the delayed reporting element meets the delayed reporting conditions. These conditions can include the current state the delayed reporting element must meet, the relationship between the delayed reporting element and other sets, etc. During the minimum exposure time, the state of the delayed reporting element may change, and it may no longer meet the data reporting conditions. Re-evaluating the delayed reporting element in this case improves the accuracy of data reporting and avoids reporting exposure data that does not meet the valid exposure requirements to the server.
[0142] In one example, such as Figure 7 As shown, the set of delayed reporting elements contains delayed reporting elements E1, E2, E3, E4, E5, and E6, each with two corresponding type attributes. Elements E1, E2, and E3 correspond to business type A, elements E4 and E5 to business type B, and element E6 to business type C. Regarding function types, element E1 corresponds to function type 1, elements E2, E3, and E4 to function type 2, and elements E5 and E6 to function type 3.
[0143] It can be stipulated that the priority of business type is higher than that of function type. In this case, if business type A has a minimum exposure time of T1, the minimum exposure time for elements E1, E2, and E3 is also T1, without further consideration of the function type. If business types B and C do not have a minimum exposure time set, then the minimum exposure time for elements E4, E5, and E6 is determined according to their respective function types. As shown in the figure, element E4 corresponds to function type 2, and the minimum exposure time T2 corresponding to function type 2 is used as the minimum exposure time for element E4. Similarly, the minimum exposure time for elements E5 and E6 is the minimum exposure time T3 corresponding to function type 3.
[0144] After waiting for time T1, determine whether elements E1, E2, and E3 meet the delayed reporting conditions; after waiting for time T2, determine whether element E4 meets the delayed reporting conditions; after waiting for time T3, determine whether elements E5 and E6 meet the delayed reporting conditions.
[0145] In this embodiment of the application, determining whether a delayed reporting element meets the delayed reporting conditions may include: if the delayed reporting element is not in the historical visible element set and the delayed reporting element meets the visibility conditions, then the delayed reporting element is determined to meet the delayed reporting conditions.
[0146] If the delayed reporting element is not in the historical visible element set, it means that the delayed reporting element was not forced to report within the minimum exposure time, and the delayed reporting process can continue. If the delayed reporting element is in the historical visible element set, it means that the delayed reporting element has been exposed and the corresponding exposure data has been reported, and there is no need to report the data again.
[0147] Visibility conditions can refer to basic visibility conditions and logical visibility conditions. If a delayed reporting element meets the visibility conditions, it means that the delayed reporting element is still visible after waiting for the minimum exposure time.
[0148] When judging delayed reporting elements, the two conditions can be sequential. First, check if the delayed reporting element is in the historical visible element set. If it is, the delayed reporting process is stopped, and the delayed reporting element set can be updated without further checking the element's visibility condition, thus improving data reporting efficiency. If the delayed reporting element is not in the historical visible element set, further check if it meets the visibility condition. If the delayed reporting element meets the visibility condition, the data reporting process continues; otherwise, the data reporting process is stopped, and the delayed reporting element set is updated.
[0149] In this embodiment of the application, an interface for forcibly triggering data reporting can also be provided. Specifically, based on the received exposure request for at least one target view, the target view can be set to a visible state; when the target view is visible, the visibility condition is met; at least one target reporting element in the target view that is in a visible state is obtained; third exposure data is obtained based on the target reporting element, and the third exposure data is reported.
[0150] The target view can refer to a page or an element. When the view on the screen remains unchanged, according to the defined exposure rules, no view changes from an invisible state to a visible state, so no new view exposure is generated. However, from a product business perspective, it is necessary to collect exposure data again.
[0151] Hereinafter, the target view that needs to be re-exposed will be referred to as an element. An exposure request for at least one element will be generated and sent when either of the following two situations requires forced re-exposure:
[0152] (1) The element object is not regenerated, but the way the element is displayed changes, such as changes in color, title, style and jump information. When these factors change from the product perspective, it needs to be considered a new exposure.
[0153] (2) During the development process, when reusing elements, clicking the jump link will jump from page A to page B. An element on page A is not destroyed, but removed from page A and added back to page B. From the perspective of the view tree, after jumping from page A to page B, the element does not change from an invisible state to a visible state. However, from the product perspective, the parent view to which the element is attached has changed and needs to be recognized as a new exposure.
[0154] In this embodiment, based on receiving an exposure request for at least one target view, it is determined that the target view needs a new exposure. Then, at least one target reporting element contained in the page is obtained, and third exposure data is obtained based on the target reporting element and reported. Without entering the scanning process, exposure data reporting can be directly realized, which improves the efficiency of data reporting.
[0155] At the same time, based on the target reporting element, the set of historically visible elements and the set of delayed reporting elements can be updated to ensure the real-time performance and accuracy of data reporting.
[0156] To more clearly explain the data reporting method of this application, the following will further illustrate the data reporting method with specific examples.
[0157] In one embodiment, this application provides a data reporting method, such as... Figure 8 As shown, it includes the following steps:
[0158] Step S801: When a change is detected in the view tree of the target application, the view tree is scanned to determine the current page;
[0159] Step S802: Based on the current page, detect each element in the view tree;
[0160] Step S803: Select at least one element that meets the preset visibility conditions as a visible element to obtain the set of visible elements determined in this scan; wherein, the preset visibility conditions include basic visibility conditions and logical visibility conditions. Basic visibility conditions may include the target application being active, the element being non-hidden, the element's transparency being greater than 0, and the element's size being greater than 0, etc. Logical visibility conditions may include the element's visible range on the screen being greater than the minimum area threshold, and whether the current element is obscured by the current page, etc.
[0161] Step S804: Obtain the set of historically visible elements, which is obtained based on the previous scan result of the target application;
[0162] Step S805: Compare the set of visible elements with the set of historical visible elements. If any element in the set of visible elements is not in the set of historical visible elements, then that element is determined as the target element.
[0163] Step S806: Construct a target element set based on the determined target elements;
[0164] Step S807: Based on the business information of each target element in the target element set, detect whether each target element needs to be reported with a delay. If yes, proceed to step S809; otherwise, proceed to step S808.
[0165] Step S808: Obtain the first exposure data corresponding to the real-time reporting element set, and report the first exposure data; wherein, the first exposure data includes the exposure data corresponding to each real-time reporting element.
[0166] Step S809: Based on the business information of each delayed reporting element in the delayed reporting element set, determine the minimum exposure time corresponding to each delayed reporting element;
[0167] Step S810: For each delayed element, after waiting for the minimum exposure time corresponding to the delayed reporting element, check whether the delayed reporting element meets the preset delayed reporting conditions. If it does, proceed to step S812; otherwise, proceed to step S811. The preset delayed reporting conditions may include the delayed reporting element not being in the historical visible element set and meeting the preset visibility conditions.
[0168] Step S811: Update the set of delayed reporting elements at the current moment and end the delayed reporting process;
[0169] Step S812: Obtain and report the exposure data corresponding to the delayed reporting element.
[0170] In one example, such as Figure 9 As shown, when a change in the target application is detected, the view tree is scanned to obtain the set of visible elements G collected in this scan, and at the same time, the set of historical visible elements S obtained based on the previous scan is obtained. Elements in the set of visible elements G but not in the set of historical visible elements S are taken as target elements to form the set of visible elements N, which means the set of new elements found in this scan; elements in the set of historical visible elements G but not in the set of visible elements S are taken as invisible elements to form the set of invisible elements H.
[0171] The set of historically visible elements S can be updated based on the set of invisible elements H, that is, elements contained in set H can be removed from the set of historically visible elements S.
[0172] Based on the business information of each target element, the target element set N can be divided into a real-time reporting element set R and a delayed reporting element set D. Based on the real-time reporting element set R, the exposure data corresponding to the real-time reporting elements can be obtained and reported. Simultaneously, based on the real-time reporting element set R, the historically visible element set S can be updated; specifically, elements from the real-time reporting element set R are added to the historically visible element set S.
[0173] For each delayed reporting element in the delayed reporting element set D, its corresponding business information is obtained, and the minimum exposure time for each delayed reporting element is determined based on the business information. After each delayed reporting element waits for its corresponding minimum exposure time, it is determined whether the delayed reporting condition is met. If any delayed reporting element is in the delayed reporting element set D, not in the historically visible element set S, and is still visible, then the exposure data corresponding to that delayed reporting element is obtained and reported, and both the historically visible element set S and the delayed reporting element set D are updated. Otherwise, the reporting of the exposure data related to that element is stopped, and the delayed reporting element set D is updated, that is, delayed reporting elements that do not meet the delayed reporting condition after waiting for the minimum exposure time are removed from the delayed reporting element set.
[0174] This example provides a forced reporting interface. When view V is forcibly re-exposed, all elements on view V are collected to obtain element set A. Based on element set A, the corresponding exposure data is obtained and reported. Simultaneously, the historically visible element set S and the delayed reporting element set D are updated based on element set A.
[0175] The data reporting method provided in this application involves data storage and transmission, and can be combined with blockchain technology.
[0176] Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include an underlying platform, a platform product and service layer, and an application service layer.
[0177] The underlying blockchain platform can include modules for user management, basic services, smart contracts, and operational processing. The user management module is responsible for managing the identity information of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the correspondence between user identities and blockchain addresses (access management). Under authorization, it also monitors and audits transactions of certain real identities and provides risk control rule configuration (risk control audit). The basic services module is deployed on all blockchain node devices to verify the validity of business requests. After consensus is reached on valid requests, they are recorded in storage. For a new business request, the basic services first perform interface adaptation parsing and authentication (interface adaptation), and then encrypt the business information using a consensus algorithm (consensus management). The encryption process involves transmitting the encrypted data to the shared ledger (network communication) and storing it. The smart contract module is responsible for contract registration, issuance, triggering, and execution. Developers can define contract logic using a programming language and publish it to the blockchain (contract registration). Based on the contract terms, the module calls keys or other events to trigger execution and complete the contract logic. It also provides functions for contract upgrades and cancellations. The operations processing module is mainly responsible for deployment, configuration modification, contract settings, cloud adaptation, and real-time status visualization during product launch, such as alarms, network status checks, and node device health checks.
[0178] This application provides a data reporting device, such as... Figure 10 As shown, the data reporting device 100 may include: a scanning module 1001, an acquisition module 1002, a comparison module 1003, and a reporting module 1004, wherein,
[0179] The scanning module 1001 is used to scan at least one view of the target application and obtain the scanning results, which include the set of visible elements obtained in this scan.
[0180] The acquisition module 1002 is used to acquire the set of historically visible elements, which is acquired based on the results of the previous scan.
[0181] The comparison module 1003 is used to compare the set of visible elements with the set of historical visible elements, and determine the target set of elements from the set of visible elements.
[0182] The reporting module 1004 is used to obtain the exposure data of the target application based on the target element set and report the exposure data.
[0183] The aforementioned data reporting device scans the view tree of the target application to obtain scan results, including the set of visible elements acquired in the current scan. It then compares this set of visible elements with the historical set of visible elements from the previous scan to determine the target set of elements. Based on this target set, the corresponding exposure data is reported. By developing an exposure data reporting scheme based on the differences between two adjacent scans, the device solves the problems of inaccurate and inconsistent timing of exposure data reporting, thus improving the accuracy of data reporting.
[0184] In this embodiment of the application, when the scanning module 1001 scans at least one view of the target application and obtains the scan results, it is specifically used for:
[0185] When a change is detected in the view tree of the target application, the view tree is scanned to identify the current page and at least one element to be detected.
[0186] Based on the current page, each element in the view tree is inspected to determine whether it meets preset visibility conditions. At least one element that meets the visibility conditions is designated as a visible element, resulting in a set of visible elements.
[0187] In this embodiment of the application, when the comparison module 1003 determines the target element set by comparing the visible element set and the historical visible element set, it is specifically used for:
[0188] If any element in the set of visible elements is not in the set of historical visible elements, then that element is determined as the target element;
[0189] A set of target elements is constructed based on the determined target elements.
[0190] In this embodiment of the application, when the reporting module 1004 obtains the exposure data of the target application based on the target element set and reports the exposure data, it is specifically used for:
[0191] Based on the type of each target element in the target element set, determine the real-time reporting element set and the delayed reporting element set;
[0192] Obtain the first exposure data corresponding to the set of real-time reporting elements, and report the first exposure data; the first exposure data includes the exposure data corresponding to each real-time reporting element in the set of real-time reporting elements;
[0193] For each delayed reporting element in the delayed reporting element set, if the delayed reporting element meets the preset delayed reporting conditions, the second exposure data corresponding to the delayed reporting element is obtained and the second exposure data is reported.
[0194] In this embodiment of the application, a delay module is also included, specifically used for:
[0195] Based on the type of each delayed reporting element in the delayed reporting element set, determine the minimum exposure time corresponding to each delayed reporting element;
[0196] For each delayed element in the delayed reporting element set, after waiting for the minimum exposure time corresponding to the delayed reporting element, it is determined whether the delayed reporting element meets the delayed reporting conditions.
[0197] In this embodiment of the application, when determining whether a delayed reporting element meets the delayed reporting conditions, the delay module is specifically used for:
[0198] If the delayed reporting element is not in the historical visible element set, and the delayed reporting element meets the visibility condition, then the delayed reporting element is determined to meet the delayed reporting condition.
[0199] In this embodiment of the application, a mandatory reporting module is also included, specifically used for:
[0200] Based on the received exposure request for at least one target view, the target view is set to a visible state; when the target view is visible, the visibility condition is met.
[0201] Retrieve at least one target reporting element from the target view that is in a visible state;
[0202] Obtain third exposure data based on the target reporting elements, and report the third exposure data.
[0203] In one alternative embodiment, an electronic device is provided, such as Figure 11 As shown, Figure 11 The illustrated electronic device 4000 includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, via a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one type, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.
[0204] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0205] Bus 4002 may include a pathway for transmitting information between the aforementioned components. Bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 4002 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 11 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0206] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0207] The memory 4003 stores application code (computer program) that executes the solution of this application, and its execution is controlled by the processor 4001. The processor 4001 executes the application code stored in the memory 4003 to implement the content shown in the foregoing method embodiments.
[0208] Electronic devices include, but are not limited to, mobile terminals such as mobile phones, laptops, and tablets, as well as fixed terminals such as digital TVs and desktop computers.
[0209] This application provides a computer-readable storage medium storing a computer program that, when run on a computer, enables the computer to execute the corresponding content in the aforementioned method embodiments. Compared with the prior art, by establishing an exposure data reporting scheme based on the difference between two adjacent scan results, the problems of inaccurate and inconsistent timing of exposure data reporting are solved, thereby improving the accuracy of data reporting.
[0210] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the following actions:
[0211] The view tree of the target application is scanned to obtain the scan results, which include the set of visible elements obtained in this scan. Then, the set of visible elements obtained in this scan is compared with the historical set of visible elements obtained in the previous scan to determine the target set of elements. Based on the target set of elements, the corresponding exposure data is reported.
[0212] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0213] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A data reporting method, characterized in that, The method comprises the following steps: scanning at least one view of a target application to obtain a scanning result, wherein the scanning result comprises a visible element set obtained in this scanning; obtaining a historical visible element set, wherein the historical visible element set is obtained based on a last scanning result of the target application; comparing the visible element set and the historical visible element set to determine a target element set from the visible element set; if an exposure request is received for at least one target view of the at least one view, setting the at least one target view to a visible state, and obtaining at least one target reporting element in the target view in the visible state; the target view is in the visible state, and a visible condition is met; obtaining third exposure data based on the target reporting element, reporting the third exposure data, and adding the target reporting element to the historical visible element set; obtaining exposure data of the target application based on the target element set, and reporting the exposure data; the obtaining of the exposure data of the target application based on the target element set and the reporting of the exposure data comprise the following steps: determining a delay reporting element in the target element set, and for each delay reporting element, determining a minimum exposure time of the delay reporting element according to a type of the delay reporting element; for each delay reporting element, after waiting for the minimum exposure time corresponding to the delay reporting element, if the delay reporting element is not in the historical visible element set and the delay reporting element meets the visible condition, obtaining second exposure data corresponding to the delay reporting element, and reporting the second exposure data.
2. The method of claim 1, wherein, The method comprises the following steps: when it is detected that a view tree of the target application changes, scanning the view tree to determine a current page; based on the current page, detecting each element in the view tree to determine whether the element in the view tree meets a preset visible condition; at least one element meeting the visible condition is taken as a visible element to obtain a visible element set.
3. The method of claim 2, wherein, When at least one of the following conditions is detected, it is determined that the view tree of the target application changes: any view is removed from a parent view; any view is switched between a hidden state and a non-hidden state; transparency of any view changes; a dynamic component changes; the target application switches between a foreground state and a background state; a view displayed on a screen changes.
4. The method of claim 2, wherein, The scanning of the view tree to determine the current page comprises the following steps: scanning the view tree to determine a page with the highest level and being visible in the view tree as the current page.
5. The data reporting method of claim 1, wherein, The comparison of the visible element set and the historical visible element set to determine a target element set comprises the following steps: determining an element in the visible element set that cannot be matched with the historical visible element set as a target element; based on the determined target element, a target element set is formed.
6. The data reporting method of claim 4, wherein, The determination of a delay reporting element in the target element set comprises the following steps: determining a delay reporting element set based on the type of each target element in the target element set, wherein the elements in the delay reporting element set are delay reporting elements; The exposure data of the target application is obtained based on the target element set, and the exposure data is reported, and the method further includes: determining a real-time reporting element set based on the type of each target element in the target element set; obtaining first exposure data corresponding to the real-time reporting element set and reporting the first exposure data; the first exposure data includes exposure data corresponding to each real-time reporting element in the real-time reporting element set.
7. The method according to any one of claims 1 to 6, characterized in that, After reporting any exposure data, the historical visible element set is updated based on the reporting element corresponding to the exposure data.
8. A data reporting apparatus, characterized by comprising: It includes: a scanning module configured to scan at least one view of a target application and obtain a scanning result, wherein the scanning result includes a visible element set obtained in the current scanning; a obtaining module configured to obtain a historical visible element set, wherein the historical visible element set is obtained based on a last scanning result of the target application; a comparing module configured to compare the visible element set and the historical visible element set and determine a target element set from the visible element set; a reporting module configured to, if an exposure request is received for at least one target view in the at least one view, set the at least one target view to a visible state, and obtain at least one target reporting element in the target view in the visible state; the target view is in the visible state and meets a visible condition; obtaining third exposure data based on the target reporting element, reporting the third exposure data, and adding the target reporting element to the historical visible element set; obtaining exposure data of the target application based on the target element set and reporting the exposure data; The reporting module, when obtaining exposure data of the target application based on the target element set and reporting the exposure data, is specifically configured to: determine delay reporting elements in the target element set, and for each delay reporting element, determine a minimum exposure time of the delay reporting element according to the type of the delay reporting element; for each delay reporting element, after waiting for the minimum exposure time corresponding to the delay reporting element, if the delay reporting element is not in the historical visible element set and the delay reporting element meets the visible condition, obtain second exposure data corresponding to the delay reporting element and report the second exposure data.
9. The apparatus of claim 8, wherein, The scanning module, when scanning at least one view of a target application and obtaining a scanning result, is specifically configured to: detect a change in a view tree of the target application, scan the view tree, determine a current page, detect each element in the view tree based on the current page to determine whether the element in the view tree meets a preset visible condition, and obtain the visible element set by taking at least one element meeting the visible condition as a visible element.
10. The data reporting apparatus according to claim 9, characterized in that, The scanning module determines that the view tree of the target application changes when at least one of the following is detected: Any view is removed from a parent view; any view switches between a hidden state and a non-hidden state; transparency of any view changes; a dynamic component changes; the target application switches between a foreground state and a background state; a view displayed in the screen changes.
11. The data reporting apparatus according to claim 9, wherein The scanning module scans the view tree to determine a current page when the view tree is scanned. The scanning module scans the view tree to determine a page with the highest level and visible in the view tree as the current page.
12. The data reporting apparatus according to claim 8, characterized in that, The comparison module compares the visible element set and the historical visible element set to determine a target element set, and specifically for: Determining elements in the visible element set that cannot be matched with the historical visible element set as target elements; Based on the determined target elements, the target element set is formed.
13. The data reporting apparatus according to claim 12, characterized in that, The reporting module determines a delay reporting element in the target element set, and specifically for: Based on the type of each target element in the target element set, a delay reporting element set is determined, and elements in the delay reporting element set are delay reporting elements; The reporting module is further configured to: Based on the type of each target element in the target element set, a real-time reporting element set is determined; Obtain first exposure data corresponding to the real-time reporting element set, and report the first exposure data; The first exposure data includes exposure data corresponding to each real-time reporting element in the real-time reporting element set.
14. The data reporting apparatus according to any one of claims 8-13, wherein, The reporting module is further configured to: After reporting any exposure data, update the historical visible element set based on the reporting elements corresponding to the exposure data.
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 executes the program to implement the data reporting method of any one of claims 1-7.
16. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the program is executed by the processor to implement the data reporting method of any one of claims 1-7.
Citation Information
Patent Citations
Webpage exposure data acquisition method and system, electronic equipment and storage medium
CN108846116A
Data collection method and device, electronic equipment and storage medium
CN110704097A