Movatterモバイル変換


[0]ホーム

URL:


CN117931576A - Front-end data collection method and device and electronic equipment - Google Patents

Front-end data collection method and device and electronic equipment
Download PDF

Info

Publication number
CN117931576A
CN117931576ACN202410114398.5ACN202410114398ACN117931576ACN 117931576 ACN117931576 ACN 117931576ACN 202410114398 ACN202410114398 ACN 202410114398ACN 117931576 ACN117931576 ACN 117931576A
Authority
CN
China
Prior art keywords
end data
event
target
function
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410114398.5A
Other languages
Chinese (zh)
Inventor
陈中彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Ubtech Technology Co ltd
Original Assignee
Shenzhen Ubtech Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Ubtech Technology Co ltdfiledCriticalShenzhen Ubtech Technology Co ltd
Priority to CN202410114398.5ApriorityCriticalpatent/CN117931576A/en
Publication of CN117931576ApublicationCriticalpatent/CN117931576A/en
Pendinglegal-statusCriticalCurrent

Links

Classifications

Landscapes

Abstract

The application is suitable for the technical field of software, and provides a front-end data collection method, a front-end data collection device and electronic equipment, wherein the front-end data collection method comprises the following steps of: monitoring a current event of a target application, wherein the target application is an application with a buried point SDK; under the condition that the current event is a target event, calling a packaging function corresponding to the target event to collect front-end data, wherein the packaging function is a function which is packaged in advance and is used for collecting the front-end data corresponding to the target event; and sending the front-end data to a server. By the method, timeliness of acquiring front-end data can be improved.

Description

Translated fromChinese
前端数据收集方法、装置及电子设备Front-end data collection method, device and electronic equipment

技术领域Technical Field

本申请属于软件技术领域,尤其涉及前端数据收集方法、装置、电子设备及计算机可读存储介质。The present application belongs to the field of software technology, and in particular, relates to a front-end data collection method, device, electronic device and computer-readable storage medium.

背景技术Background technique

随着互联网应用的快速发展,用户行为数据的采集和分析成为了企业优化产品和服务的重要手段。前端数据采集埋点方法是获取前端数据的一种常用的方法,该方法通过在前端应用中插入埋点代码,根据该埋点代码追踪前端的特定事件,并将这些特定事件对应的数据发送到后台进行进一步处理和分析。With the rapid development of Internet applications, the collection and analysis of user behavior data has become an important means for enterprises to optimize their products and services. The front-end data collection tracking method is a common method for obtaining front-end data. This method inserts tracking code into the front-end application, tracks specific events on the front-end according to the tracking code, and sends the data corresponding to these specific events to the back-end for further processing and analysis.

但现有的前端数据采集埋点方法需要开发人员编写大量重复性的代码,从而导致开发时长较长,进而难以及时获取到前端数据。However, the existing front-end data collection and tracking methods require developers to write a large amount of repetitive code, which leads to a long development time and makes it difficult to obtain front-end data in a timely manner.

发明内容Summary of the invention

本申请实施例提供了前端数据收集方法、装置、电子设备及计算机可读存储介质,可以解决难以及时获取到前端数据的问题。The embodiments of the present application provide a front-end data collection method, device, electronic device and computer-readable storage medium, which can solve the problem of difficulty in obtaining front-end data in a timely manner.

第一方面,本申请实施例提供了一种前端数据收集方法,应用于埋点SDK,包括:In a first aspect, an embodiment of the present application provides a front-end data collection method, which is applied to a tracking SDK, including:

监听目标应用的当前事件,所述目标应用为存在埋点SDK的应用;Monitor the current events of the target application, where the target application is an application with a tracking SDK;

在所述当前事件为目标事件的情况下,调用与所述目标事件对应的封装函数进行前端数据的采集,所述封装函数为预先封装的用于采集所述目标事件对应的前端数据的函数;In the case where the current event is a target event, calling a package function corresponding to the target event to collect front-end data, the package function being a pre-packaged function for collecting front-end data corresponding to the target event;

将所述前端数据向服务器发送。The front-end data is sent to the server.

第二方面,本申请实施例提供了一种前端数据收集装置,包括:In a second aspect, an embodiment of the present application provides a front-end data collection device, including:

事件监听模块,用于监听目标应用的当前事件,所述目标应用为存在埋点SDK的应用;An event monitoring module is used to monitor the current events of the target application, where the target application is an application for which a tracking SDK is available;

前端数据采集模块,用于在所述当前事件为目标事件的情况下,调用与所述目标事件对应的封装函数进行前端数据的采集,所述封装函数为预先封装的用于采集所述目标事件对应的前端数据的函数;A front-end data collection module, used for, when the current event is a target event, calling a package function corresponding to the target event to collect front-end data, wherein the package function is a pre-packaged function for collecting front-end data corresponding to the target event;

前端数据发送模块,用于将所述前端数据向服务器发送。The front-end data sending module is used to send the front-end data to the server.

第三方面,本申请实施例提供了一种电子设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如第一方面所述的方法。In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the computer program.

第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如第一方面所述的方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.

第五方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行上述第一方面所述的方法。In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the method described in the first aspect above.

本申请实施例与现有技术相比存在的有益效果是:Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

本申请实施例中,在判断出监听的当前事件为目标事件的情况下,调用与目标事件对应的封装函数采集前端数据,并将采集的前端数据向服务器发送。由于封装函数为预先封装的用于采集目标事件的前端数据的函数,因此,在需要采集与该目标事件对应的前端数据时只需要调用对应的封装函数即可,无需重新编写用于采集该前端数据的函数,即,无需在采集每一种用户前端数据时均进行一次代码的开发,从而提高了开发效率以及提高了采集到前端数据的及时性。In the embodiment of the present application, when it is determined that the current event being monitored is a target event, the encapsulation function corresponding to the target event is called to collect the front-end data, and the collected front-end data is sent to the server. Since the encapsulation function is a pre-encapsulated function for collecting the front-end data of the target event, when it is necessary to collect the front-end data corresponding to the target event, it is only necessary to call the corresponding encapsulation function, without rewriting the function for collecting the front-end data, that is, there is no need to develop a code once when collecting each type of user front-end data, thereby improving the development efficiency and the timeliness of collecting the front-end data.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

图1是本申请一实施例提供的一种前端数据收集方法的流程示意图;FIG1 is a flow chart of a front-end data collection method provided in an embodiment of the present application;

图2是本申请一实施例提供的一种埋点SDK的结构示意图;FIG2 is a schematic diagram of the structure of a tracking SDK provided by an embodiment of the present application;

图3是本申请一实施例提供的一种埋点SDK收集前端数据的流程示意图;FIG3 is a schematic diagram of a process of collecting front-end data using a tracking SDK provided in an embodiment of the present application;

图4是本申请一实施例提供的一种前端数据收集装置的结构示意图;FIG4 is a schematic diagram of the structure of a front-end data collection device provided by an embodiment of the present application;

图5是本申请另一实施例提供的一种电子设备的结构示意图。FIG5 is a schematic diagram of the structure of an electronic device provided in another embodiment of the present application.

具体实施方式Detailed ways

以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described 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 combinations thereof.

还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should also be understood that the term “and/or” used in the specification and appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.

在企业优化应用或服务的过程中,通常会参考该应用的前端数据,该前端数据包括用户在使用该应用时的行为数据,还可以包括该应用运行时的内部数据。由于优化的方向通常会随着企业业务需求的改变而改变,而不同的业务需求需要采集的前端数据通常是不同的(如在前端数据为用户行为数据时,不同类型的用户行为所对应的用户行为数据也是不同),因此,若在每次业务需求变更的情况下均进行一次代码的编写以用于采集对应的前端数据,则通常会使得开发人员需要编写大量重复性的代码,而编写代码需要耗费一定的时间,从而导致难以及时获取到所需的前端数据。In the process of optimizing applications or services, enterprises usually refer to the front-end data of the application, which includes the behavior data of users when using the application, and can also include the internal data of the application when it is running. Since the direction of optimization usually changes with the changes in the business needs of the enterprise, and the front-end data required to be collected for different business needs is usually different (for example, when the front-end data is user behavior data, the user behavior data corresponding to different types of user behaviors is also different), therefore, if code is written once every time the business needs change to collect the corresponding front-end data, it will usually require developers to write a lot of repetitive code, and writing code takes a certain amount of time, which makes it difficult to obtain the required front-end data in a timely manner.

为了提高获取到前端数据的及时性,本申请实施例提供了一种前端数据收集方法。在该方法中,预先封装了用于采集前端数据的函数,其中,被封装的每一个函数均用于采集一种前端数据。当在目标应用埋下埋点软件开发工具包(Software Development Kit,SDK)后,该埋点SDK能够对该目标应用的当前事件进行监听,并在监听到该当前事件为目标事件后,调用用于采集该目标事件的前端数据的封装函数,并将采集到的前端数据发送给服务器,以通过该服务器对采集的前端数据进行分析。In order to improve the timeliness of obtaining front-end data, an embodiment of the present application provides a front-end data collection method. In this method, a function for collecting front-end data is pre-encapsulated, wherein each encapsulated function is used to collect a type of front-end data. After the embedding point software development kit (SDK) is embedded in the target application, the embedding point SDK can monitor the current event of the target application, and after monitoring that the current event is a target event, call the encapsulation function for collecting the front-end data of the target event, and send the collected front-end data to the server, so that the collected front-end data can be analyzed by the server.

由于预先封装了用于采集前端数据的函数,因此,后续采集前端数据时只需要调用对应的封装函数即可,从而无需在采集每一种前端数据时均进行一次代码的开发,进而提高了开发效率以及提高了采集到前端数据的及时性。Since the functions for collecting front-end data are pre-packaged, you only need to call the corresponding packaged functions when collecting front-end data subsequently, so there is no need to develop code once when collecting each type of front-end data, thereby improving development efficiency and improving the timeliness of collecting front-end data.

下面结合附图对本申请实施例提供的前端数据收集方法进行描述。The front-end data collection method provided in the embodiment of the present application is described below in conjunction with the accompanying drawings.

图1示出了本申请实施例提供的一种前端数据收集方法的流程示意图,该前端数据包括用户行为数据和/或目标应用的运行数据,为便于描述,下面主要以前端数据为用户行为数据进行描述。FIG1 shows a flow chart of a front-end data collection method provided in an embodiment of the present application. The front-end data includes user behavior data and/or target application operation data. For ease of description, the front-end data is mainly described below as user behavior data.

本申请实施例提供的前端数据收集方法应用于埋点SDK,详述如下:The front-end data collection method provided in the embodiment of the present application is applied to the tracking SDK, which is described in detail as follows:

S11,监听目标应用的当前事件,该目标应用为存在埋点SDK的应用。S11, monitoring the current events of the target application, where the target application is an application with a tracking SDK.

其中,这里的当前事件包括用户事件,该用户事件包括用户行为,该用户行为是指用户在目标应用上的行为,该用户行为包括:点击、浏览、输入、滚动、拖拽等行为。The current event here includes a user event, and the user event includes a user behavior. The user behavior refers to the user's behavior on the target application, and the user behavior includes: clicking, browsing, inputting, scrolling, dragging, and other behaviors.

本申请实施例中,当在一个应用埋下埋点SDK之后,该应用即为本申请实施例所描述的目标应用。可选地,考虑到目标应用只有在运行时才会产生对应的数据,比如,用户只有在目标应用运行过程中才会对该目标应用进行操作,因此,可在目标应用启动后再对当前事件进行监听。In the embodiment of the present application, after the tracking SDK is embedded in an application, the application is the target application described in the embodiment of the present application. Optionally, considering that the target application will only generate corresponding data when it is running, for example, the user will only operate the target application when the target application is running, therefore, the current event can be monitored after the target application is started.

本申请实施例中,上述的当前事件还可以包括目标应用内部的运行事件,该运行事件包括针对用户行为的响应事件、启动事件等。当目标事件包括目标应用内部的运行事件时,后续能够采集到该运行事件对应的运行数据,从而有利于服务器对目标应用进行对应的分析。In the embodiment of the present application, the above-mentioned current event may also include a running event inside the target application, and the running event includes a response event to user behavior, a startup event, etc. When the target event includes a running event inside the target application, the running data corresponding to the running event can be collected later, which is conducive to the server to perform corresponding analysis on the target application.

S12,在当前事件为目标事件的情况下,调用与目标事件对应的封装函数进行前端数据的采集,该封装函数为预先封装的用于采集目标事件对应的前端数据的函数。S12, when the current event is a target event, calling a package function corresponding to the target event to collect front-end data, the package function is a pre-packaged function for collecting front-end data corresponding to the target event.

具体地,上述的目标事件包括目标用户行为事件和/或目标运行事件。例如,在当前事件为用户事件时,将该用户事件所对应的用户行为与目标行为事件所对应的用户行为进行比较,根据比较结果判断该用户事件是否为目标行为事件,若是,则调用与该目标行为事件对应的封装函数进行前端数据(即用户行为数据)的采集。例如,假设需要采集用户行为数据所对应的用户行为是“点击”,若当前监听到的用户行为为“拖拽”,则该“拖拽”不属于上述的目标行为事件所对应的用户行为,而若当前监听到的用户行为为“点击”,则该“点击”属于上述的目标行为事件所对应的用户行为。Specifically, the above-mentioned target events include target user behavior events and/or target operation events. For example, when the current event is a user event, the user behavior corresponding to the user event is compared with the user behavior corresponding to the target behavior event, and whether the user event is a target behavior event is determined based on the comparison result. If so, the encapsulation function corresponding to the target behavior event is called to collect front-end data (i.e., user behavior data). For example, assuming that the user behavior corresponding to the user behavior data to be collected is "click", if the currently monitored user behavior is "drag", then the "drag" does not belong to the user behavior corresponding to the above-mentioned target behavior event, and if the currently monitored user behavior is "click", then the "click" belongs to the user behavior corresponding to the above-mentioned target behavior event.

本申请实施例中,预先封装了用于采集目标事件的函数。以目标事件为用户行为事件为例,考虑到用户行为的种类较多,因此,可针对每一种用户行为都封装对应的函数以用于采集该用户行为的用户行为数据。即,每一个封装函数均用于采集一种类型的用户行为的用户行为数据,且不同封装函数所对应的用户行为的类型不同。其中,预先封装的函数可包括:(1)页面访问埋点函数,该页面访问埋点函数为:用于记录用户访问指定页面的访问信息的函数,其中,该访问信息包括停留时长、访问次数等,埋点SDK可在指定页面加载完之后调用该页面访问函数,或者,在用户手动调用该指定页面之后调用。(2)按钮点击埋点函数,该按钮点击埋点函数为:用于记录用户点击链接的点击信息的函数,其中,该点击信息包括按钮的名称、被点击次数等。(3)错误日志埋点函数,该错误日志埋点函数用于捕捉错误信息的函数。当然,还可以根据实际的业务需求封装对应的函数,此处不作限定。In the embodiment of the present application, a function for collecting target events is pre-encapsulated. Taking the target event as a user behavior event as an example, considering that there are many types of user behaviors, a corresponding function can be encapsulated for each type of user behavior to collect the user behavior data of the user behavior. That is, each encapsulated function is used to collect the user behavior data of a type of user behavior, and the types of user behaviors corresponding to different encapsulated functions are different. Among them, the pre-encapsulated functions may include: (1) page access point embedding function, which is a function used to record the access information of the user accessing the specified page, wherein the access information includes the length of stay, the number of visits, etc. The embedding SDK can call the page access function after the specified page is loaded, or after the user manually calls the specified page. (2) button click embedding function, which is a function used to record the click information of the user clicking the link, wherein the click information includes the name of the button, the number of clicks, etc. (3) error log embedding function, which is a function used to capture error information. Of course, the corresponding functions can also be encapsulated according to actual business needs, which is not limited here.

S13,将前端数据向服务器发送。S13, sending the front-end data to the server.

可选地,埋点SDK在采集到前端数据之后,可先对该前端数据进行预处理(如将前端数据的格式预处理为符合要求的格式),再将经过预处理后的前端数据存储到本地缓存中,以便在后续的发送过程中使用。由于缓存了采集的前端数据,因此,即使在网络不稳定或无法连接服务器时也能保留采集到的前端数据,从而能够提高前端数据的可靠性和稳定性。Optionally, after collecting the front-end data, the tracking SDK can pre-process the front-end data (such as pre-processing the format of the front-end data to meet the requirements), and then store the pre-processed front-end data in the local cache for use in the subsequent sending process. Since the collected front-end data is cached, the collected front-end data can be retained even when the network is unstable or unable to connect to the server, thereby improving the reliability and stability of the front-end data.

在需要发送前端数据之前,可预先设定与埋点SDK通信的服务器的通信地址,这样,在采集到前端数据后,根据预先设定的服务器的通信地址向对应的服务器发送采集的前端数据。Before the front-end data needs to be sent, the communication address of the server that communicates with the tracking SDK can be pre-set. In this way, after the front-end data is collected, the collected front-end data is sent to the corresponding server according to the pre-set server communication address.

本申请实施例中,在判断出监听的当前事件为目标事件的情况下,调用与目标事件对应的封装函数采集前端数据,并将采集的前端数据向服务器发送。由于封装函数为预先封装的用于采集目标事件的前端数据的函数,因此,在需要采集与该目标事件对应的前端数据时只需要调用对应的封装函数即可,无需重新编写用于采集该前端数据的函数,即,无需在采集每一种用户前端数据时均进行一次代码的开发,从而提高了开发效率以及提高了采集到前端数据的及时性。In the embodiment of the present application, when it is determined that the current event being monitored is a target event, the encapsulation function corresponding to the target event is called to collect the front-end data, and the collected front-end data is sent to the server. Since the encapsulation function is a pre-encapsulated function for collecting the front-end data of the target event, when it is necessary to collect the front-end data corresponding to the target event, it is only necessary to call the corresponding encapsulation function, without rewriting the function for collecting the front-end data, that is, there is no need to develop a code once when collecting each type of user front-end data, thereby improving the development efficiency and the timeliness of collecting the front-end data.

在一些实施例中,为了保证采集到准确的前端数据,则在采集之前先对该前端数据进行校验,此时,S12包括:In some embodiments, in order to ensure that accurate front-end data is collected, the front-end data is verified before collection. In this case, S12 includes:

对前端数据进行校验,并在前端数据校验通过的情况下调用与目标事件对应的封装函数进行前端数据的采集。Verify the front-end data, and if the front-end data verification passes, call the encapsulation function corresponding to the target event to collect the front-end data.

本申请实施例中,可通过分析该前端数据本身和/或对该前端数据的属性等进行分析实现对该前端数据的校验。In the embodiment of the present application, the front-end data can be verified by analyzing the front-end data itself and/or analyzing the attributes of the front-end data.

在一些实施例中,可预先设定前端数据的校验信息,这样,后续可根据该校验信息对待采集的前端数据进行校验,即,在对前端数据进行校验之前,还包括:In some embodiments, verification information of the front-end data may be preset, so that the collected front-end data may be verified according to the verification information later, that is, before verifying the front-end data, the following is also included:

在埋点SDK中进行校验信息的定义,校验信息包括事件类型。Verification information is defined in the tracking SDK, and the verification information includes the event type.

对应地,对前端数据进行校验,包括:Correspondingly, the front-end data is verified, including:

将前端数据与事件类型进行匹配,在匹配成功后判定前端数据的校验通过。The front-end data is matched with the event type, and after the match is successful, it is determined that the verification of the front-end data has passed.

其中,这里的事件类型指的是用于定义和描述事件的结构和属性的类型,包含事件的名称、上报字段、字段的参数、参数的字符长度以及其他相关属性。需要指出的是,考虑到不同类型的目标事件所对应的前端数据需校验的信息可能不同(如不同用户行为对应的用户行为数据不同,则对应的需校验的信息也通常不同),因此,设定不同的目标事件对应不同的校验信息,即在埋点SDK中定义的校验信息的种类与该埋点SDK需采集的前端数据所对应的目标事件的类型的种类相同,以提高校验结果的准确度。Among them, the event type here refers to the type used to define and describe the structure and attributes of the event, including the name of the event, the reporting field, the parameters of the field, the character length of the parameter, and other related attributes. It should be pointed out that considering that the front-end data corresponding to different types of target events may have different information to be verified (such as different user behaviors corresponding to different user behavior data, the corresponding information to be verified is usually different), therefore, different target events are set to correspond to different verification information, that is, the type of verification information defined in the tracking SDK is the same as the type of target event corresponding to the front-end data that the tracking SDK needs to collect, so as to improve the accuracy of the verification results.

在埋点SDK定义了包含事件类型的校验信息之后,假设该事件类型包括事件的名称、上报字段、参数的字符长度。当需要采集用户行为数据时,将该用户行为数据所对应的事件的名称与事件类型(该事件类型对应的校验信息与用户行为数据所对应的用户行为对应)的事件的名称比较、将该用户行为数据对应的上报字段与事件类型的上报字段比较、将该用户行为数据的字符长度与事件类型的参数的字符长度比较,若上述各个比较所对应的比较结果均指示参与比较的双方相同,则判定用户行为数据与事件类型匹配成功,即判定对用户行为数据的校验通过。After the tracking SDK defines the verification information including the event type, it is assumed that the event type includes the name of the event, the reporting field, and the character length of the parameter. When it is necessary to collect user behavior data, the name of the event corresponding to the user behavior data is compared with the name of the event of the event type (the verification information corresponding to the event type corresponds to the user behavior corresponding to the user behavior data), the reporting field corresponding to the user behavior data is compared with the reporting field of the event type, and the character length of the user behavior data is compared with the character length of the parameter of the event type. If the comparison results corresponding to each of the above comparisons indicate that the two parties involved in the comparison are the same, then it is determined that the user behavior data and the event type match successfully, that is, it is determined that the verification of the user behavior data has passed.

在本申请实施例中,由于埋点SDK预先定义了校验信息,因此,后续可直接依据该校验信息对前端数据进行静态校验,提高了校验的准确度以及效率。In the embodiment of the present application, since the tracking point SDK predefines the verification information, the front-end data can be statically verified directly based on the verification information, thereby improving the accuracy and efficiency of the verification.

在一些实施例中,若本申请实施例的埋点SDK为针对TypeScript开发的SDK,则可利用该TypeScript的强类型特性,定义出清晰明确的校验信息。当然,在定义校验信息时,还可定义用于封装采集得到的前端数据的数据结构,以及,定义埋点SDK向服务器发送采集的前端数据的接口等等。In some embodiments, if the tracking SDK of the embodiment of the present application is an SDK developed for TypeScript, the strong type characteristics of TypeScript can be used to define clear and unambiguous verification information. Of course, when defining the verification information, it is also possible to define a data structure for encapsulating the collected front-end data, and define an interface for the tracking SDK to send the collected front-end data to the server, etc.

可选地,若本申请实施例的埋点SDK为针对TypeScript开发的SDK,则可利用该TypeScript的装饰器特性,即利用面向切面编程(Aspect Oriented Programming,AOP)框架或自定义切面来实现埋点逻辑的插入,通过定义切点和切面,可以在业务代码的特定位置插入埋点逻辑,从而实现解耦,提高代码的可读性和可维护性。其中,AOP是一种编程范式,可以通过在运行时动态地将额外的逻辑织入到原有的代码中。Optionally, if the tracking SDK of the embodiment of the present application is an SDK developed for TypeScript, the decorator feature of TypeScript can be used, that is, the Aspect Oriented Programming (AOP) framework or a custom aspect can be used to insert the tracking logic. By defining the point cuts and aspects, the tracking logic can be inserted at specific locations of the business code, thereby achieving decoupling and improving the readability and maintainability of the code. Among them, AOP is a programming paradigm that can dynamically weave additional logic into the original code at runtime.

上面介绍了如何对前端数据进行校验以及该前端数据校验成功的情况,但在实际情况中,该前端数据还存在校验未通过的情况,即在一些实施例中,本申请实施例提供的前端数据收集方法,还包括:The above describes how to verify the front-end data and the situation where the front-end data verification is successful. However, in actual situations, the front-end data may fail to pass the verification. That is, in some embodiments, the front-end data collection method provided in the embodiment of the present application further includes:

在前端数据校验未通过的情况下,调用预先封装的错误日志埋点函数获取校验未通过的前端数据的错误信息。When the front-end data verification fails, the pre-packaged error log tracking function is called to obtain the error information of the front-end data that failed the verification.

其中,该错误日志埋点函数用于获取未通过验证的前端数据所对应的错误信息,该错误信息包括全局错误、错误类型、错误位置等。可选地,将获取的错误信息以日志的形式记录,并将该日志发送给服务器。如在到达上报时刻时将该日志向服务器发送,或在生成日志时向该服务器发送等,具体的发送方式此处不作限定。Among them, the error log point-burying function is used to obtain the error information corresponding to the front-end data that has not passed the verification, and the error information includes global errors, error types, error locations, etc. Optionally, the obtained error information is recorded in the form of a log, and the log is sent to the server. For example, the log is sent to the server when the reporting time is reached, or when the log is generated, etc. The specific sending method is not limited here.

本申请实施例中,由于在前端数据校验未通过的情况下,调用预先封装的错误日志埋点函数获取对应的错误信息,因此,后续能够根据该日志快速分析前端数据未通过验证的原因。此外,由于获取错误信息的是预先封装的函数,即无需针对前端数据校验未通过的场景编写对应的代码,因此,提高了埋点SDK的开发效率。In the embodiment of the present application, since the pre-packaged error log tracking function is called to obtain the corresponding error information when the front-end data verification fails, the reason why the front-end data failed the verification can be quickly analyzed based on the log. In addition, since the error information is obtained by the pre-packaged function, there is no need to write the corresponding code for the scenario where the front-end data verification fails, thus improving the development efficiency of the tracking SDK.

在一些实施例中,为了能够保证埋点SDK所采集的前端数据为目标应用的数据,而不是其他应用的数据,则还需对目标应用进行校验,即在预先定义的校验信息中还设置身份信息,此时,在S11之前,还包括:In some embodiments, in order to ensure that the front-end data collected by the tracking SDK is the data of the target application rather than the data of other applications, it is necessary to verify the target application, that is, to set the identity information in the predefined verification information. At this time, before S11, it also includes:

在目标应用启动时,初始化埋点SDK,初始化埋点SDK包括:将目标应用的标识与身份信息比较,根据比较结果判断目标应用是否通过身份校验。When the target application is started, the tracking SDK is initialized. Initializing the tracking SDK includes: comparing the target application's identifier with the identity information, and judging whether the target application passes the identity verification based on the comparison result.

其中,目标应用的标识用于唯一标识该目标应用,该目标应用的标识可以包括数字、符号、字母等至少一种表示。The identifier of the target application is used to uniquely identify the target application, and the identifier of the target application may include at least one representation such as numbers, symbols, letters, etc.

本申请实施例中,在目标应用启动时,先验证目标应用是否为埋点SDK所需采集的数据的应用,在该目标应用通过身份校验的情况下,后续再对该目标应用的目标事件进行监听,从而提高采集的用户行为数据的准确度。In an embodiment of the present application, when the target application is started, it is first verified whether the target application is the application for which the data needs to be collected by the tracking SDK. If the target application passes the identity verification, the target events of the target application are subsequently monitored, thereby improving the accuracy of the collected user behavior data.

可选地,若校验信息定义了埋点SDK向服务器发送采集的前端数据的接口,则在初始化埋点SDK时,还可以对该接口进行验证,从而保证埋点SDK能够将其采集的前端数据通过该接口成功发送给服务器。Optionally, if the verification information defines the interface through which the embedding SDK sends the collected front-end data to the server, the interface can also be verified when initializing the embedding SDK to ensure that the embedding SDK can successfully send the collected front-end data to the server through the interface.

在一些实施例中,本申请实施例提供的前端数据收集方法还包括:In some embodiments, the front-end data collection method provided by the embodiment of the present application further includes:

A1、调用预置属性函数采集目标应用所在的设备的网页信息。A1. Call a preset attribute function to collect web page information of the device where the target application is located.

其中,该预置属性函数为预先封装的用于采集网页信息的函数,由于网页信息为通用的信息,即该网页信息在不同业务分析中通常都需要获取的信息,因此,将获取网页信息的函数作为预置属性函数,使得后续可以直接对该预置属性函数进行调用,无需单独开发,提高了开发效率。Among them, the preset attribute function is a pre-packaged function for collecting web page information. Since web page information is general information, that is, information that usually needs to be obtained in different business analyses, the function for obtaining web page information is used as a preset attribute function, so that the preset attribute function can be directly called later without the need for separate development, thereby improving development efficiency.

其中,该网页信息包括以下至少一种:网页地址、目标应用所在的设备的当前操作系统、该设备的屏幕分辨率、浏览器名称、浏览器版本等。The web page information includes at least one of the following: a web page address, a current operating system of a device where the target application is located, a screen resolution of the device, a browser name, a browser version, etc.

A2、将网页信息向服务器发送。A2. Send the web page information to the server.

具体地,可实时将获取的网页信息向服务器发送,或者,考虑到网页信息通常不会发生变化,因此,可在获取到与第一次获取的网页信息不同的网页信息的情况下,再将新获取的网页信息向服务器发送。由于网页信息也可能会影响用户的行为,因此,还对网页信息进行采集并发送给服务器,有利于服务器结合该网页信息和用户行为数据进行分析,进而得到更全面的分析结果。Specifically, the acquired web page information can be sent to the server in real time, or, considering that the web page information usually does not change, when the acquired web page information is different from the first acquired web page information, the newly acquired web page information can be sent to the server. Since the web page information may also affect the user's behavior, the web page information is also collected and sent to the server, which is conducive to the server combining the web page information with the user behavior data for analysis, thereby obtaining a more comprehensive analysis result.

在一些实施例中,在采集到前端数据之后,可根据实际需求将前端数据向服务器发送,包括:In some embodiments, after the front-end data is collected, the front-end data may be sent to the server according to actual needs, including:

将前端数据以非实时发送的方式或者以实时发送的方式向服务器发送。The front-end data is sent to the server in a non-real-time or real-time manner.

其中,非实时发送包括定时发送和批量发送(或称批量上传)。Among them, non-real-time sending includes scheduled sending and batch sending (or batch uploading).

批量发送有以下几个优势:Batch sending has the following advantages:

1)减少请求次数:相比较单个数据一个一个上传,批量上传可以将多个数据打包成一个请求,减少了请求次数,从而降低了网络传输的负担,减少了网络延迟和丢包的概率。1) Reduce the number of requests: Compared with uploading individual data one by one, batch uploading can package multiple data into one request, reducing the number of requests, thereby reducing the burden of network transmission and reducing the probability of network delay and packet loss.

2)降低网络延迟:批量上传可以在一定程度上降低网络延迟。如果每个数据都要单独上传,那么每个请求都需要建立一次连接,这会增加网络延迟。而批量上传只需要建立一次连接,然后发送多个数据,这样可以大大减少网络延迟。2) Reduce network latency: Batch uploading can reduce network latency to a certain extent. If each data is uploaded separately, each request needs to establish a connection, which will increase network latency. Batch uploading only requires establishing a connection once and then sending multiple data, which can greatly reduce network latency.

3)重试机制:批量上传还可以实现重试机制,即在上传过程中出现错误时可以重新尝试上传。如果是单个数据上传,上传失败就需要重新建立连接再次上传,这会增加网络负担和延迟。而批量上传可以通过重试机制,只需要重新上传失败的数据,减少了网络负担和延迟。3) Retry mechanism: Batch upload can also implement a retry mechanism, that is, you can retry uploading when an error occurs during the upload process. If it is a single data upload, if the upload fails, you need to re-establish the connection and upload again, which will increase the network burden and delay. Batch upload can use the retry mechanism, and only the failed data needs to be re-uploaded, reducing the network burden and delay.

但通常情况下,考虑到以下情况,默认不使用批量发送的方式发送前端数据:But usually, considering the following situations, batch sending is not used by default to send front-end data:

1)实时性要求:某些业务场景对数据的实时性要求较高,需要立即将数据发送到服务器进行处理和分析。如果采用批量发送的方式发送,会产生一定的延迟,无法满足实时性要求。1) Real-time requirements: Some business scenarios have high real-time requirements for data, and need to send data to the server immediately for processing and analysis. If it is sent in batches, there will be a certain delay, which cannot meet the real-time requirements.

2)数据准确性:如果将多个数据打包成一个批次发送,当发送过程中发生错误或中断时,可能导致整个批次数据丢失。而使用单独发送的方式,可以保证每个数据都能独立发送,降低数据丢失的风险。2) Data accuracy: If multiple data are packaged into a batch and sent, when an error or interruption occurs during the sending process, the entire batch of data may be lost. Using the separate sending method can ensure that each data can be sent independently, reducing the risk of data loss.

3)网络传输成本:批量发送可以减少网络传输的次数和数据量,从而降低网络传输的成本。然而,在一些场景下,数据量较小或者网络传输成本相对较低,批量发送并不能显著降低成本,反而增加了数据处理和解析的复杂性。3) Network transmission cost: Batch transmission can reduce the number of network transmissions and the amount of data, thereby reducing the cost of network transmission. However, in some scenarios, the amount of data is small or the network transmission cost is relatively low, and batch transmission cannot significantly reduce the cost, but increases the complexity of data processing and analysis.

尽管默认情况下不使用批量发送,但埋点SDK通常会提供相应的配置选项,允许根据业务需求自定义批量发送策略,这样可以灵活地根据具体场景和需求来选择合适的发送方式。Although batch sending is not used by default, the tracking SDK usually provides corresponding configuration options, allowing you to customize the batch sending strategy according to business needs, so that you can flexibly choose the appropriate sending method according to specific scenarios and needs.

在以下情况下,可采用定时发送或批量发送的非实时发送的方式发送前端数据:In the following cases, the front-end data can be sent in a non-real-time manner by scheduled sending or batch sending:

1)数据量较大:当需要采集的数据量很大时,为了减少网络传输的压力,可以选择定量发送的发送方式。例如,一些日志系统或监控系统需要采集大量的日志数据或指标数据,此时可以将这些数据(即采集的前端数据)按照一定的数量进行批量发送,以降低网络传输的次数和数据量。1) Large amount of data: When the amount of data to be collected is large, in order to reduce the pressure of network transmission, you can choose to send it in a quantitative manner. For example, some log systems or monitoring systems need to collect a large amount of log data or indicator data. At this time, these data (i.e. the collected front-end data) can be sent in batches according to a certain amount to reduce the number of network transmissions and the amount of data.

2)网络传输成本高:在一些网络环境下,网络传输成本较高,如移动网络或海外访问等,采用批量发送的方式发送前端数据可以降低网络传输的频率和数据量,从而减少网络传输的成本。2) High network transmission cost: In some network environments, the network transmission cost is high, such as mobile networks or overseas access. Sending front-end data in batches can reduce the frequency and amount of network transmission, thereby reducing the cost of network transmission.

3)需要优化性能:有些业务场景对性能要求较高,即时的数据传输会对系统的性能产生较大影响,此时可以采用定时发送或者批量发送的方式,即先将采集的前端数据缓存起来,然后在适当的时机发送,以减少对系统性能的影响。可选地,在前端数据发送成功再会删除缓存的前端数据,以保证所有的前端数据均能成功发送。3) Need to optimize performance: Some business scenarios have high performance requirements. Real-time data transmission will have a greater impact on system performance. In this case, you can use scheduled or batch sending, that is, cache the collected front-end data first, and then send it at an appropriate time to reduce the impact on system performance. Optionally, the cached front-end data will be deleted after the front-end data is successfully sent to ensure that all front-end data can be successfully sent.

综上,批量上传可以提高数据传输的稳定性,降低网络负担和延迟,减少网络丢包的概率,因此,在对于数据传输稳定性要求较高的场景下,可选择批量发送的方式进行前端数据的上传。In summary, batch uploading can improve the stability of data transmission, reduce network burden and latency, and reduce the probability of network packet loss. Therefore, in scenarios where high requirements for data transmission stability are required, batch sending can be selected to upload front-end data.

上面介绍了非实时发送的方式,下面将对实时发送的方式进行介绍:The above describes the non-real-time sending method. The following describes the real-time sending method:

本申请实施例中,在以实时发送的方式将采集的前端数据实时向服务器发送时,可将采集到的前端数据(或将封装成预设的数据结构后)按顺序存储进发送队列中,并按先进先出的方式,采用异步发送的方式发送该发送队列中的前端数据。该异步发送的方式是指:在将前端数据添加到发送队列后,可以继续执行其他操作而无需等待发送过程完成。In the embodiment of the present application, when the collected front-end data is sent to the server in real time in real time, the collected front-end data (or after being encapsulated into a preset data structure) can be stored in a sending queue in order, and the front-end data in the sending queue can be sent in an asynchronous sending manner in a first-in-first-out manner. The asynchronous sending manner means that after the front-end data is added to the sending queue, other operations can be continued without waiting for the sending process to be completed.

使用异步方式发送前端数据的好处有以下几个方面:The benefits of using asynchronous mode to send front-end data are as follows:

1)提高性能和响应速度:异步方式允许程序在请求发送的同时执行其他操作,避免了请求阻塞,提高了整体性能和响应速度。1) Improve performance and response speed: The asynchronous method allows the program to perform other operations while the request is being sent, avoiding request blocking and improving overall performance and response speed.

2)改善用户体验:使用异步方式可以确保用户界面的流畅性,用户不会因为请求而感觉到卡顿或延迟。2) Improve user experience: Using asynchronous methods can ensure the smoothness of the user interface, and users will not feel any lag or delay due to requests.

3)提高并发性能:异步方式允许同时发送多个请求,提高并发性能,特别是在处理大量请求时效果更为明显。3) Improve concurrency performance: The asynchronous method allows multiple requests to be sent simultaneously, improving concurrency performance, especially when processing a large number of requests.

4)避免阻塞其他操作:使用异步方式可以避免请求的阻塞影响其他操作,提高程序的灵活性和可扩展性。4) Avoid blocking other operations: Using asynchronous methods can avoid blocking requests and affecting other operations, thereby improving the flexibility and scalability of the program.

在一些实施例中,在前端数据发送过程中出现错误时,埋点SDK负责处理错误并执行重试机制,以确保前端数据的可靠传输。其中,处理错误包括记录发送失败的事件、记录错误日志等操作。In some embodiments, when an error occurs during the front-end data transmission process, the tracking SDK is responsible for handling the error and executing a retry mechanism to ensure reliable transmission of the front-end data. Among them, handling errors includes recording the event of failed transmission, recording error logs, and other operations.

为了更清楚地描述本申请实施例提供的埋点SDK收集前端数据的过程,下面结合图2和图3进行描述。In order to more clearly describe the process of collecting front-end data by the tracking SDK provided in the embodiment of the present application, a description is given below in combination with Figures 2 and 3.

其中,图2示出了埋点SDK的结构示意图,图3示出了该埋点SDK收集前端数据的流程示意图。Among them, Figure 2 shows a structural diagram of the tracking SDK, and Figure 3 shows a flow diagram of the tracking SDK collecting front-end data.

在图2中,本申请实施例提供的埋点SDK包括初始化模块、数据采集模块、数据存储模块、数据发送模块和日志模块。其中,初始化模块包括SDK鉴权单元,数据采集模块包括预置属性单元和非预置属性单元,数据存储模块包括发送队列、缓存单元,数据发送模块包括实时发送单元和非实时发送单元。In Figure 2, the tracking SDK provided by the embodiment of the present application includes an initialization module, a data acquisition module, a data storage module, a data sending module and a log module. Among them, the initialization module includes an SDK authentication unit, the data acquisition module includes a preset attribute unit and a non-preset attribute unit, the data storage module includes a sending queue and a cache unit, and the data sending module includes a real-time sending unit and a non-real-time sending unit.

结合图3可知,当检测到目标应用启动后,埋点SDK将进行初始化,如初始化模块的SDK鉴权单元将对目标应用进行身份验证等,在目标应用的身份验证通过后,非预置属性单元调用与目标事件对应的封装函数进行前端数据的采集,和/或,预置属性单元调用预置属性函数采集目标应用所在的设备的网页信息。若采用实时发送的方式,则上述非预置属性单元和/或预置属性单元将采集的前端数据和/或网页信息存储到数据存储模块的发送队列中,而若采用非实时发送的方式,则上述非预置属性单元和/或预置属性单元将采集的前端数据和/或网页信息存储到数据存储模块的缓存单元中。之后,数据发送模块再选择实时发送单元将发送队列存储的前端数据向服务器发送,或者,选择非实时发送单元将网页信息向服务器发送。当埋点数据在采集或发送过程中发送错误,则通过日志模块进行记录,其中,该埋点数据包括前端数据和网页信息。As shown in FIG3, when the target application is detected to be started, the embedding SDK will be initialized, such as the SDK authentication unit of the initialization module will authenticate the target application, etc. After the identity authentication of the target application is passed, the non-preset attribute unit calls the encapsulation function corresponding to the target event to collect the front-end data, and/or the preset attribute unit calls the preset attribute function to collect the web page information of the device where the target application is located. If the real-time transmission method is adopted, the above-mentioned non-preset attribute unit and/or the preset attribute unit will store the collected front-end data and/or web page information in the transmission queue of the data storage module, and if the non-real-time transmission method is adopted, the above-mentioned non-preset attribute unit and/or the preset attribute unit will store the collected front-end data and/or web page information in the cache unit of the data storage module. Afterwards, the data sending module selects the real-time sending unit to send the front-end data stored in the sending queue to the server, or selects the non-real-time sending unit to send the web page information to the server. When the embedding data is sent in error during the collection or transmission process, it is recorded through the log module, wherein the embedding data includes the front-end data and web page information.

应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

对应于上文实施例的前端数据收集方法,图4示出了本申请实施例提供的一种前端数据收集装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the front-end data collection method of the above embodiment, FIG4 shows a structural block diagram of a front-end data collection device provided in an embodiment of the present application. For ease of explanation, only the part related to the embodiment of the present application is shown.

参照图4,该前端数据收集装置4包括:事件监听模块41、前端数据采集模块42、前端数据发送模块43。其中:4 , the front-end data collection device 4 includes: an event monitoring module 41, a front-end data acquisition module 42, and a front-end data sending module 43. Among them:

事件监听模块41,用于监听目标应用的当前事件,目标应用为存在埋点SDK的应用。The event monitoring module 41 is used to monitor the current events of the target application, and the target application is an application with a tracking SDK.

前端数据采集模块42,用于在当前事件为目标事件的情况下,调用与目标事件对应的封装函数进行前端数据的采集,封装函数为预先封装的用于采集目标事件对应的前端数据的函数。The front-end data collection module 42 is used to call the encapsulation function corresponding to the target event to collect the front-end data when the current event is a target event. The encapsulation function is a pre-encapsulated function for collecting the front-end data corresponding to the target event.

前端数据发送模块43,用于将前端数据向服务器发送。The front-end data sending module 43 is used to send the front-end data to the server.

本申请实施例中,在判断出监听的当前事件为目标事件的情况下,调用与目标事件对应的封装函数采集前端数据,并将采集的前端数据向服务器发送。由于封装函数为预先封装的用于采集目标事件的前端数据的函数,因此,在需要采集与该目标事件对应的前端数据时只需要调用对应的封装函数即可,无需重新编写用于采集该前端数据的函数,即,无需在采集每一种用户前端数据时均进行一次代码的开发,从而提高了开发效率以及提高了采集到前端数据的及时性。In the embodiment of the present application, when it is determined that the current event being monitored is a target event, the encapsulation function corresponding to the target event is called to collect the front-end data, and the collected front-end data is sent to the server. Since the encapsulation function is a pre-encapsulated function for collecting the front-end data of the target event, when it is necessary to collect the front-end data corresponding to the target event, it is only necessary to call the corresponding encapsulation function, without rewriting the function for collecting the front-end data, that is, there is no need to develop a code once when collecting each type of user front-end data, thereby improving the development efficiency and the timeliness of collecting the front-end data.

在一些实施例中,前端数据采集模块42在调用与目标事件对应的封装函数进行前端数据的采集时,具体用于:In some embodiments, when the front-end data collection module 42 calls the encapsulation function corresponding to the target event to collect the front-end data, it is specifically used to:

对前端数据进行校验,并在前端数据校验通过的情况下调用与目标事件对应的封装函数进行前端数据的采集。Verify the front-end data, and if the front-end data verification passes, call the encapsulation function corresponding to the target event to collect the front-end data.

在一些实施例中,本申请实施例提供的前端数据收集装置4还包括:In some embodiments, the front-end data collection device 4 provided in the embodiment of the present application further includes:

校验信息定义模块,用于在对前端数据进行校验之前,在埋点SDK中进行校验信息的定义,校验信息包括事件类型。The verification information definition module is used to define verification information in the tracking SDK before verifying the front-end data. The verification information includes the event type.

对应地,上述前端数据采集模块42在对前端数据进行校验时包括:Correspondingly, the front-end data acquisition module 42 includes:

将前端数据与事件类型进行匹配,在匹配成功后判定前端数据的校验通过。The front-end data is matched with the event type, and after the match is successful, it is determined that the verification of the front-end data has passed.

在一些实施例中,本申请实施例提供的前端数据收集装置4,还包括:In some embodiments, the front-end data collection device 4 provided in the embodiment of the present application further includes:

错误信息获取模块,用于在前端数据校验未通过的情况下,调用预先封装的错误日志埋点函数获取校验未通过的前端数据的错误信息。The error information acquisition module is used to call the pre-packaged error log tracking function to obtain the error information of the front-end data that failed the verification when the front-end data verification fails.

在一些实施例中,校验信息还包括身份信息,本申请实施例提供的前端数据收集装置4,还包括:In some embodiments, the verification information also includes identity information. The front-end data collection device 4 provided in the embodiment of the present application also includes:

初始化模块,用于在监听目标应用的目标事件之前,在目标应用启动时,初始化埋点SDK,初始化埋点SDK包括:将目标应用的标识与身份信息比较,根据比较结果判断目标应用是否通过身份校验。The initialization module is used to initialize the tracking SDK when the target application is started before monitoring the target event of the target application. Initializing the tracking SDK includes: comparing the identifier of the target application with the identity information, and judging whether the target application passes the identity verification based on the comparison result.

在一些实施例中,本申请实施例提供的前端数据收集装置4,还包括:In some embodiments, the front-end data collection device 4 provided in the embodiment of the present application further includes:

网页信息获取模块,用于调用预置属性函数采集目标应用所在的设备的网页信息。The web page information acquisition module is used to call a preset attribute function to collect the web page information of the device where the target application is located.

网页信息发送模块,用于将网页信息向服务器发送。The web page information sending module is used to send the web page information to the server.

在一些实施例中,上述前端数据发送模块43具体用于:In some embodiments, the front-end data sending module 43 is specifically used for:

将前端数据以批量发送的方式或者以实时发送的方式向服务器发送。The front-end data is sent to the server in batches or in real time.

需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。It should be noted that the information interaction, execution process, etc. between the above-mentioned devices/units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

图5为本申请一实施例提供的电子设备的结构示意图。如图5所示,该实施例的电子设备5包括:至少一个处理器50(图5中仅示出一个处理器)、存储器51以及存储在所述存储器51中并可在所述至少一个处理器50上运行的计算机程序52,所述处理器50执行所述计算机程序52时实现上述任意各个方法实施例中的步骤。FIG5 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. As shown in FIG5 , the electronic device 5 of this embodiment includes: at least one processor 50 (only one processor is shown in FIG5 ), a memory 51, and a computer program 52 stored in the memory 51 and executable on the at least one processor 50, and when the processor 50 executes the computer program 52, the steps in any of the above-mentioned method embodiments are implemented.

所述电子设备5可以是机器人、桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该电子设备可包括,但不仅限于,处理器50、存储器51。本领域技术人员可以理解,图5仅仅是电子设备5的举例,并不构成对电子设备5的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如还可以包括输入输出设备、网络接入设备等。The electronic device 5 may be a computing device such as a robot, a desktop computer, a notebook, a PDA, and a cloud server. The electronic device may include, but is not limited to, a processor 50 and a memory 51. Those skilled in the art will appreciate that FIG. 5 is merely an example of the electronic device 5 and does not constitute a limitation on the electronic device 5. The electronic device 5 may include more or fewer components than shown in the figure, or may combine certain components, or different components, and may also include, for example, input and output devices, network access devices, etc.

所称处理器50可以是中央处理单元(Central Processing Unit,CPU),该处理器50还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor 50 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

所述存储器51在一些实施例中可以是所述电子设备5的内部存储单元,例如电子设备5的硬盘或内存。所述存储器51在另一些实施例中也可以是所述电子设备5的外部存储设备,例如所述电子设备5上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器51还可以既包括所述电子设备5的内部存储单元也包括外部存储设备。所述存储器51用于存储操作系统、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如所述计算机程序的程序代码等。所述存储器51还可以用于暂时地存储已经输出或者将要输出的数据。In some embodiments, the memory 51 may be an internal storage unit of the electronic device 5, such as a hard disk or memory of the electronic device 5. In other embodiments, the memory 51 may also be an external storage device of the electronic device 5, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 5. Further, the memory 51 may also include both an internal storage unit of the electronic device 5 and an external storage device. The memory 51 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 51 may also be used to temporarily store data that has been output or is to be output.

所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

本申请实施例还提供了一种网络设备,该网络设备包括:至少一个处理器、存储器以及存储在所述存储器中并可在所述至少一个处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述任意各个方法实施例中的步骤。An embodiment of the present application also provides a network device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor implements the steps in any of the above-mentioned method embodiments when executing the computer program.

本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时可实现上述各个方法实施例中的步骤。An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

本申请实施例提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行时可实现上述各个方法实施例中的步骤。An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/电子设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,RandomAccess Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera/electronic device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

在本申请所提供的实施例中,应该理解到,所揭露的装置/网络设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/网络设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in the present application, it should be understood that the disclosed devices/network equipment and methods can be implemented in other ways. For example, the device/network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims (10)

Translated fromChinese
1.一种前端数据收集方法,其特征在于,应用于埋点SDK,包括:1. A front-end data collection method, characterized in that it is applied to a tracking SDK, comprising:监听目标应用的当前事件,所述目标应用为存在埋点SDK的应用;Monitor the current events of the target application, where the target application is an application with a tracking SDK;在所述当前事件为目标事件的情况下,调用与所述目标事件对应的封装函数进行前端数据的采集,所述封装函数为预先封装的用于采集所述目标事件对应的前端数据的函数;In the case where the current event is a target event, calling a package function corresponding to the target event to collect front-end data, the package function being a pre-packaged function for collecting front-end data corresponding to the target event;将所述前端数据向服务器发送。The front-end data is sent to the server.2.如权利要求1所述的前端数据收集方法,其特征在于,所述调用与所述目标事件对应的封装函数进行前端数据的采集,包括:2. The front-end data collection method according to claim 1, wherein the calling of the encapsulation function corresponding to the target event to collect the front-end data comprises:对所述前端数据进行校验,并在所述前端数据校验通过的情况下调用与所述目标事件对应的封装函数进行前端数据的采集。The front-end data is verified, and when the front-end data passes the verification, a packaging function corresponding to the target event is called to collect the front-end data.3.如权利要求2所述的前端数据收集方法,其特征在于,在所述对所述前端数据进行校验之前,还包括:3. The front-end data collection method according to claim 2, characterized in that before verifying the front-end data, it also includes:在所述埋点SDK中进行校验信息的定义,所述校验信息包括事件类型;Defining verification information in the tracking SDK, wherein the verification information includes an event type;所述对所述前端数据进行校验,包括:The verifying the front-end data includes:将所述前端数据与所述事件类型进行匹配,在匹配成功后判定所述前端数据的校验通过。The front-end data is matched with the event type, and after the match is successful, it is determined that the verification of the front-end data has passed.4.如权利要求2所述的前端数据收集方法,其特征在于,还包括:4. The front-end data collection method according to claim 2, further comprising:在所述前端数据校验未通过的情况下,调用预先封装的错误日志埋点函数获取校验未通过的所述前端数据的错误信息。In the case where the front-end data verification fails, a pre-packaged error log burial function is called to obtain error information of the front-end data that failed the verification.5.如权利要求3所述的前端数据收集方法,其特征在于,所述校验信息还包括身份信息,在所述监听目标应用的目标事件之前,还包括:5. The front-end data collection method according to claim 3, wherein the verification information further includes identity information, and before monitoring the target event of the target application, further includes:在所述目标应用启动时,初始化所述埋点SDK,所述初始化所述埋点SDK包括:将所述目标应用的标识与所述身份信息比较,根据比较结果判断所述目标应用是否通过身份校验。When the target application is started, the tracking SDK is initialized, and the initialization of the tracking SDK includes: comparing the identifier of the target application with the identity information, and judging whether the target application passes the identity verification according to the comparison result.6.如权利要求1至5任一项所述的前端数据收集方法,其特征在于,还包括:6. The front-end data collection method according to any one of claims 1 to 5, further comprising:调用预置属性函数采集所述目标应用所在的设备的网页信息;Calling a preset attribute function to collect web page information of the device where the target application is located;将所述网页信息向所述服务器发送。Send the web page information to the server.7.如权利要求6所述的前端数据收集方法,其特征在于,所述将所述前端数据向服务器发送,包括:7. The front-end data collection method according to claim 6, wherein sending the front-end data to the server comprises:将所述前端数据以批量发送的方式或者以实时发送的方式向所述服务器发送。The front-end data is sent to the server in batches or in real time.8.一种前端数据收集装置,其特征在于,包括:8. A front-end data collection device, comprising:事件监听模块,用于监听目标应用的当前事件,所述目标应用为存在埋点SDK的应用;An event monitoring module is used to monitor the current events of the target application, where the target application is an application for which a tracking SDK is available;前端数据采集模块,用于在所述当前事件为目标事件的情况下,调用与所述目标事件对应的封装函数进行前端数据的采集,所述封装函数为预先封装的用于采集所述目标事件对应的前端数据的函数;A front-end data collection module, used for, when the current event is a target event, calling a package function corresponding to the target event to collect front-end data, wherein the package function is a pre-packaged function for collecting front-end data corresponding to the target event;前端数据发送模块,用于将所述前端数据向服务器发送。The front-end data sending module is used to send the front-end data to the server.9.一种电子设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至7任一项所述的方法。9. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.10.一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的方法。10. A computer-readable storage medium storing a computer program, wherein the computer program implements the method according to any one of claims 1 to 7 when executed by a processor.
CN202410114398.5A2024-01-252024-01-25Front-end data collection method and device and electronic equipmentPendingCN117931576A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202410114398.5ACN117931576A (en)2024-01-252024-01-25Front-end data collection method and device and electronic equipment

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202410114398.5ACN117931576A (en)2024-01-252024-01-25Front-end data collection method and device and electronic equipment

Publications (1)

Publication NumberPublication Date
CN117931576Atrue CN117931576A (en)2024-04-26

Family

ID=90768194

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202410114398.5APendingCN117931576A (en)2024-01-252024-01-25Front-end data collection method and device and electronic equipment

Country Status (1)

CountryLink
CN (1)CN117931576A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN118227202A (en)*2024-05-212024-06-21中邮消费金融有限公司Buried data processing method, buried data processing device, buried data processing equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN118227202A (en)*2024-05-212024-06-21中邮消费金融有限公司Buried data processing method, buried data processing device, buried data processing equipment and storage medium

Similar Documents

PublicationPublication DateTitle
US11558273B2 (en)Communication between independent containers
CN111813629B (en)Method, device and equipment for generating monitoring data of Web page
WO2021042849A1 (en)Cloud platform, service processing method, command interface and computer device
CN114020403B (en) A chain code management method, device and terminal device of alliance chain
CN111858727A (en) A system and method for exporting data from multiple data sources based on template configuration
CN110045952B (en)Code calling method and device
CN114422564A (en)Audit tracing method and device for access data, computer equipment and storage medium
CN114579194A (en)Spring remote call-based exception handling method and system
CN117931576A (en)Front-end data collection method and device and electronic equipment
CN111381989B (en)Micro service link generation method, device, server and storage medium
CN118689529B (en) A method, system, device and medium for configuring parameters of application services
CN112580086B (en) Configuration file access protection method, device, equipment and storage medium
CN111722994A (en) A method and device for responding to a task request
WO2024032209A1 (en)Block chain transaction verification method and apparatus, storage medium, and electronic device
CN115460293A (en) Data processing method, data interaction system, electronic device and storage medium
CN114416781A (en)Data searching method and device, electronic equipment and storage medium
CN111444161A (en)Data processing method and device, electronic equipment and storage medium
CN116820906B (en)Data embedding method and device for client and storage medium
CN115129544B (en) A method, system, device and storage medium for obtaining RAID logs out of band with one key
CN113608791B (en) Program operation control method, terminal device and computer readable storage medium
CN116302981A (en) Interface pressure testing method, device and storage medium
CN117573239A (en) Interface calling methods, devices and electronic devices
CN116361135A (en)Method for recording operation log, computer device and storage medium
CN114880144A (en) Page data processing method, apparatus, computer equipment and storage medium
WO2023201648A1 (en)File operation apparatus, computer device and operation device

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp