Client data embedding method, device and storage medium
Through the customized method of generating, storing and reporting hidden data, the problem of high cost and low efficiency of client data is solved, flexible and efficient data processing and analysis is realized, and the flexibility and security of the system are enhanced.
Patent Information
- Application Number
- CN202310774233.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-28
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-06-28
AI Technical Summary
In the existing technology, the client data burying solution is costly and inefficient. It requires a lot of time, money and manpower to build a complete framework system, and there are problems with communication costs and external dependence.
By responding to preset business events, the event name and event attributes are used to generate a buried data collection, and stored in a predetermined data structure, converted into key-value pairs, and customized data is spliced with original data to meet the storage conditions of the local database. When the request is made, it is reported to the server through an HTTP request, using a customized URL and request method.
It reduces the cost of data burying on the client side, improves the efficiency of data burying, enables flexible data processing and analysis, and enhances the flexibility and security of the system.
Smart Images

Figure CN116820906B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device and storage medium for data embedding on a client. Background Art
[0002] In the current commercial application (App) development, data tracking has become a basic requirement. By recording and reporting data during user interactions, key information can be provided for subsequent commercial data analysis. These interactions may include but are not limited to various user gestures, such as sliding, clicking / double-clicking a control, and users entering a new page. At the same time, the data that needs to be recorded includes but is not limited to the control information when the interaction occurs, the corresponding business data, App device information, App status information (such as network status), etc.
[0003] At present, there are two common solutions to deal with this demand. One is to use commercial tracking products that are already available on the market. Such products have complete functions and can save developers a lot of time. However, such products are not completely free. Their data analysis functions need to be paid for, and the user's server backend must be connected to the backend provided by the product. In addition, in the process of converting business needs into data analysis, there are many factors involved, and there are a lot of communication costs.
[0004] Another solution is to develop a tracking solution independently. The advantage of this solution is that the company can customize all data formats and business logic of behavior analysis without considering the cost of external communication, and the solution formulation process is fast and efficient. However, the disadvantage of developing a tracking solution independently is that it requires a lot of time, money and manpower to build a complete framework system. For example, to implement the tracking code of the client, it is necessary to implement local data storage, real-time reporting and non-real-time reporting, as well as collect all types of user interaction data as much as possible. At the same time, it is also necessary to implement other functions, such as data encryption and verification, which requires a lot of resources. Summary of the invention
[0005] In view of this, an embodiment of the present application provides a data embedding method, device and storage medium for a client to solve the problems of high cost and low efficiency of data embedding solutions in the prior art.
[0006] According to a first aspect of an embodiment of the present application, a data tracking method for a client is provided, comprising: in response to a preset business event, generating a tracking data set using an event name and event attributes; obtaining tracking data for reporting, and storing the tracking data set and the tracking data in a predetermined data storage structure, wherein the tracking data includes original data and custom data; converting the data storage structure into a key-value pair, splicing the custom data with the original data by adding a key-value pair or a custom node, and converting the spliced key-value pair into a string and storing it in a local database; when the tracking data stored in the local database meets a preset condition, generating a network request class object, setting the server request URL of the network request class object to a custom URL, setting the request method of the network request class object to a custom request method, setting the request accompanying data of the network request class object to custom data, and reporting the tracking data to the server via an HTTP request.
[0007] According to a second aspect of an embodiment of the present application, a data tracking device of a client is provided, including: a generation module, configured to generate a tracking data set using an event name and event attributes in response to a preset business event; a storage module, configured to obtain tracking data for reporting, and store the tracking data set and the tracking data in a predetermined data storage structure, wherein the tracking data includes original data and custom data; a splicing module, configured to convert the data storage structure into a key-value pair, splice the custom data with the original data by adding a key-value pair or a custom node, and convert the spliced key-value pair into a string and store it in a local database; a reporting module, configured to generate a network request class object when the tracking data stored in the local database meets a preset condition, set the server request URL of the network request class object to a custom URL, set the request method of the network request class object to a custom request method, set the request accompanying data of the network request class object to custom data, and report the tracking data to the server via an HTTP request.
[0008] According to a third aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the above method are implemented.
[0009] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0010] By responding to the occurrence of a preset business event, using the event name and event attributes to generate a point-of-sale data set; obtaining the point-of-sale data for reporting, storing the point-of-sale data set and the point-of-sale data in a predetermined data storage structure, wherein the point-of-sale data includes original data and custom data; converting the data storage structure into a key-value pair, splicing the custom data with the original data by adding a key-value pair or a custom node, and converting the spliced key-value pair into a string and storing it in a local database; when the point-of-sale data stored in the local database meets the preset conditions, generating a network request class object, setting the server request URL of the network request class object to a custom URL, setting the request method of the network request class object to a custom request method, setting the request accompanying data of the network request class object to custom data, and reporting the point-of-sale data to the server via an HTTP request. This application reduces the cost of client data point-of-sale and improves the efficiency of client data point-of-sale. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] 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 will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0012] Figure 1 It is a flowchart of the data embedding method of the client provided in the embodiment of the present application;
[0013] Figure 2 It is a structural diagram of a data embedding device of a client provided in an embodiment of the present application;
[0014] Figure 3 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0015] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.
[0016] It should be understood that the various steps described in the method implementation of the present application can be performed in different orders and / or performed in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.
[0017] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0018] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0019] The following will describe in detail a data embedding method, device and storage medium for a client according to an embodiment of the present application in conjunction with the accompanying drawings.
[0020] Figure 1 It is a flow chart of the data tracking method for the client provided in an embodiment of the present application. Figure 1 The client data tracking method can be executed by the application. Figure 1 As shown, the data tracking method of the client may specifically include:
[0021] S101, in response to a preset business event occurring, generating a set of buried data using an event name and event attributes;
[0022] S102, acquiring buried point data for reporting, and storing the buried point data set and the buried point data in a predetermined data storage structure, wherein the buried point data includes original data and custom data;
[0023] S103, converting the data storage structure into a key-value pair, concatenating the custom data with the original data by adding the key-value pair or the custom node, and converting the concatenated key-value pair into a string and storing it in a local database;
[0024] S104, when the tracking data stored in the local database reaches the preset conditions, a network request class object is generated, the server request URL of the network request class object is set to a custom URL, the request method of the network request class object is set to a custom request method, the request accompanying data of the network request class object is set to custom data, and the tracking data is reported to the server through an HTTP request.
[0025] In some embodiments, in response to the occurrence of a preset business event, a set of buried data is generated using the event name and event attributes, including: when a business event occurs, calling a preset event attribute tracking method, passing the event name and event attributes as parameters to the event attribute tracking method; creating an event attribute management object in the event attribute tracking method, assigning the event name to the first attribute of the event attribute management object, and assigning the event attributes to the second attribute of the event attribute management object; generating a set of buried data using the value of the first attribute and the value of the second attribute, and combining the buried data as a record attribute of the event attribute management object.
[0026] Specifically, the implementation method of the business tracking point of the embodiment of the present application is mainly used to respond to preset business events. This method mainly involves generating a tracking point data set using event names and event attributes, and the main steps are as follows:
[0027] When a business event occurs, such as a user completing a shopping behavior, the preset event attribute tracking method is called. This method requires two parameters: event name and event attributes. In an example, the event name may be "shopping", and the event attributes may include the purchased goods, quantity, total price, etc.
[0028] In the event attribute tracking method, an event attribute management object is created, an event name is assigned to the first attribute of the event attribute management object, and an event attribute is assigned to the second attribute of the event attribute management object. In this embodiment, the event attribute management object can be an instance of the SAFlowData class.
[0029] The value of the first attribute and the value of the second attribute are used to generate a set of buried point data. This set is assigned to the record attribute of the event attribute management object. The record attribute here can be a dictionary type data that stores the event name and event attributes.
[0030] In order to perform active tracking, when a business event occurs, call the function (i.e. the track:withProperties: method of the SensorsAnalyticsSDK class instance). This method receives two parameters, the event name and the event attributes, and creates an event attribute management object internally and assigns values to it.
[0031] When performing active tracking, if the App previously used the unmodified source code, and now the tracking solution has been modified, you can import the modified source code according to this solution into the project, and do not need to modify the tracking code in various places in the project. Conversely, if the modified source code was used before, now replace it with the unmodified source code to use the default function, and do not need to modify the tracking code in various places in the project.
[0032] Optionally, the specific steps for adding event names and event attributes to tracking data are as follows:
[0033] When calling the track:withProperties: method, the event name will be assigned to the eventId attribute of the eventObject object of the SAFlowData class object, so the value of this attribute is directly obtained and used as the value corresponding to the event_name key of the dictionary.
[0034] In the call to the track:withProperties: method, the properties of the event are assigned to the properties attribute of the SAFlowData class object, which is a dictionary, so it is taken out and the addEntriesFromDictionary: method provided by the iOS system is called to add it to the dictionary.
[0035] Therefore, according to the technical solution of the above embodiment, the process of active tracking may include the following contents:
[0036] When a business event occurs, the developer calls the track:withProperties: method (i.e., the event attribute tracking method) and passes the event name and event attributes as parameters.
[0037] This method creates a SAFlowData object (i.e., event attribute management object), assigns the event name to the eventId attribute of the object (i.e., the first attribute), and assigns the event attributes to the properties attribute of the object (i.e., the second attribute).
[0038] Then, this information is combined into a data structure called dictionary (i.e., a collection of buried point data) and used as the record attribute (i.e., record attribute) of the SAFlowData object.
[0039] For the event name, you can directly get the value of the eventId attribute and use it as the value corresponding to the event_name key in the dictionary.
[0040] For event attributes, since it is a dictionary, you can directly retrieve it and then use the addEntriesFromDictionary: method to add it to the dictionary.
[0041] In some embodiments, the buried point data for reporting is obtained, and the buried point data set and the buried point data are stored in a predetermined data storage structure, including: creating a data storage structure, the data storage structure uses a dictionary or a class instance; obtaining the preset buried point data from the attribute set of the basic event object class of the application, and obtaining the geographic location information from the instance of the module manager class, and storing the buried point data set, the buried point data and the geographic location information in the data storage structure.
[0042] Specifically, the embodiment of the present application also discloses a method for obtaining reported buried point data and storing the data in a predetermined data structure. In practical applications, the method may specifically include the following steps:
[0043] The first step is to create a data storage structure. In the embodiment of the present application, the data storage structure can use a dictionary (NSDictionary) or a class (NSObject) instance, depending on the specific implementation requirements and preferences. The dictionary storage structure stores data in the form of key-value pairs, which is easy to operate and query, while the class instance allows more complex data structures and methods.
[0044] The second step is to obtain the preset tracking data from the attribute set of the basic event object class of the application, such as the SABaseEventObject class. In the known implementation, the collected data, such as the device ID (platform_ID), device system version (os_version), application name (app_name), application version (app_version), event trigger time (event_time) and other information, are stored in the properties of the class. The required data can be obtained through the corresponding key-value pairs.
[0045] The third step is to obtain geographic location information from an instance of the module manager class (such as the SAModuleManager class). First, call the enableTrackGPSLoc ation: method through the SensorsAnalyticsSDK singleton object to start obtaining positioning information at the beginning of the program startup. When the positioning information is successfully obtained, it is stored in the properties attribute of the SAModuleManager class, which is a dictionary called locationData. Then, you can also obtain geographic location information such as province, city, city_area, longitude, and latitude through dictionary key-value pairs.
[0046] The fourth step is to store the above-obtained point data set, point data and geographic location information in the data storage structure created above. If the data to be stored is not collected, it is necessary to write additional code to obtain this part of the data when the business logic is executed to the corresponding position, and store it in the data storage structure.
[0047] The following is a description of the data content required for the customized client point reporting in the embodiment of the present application. As shown in Table 1, the data content required for the client point reporting includes:
[0048] Table 1 Data content required for client tracking report
[0049] Property Name Attribute English name User ID user_id province province City city Urban area city_area longitude longitude latitude latitude VIN Number vehicle_code Car series / model project vehicle_brand Model vehicle_mode Device Type platform Device ID platform_ID Device system version os_version Application Name app_name Application package name app_package Application version app_version Event trigger time event_time Data upload time report_time Event Name event_name User's mobile phone number phone_num
[0050] Furthermore, before introducing the method for local storage of the data burying point in the embodiment of the present application, the structure and principle of the existing data burying point system are described in detail, which may specifically include the following contents:
[0051] The execution logic of the data point system is carried out using a "node" architecture, that is, each execution step is an independent class, including: obtaining remote / local configuration, collecting and reporting data, verification, encryption, storing data locally, retrieving data, decryption, reporting, etc. These nodes are stored in sequence using a configuration file. The embodiment of the present application can modify this configuration file to add or delete nodes, thereby adding the logic of the embodiment of the present application with as little modification as possible to the data source code.
[0052] In the configuration file provided in this application, the structure is divided into three layers: flow (task flow) -> task (task) -> nodes (task nodes); there are multiple tasks under one flow, and multiple nodes under one task. There are 2 flows in the data, namely the flow that stores data and reports, and the flow that only retrieves data and reports. The flow that stores data and reports has 4 tasks under it, and the flow that only retrieves data and reports has 2 tasks under it. As the name implies, the flow that stores data and reports can store buried data and report it on demand, and the flow that only retrieves data and reports is only responsible for retrieving data and reporting. The second flow is a subset of the first flow. Task is more like a functional summary rather than an actual action node. The nodes contained in each task actually process the data.
[0053] The meaning of these two flows is: when a tracking event occurs, the first flow will be executed. When the reporting threshold is reached, for example, the maximum reporting interval (such as 15 seconds) is reached, or the client local cache reaches the peak, the local data will be immediately reported to the server and the second flow will be executed. The programmer can also call "immediate reporting" at any time in the code, and the second flow will also be executed.
[0054] The analyticsTasks function stores the order of each node under the task.
[0055] The analyticsNodes function stores the mapping between each node and the corresponding specific class.
[0056] The FlowData class object is the carrier class of the data that flows and is processed in each node. When the flow starts, a FlowData class object is generated; when each node just processes the data, it will read a corresponding data of the FlowData class object, which is equivalent to the input parameter; after each node processes the data, it will assign a value to the corresponding attribute of the FlowData class object, which is equivalent to the output parameter.
[0057] When storing in the database, that is, in the processWithInput:completion: method of the InsertRecordInterceptor class, the record attribute of the FlowData class object is taken out, that is, the embedded point data is taken out and stored in the local database.
[0058] In some embodiments, custom data is spliced with original data by adding key-value pairs, including: in the process of generating key-value pairs of original data, the key-value pairs corresponding to the custom data are spliced onto the key-value pairs of the original data, and the spliced key-value pairs are assigned to the record attributes of the event attribute management object.
[0059] Specifically, the embodiments of the present application provide two methods of storing data buried point. The first method is: in the stage where the existing data buried point system generates a key-value pair for reporting data, directly add the self-developed buried point data (i.e., custom buried point data) to the original key-value pair. The advantage of this method is that it is simple to implement. You only need to add the self-developed buried point data to the end of the method jsonObject of SABaseEventObject. However, there may be a problem that this method may interfere with the original logic of the data buried point system, especially if the code of the data buried point system is updated or the data structure changes, it may be necessary to modify this part of the code.
[0060] In other words, this method of storing data is to add custom data to the key-value pairs of the original data and store this information. The framework of the data storage system will be used to complete this task, and custom logic will be added to the data storage process. In actual applications, the implementation process of the first method of storing data is as follows:
[0061] First, it is necessary to add custom data in the process of generating the key-value pair of the original data. In the embodiment of the present application, the jsonObject method of the BaseEventObject class will be used to generate the key-value pair of the original data. A line of code will be added to the end of this method to add the key-value pair of the self-developed buried data to the original key-value pair. For example, the key of the self-developed buried data can be set to "jkdata".
[0062] / / Original data key-value pair generation code
[0063] NSDictionary*originalData=[self jsonObject];
[0064] / / Add self-developed tracking data key-value pairs
[0065] originalData[@"jkdata"]=self.customData;
[0066] return originalData;
[0067] In this example, self.customData is the custom data of the embodiment of the present application, and it is added to the original data key-value pair with the key "jkdata".
[0068] After adding the self-developed tracking data, you need to assign the spliced key-value pair to the record attribute of the event attribute management object. This is done by calling the record attribute of the FlowData object. This embodiment of the application will use the processWithInput:completion: method of the EventResultInterceptor class to complete this task, for example:
[0069] / / Create a new event record object
[0070] EventRecord*newRecord=[[EventRecord alloc]init];
[0071] / / Assign the concatenated key-value pairs to the attributes of the new record
[0072] newRecord.attributes=originalData;
[0073] / / Assign the new record to the record attribute of the event stream data
[0074] flowData.record=newRecord;
[0075] In this way, the self-developed tracking data can be successfully spliced with the original data, and the spliced data can be stored locally.
[0076] In some embodiments, custom data is spliced with original data in the form of custom nodes, including: adding a new custom node after the event processing node to construct a custom data format, adding a predetermined construction server data node and upload server action node to the node tree, and adding corresponding class code and logic to the project; wherein the logic includes reading the event attribute management object of the task flow input node, attaching the key-value pair of the generated custom data to the event attribute management object, and re-adding the event attribute management object to the task flow and passing it to the next node.
[0077] Specifically, an embodiment of the present application provides another method of storing tracking data: by adding a new custom node to the task flow of the data tracking system, and adding self-developed tracking data to this node. Specifically, a node named modifysave is added after the event_result node, and the value of the record attribute of the SAFlowData class object is taken out in this node, and the self-developed tracking data is added, and then the modified value is reassigned to the record attribute of the SAFlowData class object. The advantage of this method is that the changes to the source code of the data tracking system are minimal, the logic of inserting data is clear and independent, and it is easier to maintain and upgrade. However, it may take more time to understand the node architecture of the data tracking system, and to write and test new node code.
[0078] In an example, the process of another method of storing tracking data is roughly divided into the following steps:
[0079] The first step is to add a new node: find the event_result node in the analyticsTasks function of the SACoreResources.m file and add a new node "modifysave" after it. This step is to add a custom node to the task flow of the data tracking system.
[0080] Step 2: Node mapping: In the analyticsNodes method of the SACoreResources.m file, add a new node record so that the new node has a corresponding mapping relationship with its code. The example node record is as follows:
[0081] {@"id":@"modifysave",@"name":@"This solution customizes the storage node modification",@"interceptor":@"ModifysaveInterceptor"}.
[0082] The third step is to create a new class: create a new class named ModifysaveInterceptor, which needs to inherit from SAInterceptor. In the architecture of the data tracking system, all nodes inherit from the SAInterceptor base class, and the processing logic of the node is implemented by overriding the processWithInput:completion: method of the parent class.
[0083] Step 4, logic implementation: In the rewritten processWithInput:completion: method, implement the following logic: First, take out the record attribute value of the SAFlowData class object, which contains the tracking data of the data tracking system. Then, add the self-developed tracking data generated in the first step (which needs to be converted into a key-value pair) to this value. Finally, reassign the modified value to the record attribute of the SAFlowData class object.
[0084] It should be noted that the above is a process for implementing self-developed data storage by minimizing the modification of the data tracking system source code. In actual applications, if the self-developed business needs determine that other functions of the data tracking system will not be used, you can choose to directly replace the original data instead of adding a custom data later. Regardless of the data storage method used, when inserting self-developed data, the data structure must be converted into a key-value pair for storage and transmission. You can choose an appropriate method to implement it according to specific business needs and resource conditions.
[0085] In some embodiments, the buried data is reported to the server via an HTTP request, including: in constructing a server data node, reading the event attribute management object of the task flow inflow node, using the event attribute management object as an array, traversing the array, reading the stored custom data for each element, and assembling the data according to a predetermined format; in the upload server action node, modifying the request header and request body attributes of the HTTP request according to a custom parameter passing method, and modifying the data processing method after the HTTP request is returned.
[0086] Specifically, in the previous embodiment, it has been introduced how to store the self-developed burying point data locally. Next, it will be described in detail how to obtain these burying point data from the local and upload them to the server.
[0087] In the workflow of the data tracking system, the technical solution of this application will operate according to the following steps: data collection -> data storage -> after reaching a certain number or a certain time (the threshold is determined by the configuration file) -> upload to the server. This embodiment will mainly focus on the latter two steps.
[0088] In the data tracking system, obtaining data from the local, decrypting data, and splicing data (splicing dozens of data into a JSON string, where "dozens" is determined by the configuration file) are fixed operation steps and do not require any changes. The system will store the retrieved data in the records attribute of the FlowData class object in the form of an array.
[0089] In the original data tracking system, the system constructs the data structure uploaded to the server in the flush_http_body node. The corresponding code is implemented in the FlushHTTPBodyInterceptor class. The main task of this class is to encapsulate the data of the data tracking system into a specific format for uploading to the server.
[0090] Next, the data tracking system will upload the data to the server in the flush node. This part of the code is implemented in the FlushInterceptor class. The FlushInterceptor class will upload the data to the URL server interface configured on the developer platform and process the return data of the interface. If the server returns an error message, the system will restore the status of the previously reported data in the database so that the data can continue to be uploaded next time.
[0091] However, the data format of the self-developed server is different from that of the data tracking system, and the URL of the server interface is also different from that of the data tracking system. Therefore, the logic of the flush_http_body node cannot be used directly. However, the original logic still needs to be used to handle the situation where the server returns an error message. Therefore, it is necessary to make certain modifications to the data tracking system.
[0092] Furthermore, the present application directly modifies the original construction server data node and upload server action node of the data tracking system. The specific actions are:
[0093] (1) In constructing the server data node, read the event attribute management object of the task flow input node, which is an array. Traverse the array, take out the self-developed data stored in each element, and assemble the data according to the format required by the self-developed data.
[0094] (2) In the upload server action node, modify the header and body attributes of the HTTP request according to the parameter transmission method required by the self-developed system, and modify the data processing method after the HTTP request is returned.
[0095] The embodiment of the present application can report the customized tracking data to the server through HTTP request. This includes the following two steps:
[0096] First, you need to operate in the construction server data node. This node corresponds to the FlushHTTPBodyInterceptor class in the data tracking system. In the processWithInput:completion: method of this class, first obtain the event attribute management object from the task flow, that is, the FlowData class object. The records attribute in this object is an array that contains all the data you want to report. By traversing this array, perform the following operations on each piece of data: read the stored custom data, and assemble the data according to the format you define.
[0097] Next, you need to operate in the upload server action node. This node corresponds to the FlushInterceptor class in the data tracking system. In the processWithInput:completion: method of this class, you need to modify the request header and request body attributes of the HTTP request according to the custom parameter passing method. At the same time, you also need to modify the way to process the returned data of the HTTP request to adapt to the custom server interface.
[0098] Through the above modifications, the embodiment of the present application can realize the transformation of the original reporting logic in the data tracking system. Specifically, this includes the following two steps:
[0099] In the processWithInput:completion: method of the FlushHTTPBodyInterceptor class, traverse the records property of the FlowData object (that is, the data array you want to report), read the custom data stored in each piece of data, and assemble the data according to the custom format.
[0100] In the processWithInput:completion: method of the FlushInterceptor class, modify the request header and request body attributes of the HTTP request according to the custom parameter passing method, and process the data returned by the HTTP request according to the new logic.
[0101] Through the above steps, the embodiment of the present application successfully transforms the original logic of the data tracking system into a new logic suitable for custom data.
[0102] In some embodiments, the buried data is reported to the server via an HTTP request, including: removing the original construction server data node and upload server action node, adding a custom construction server data node and upload server action node to the node tree, and adding the corresponding class code and logic to the project; wherein the logic includes reading the event attribute management object of the task flow input node, taking out the custom data from the event attribute management object, and assembling the data according to the custom server data format.
[0103] Specifically, another data reporting method is a method that minimizes the source code modification of the data tracking system, which may include the following:
[0104] (1) First, remove the original construction server data node and upload server action node of the data embedding system from the node tree, and write the construction server data node and upload server action node by yourself.
[0105] (2) Add the self-written construction server data node and upload server action node to the node tree. Specifically, modify the corresponding JSON configuration file and delete the node value corresponding to the original JSON key.
[0106] (3) Since there is a mapping relationship between nodes and specific codes, it is not enough to just add nodes. You also need to insert the corresponding class code and logic into the project.
[0107] (4) Write the following logic to construct the server data node:
[0108] Read out the event attribute management object of the task flow input node. Self-developed data is inserted into the event attribute management object. Take it out and assemble the data according to the server data format required by self-developed data.
[0109] For example: The server data format requirement is:
[0110] Each tracking point consists of a header and a body, and multiple tracking point data form an array.
[0111] The headers contain the timestamp and package name of the report;
[0112] The body contains the actual reported data (needs to be encrypted), which is the key-value pairs in Table 1. They are separated by commas and assembled into a string.
[0113] Then, traverse this array, take out the stored self-developed data for each element, assemble the data according to the format required by the self-developed data, and reassign the new assembled data to the task flow event attribute management object.
[0114] Furthermore, the embodiment of the present application reports the tracking data to the server through HTTP request. Among them, the original construction server data node and upload server action node can be removed, and then the custom construction server data node and upload server action node can be added to the node tree, and the corresponding class code and logic can be added to the project. In a way that the source code of the data tracking system is modified minimally:
[0115] (1) First, you need to remove the flush_http_body and flush nodes in the CoreResources.m file and replace them with new custom nodes. For ease of description, the new custom nodes are referred to as "selfdefine_flush_http_body" and "selfdefine_flush" in the embodiment of the present application. Specifically, you need to find the flush_http_body and flush nodes in the analyticsTasks function of the CoreResources.m file and replace them with the "selfdefine_flush_http_body" and "selfdefine_flush" nodes.
[0116] (2) Simply adding new nodes is not enough. You also need to add corresponding code mapping relationships for the new nodes. This application can add new node records in the analyticsNodes method of the CoreResources.m file. The new node record should follow the json description method defined by other nodes in the data tracking system. For example, you can add the following two node records:
[0117] {@"id":@"selfdefine_flush_http_body",@"name":@"This solution customizes the node that constructs the data structure reported to the server",@"interceptor":@"Selfdefine_FlushHTTPBodyInterceptor"},
[0118] {@"id":@"selfdefine_flush",@"name":@"The connection server node customized for this solution",@"interceptor":@"Selfdefine_FlushInterceptor"}.
[0119] In the above node record, the "id" field is used to identify the node, the "name" field is used to describe the function of the node, and the "interceptor" field is used to specify the corresponding interceptor class. For the "selfdefine_flush_http_body" node, the specified interceptor class is "Selfdefine_FlushHTTPBodyInterceptor", which is responsible for assembling data according to the custom server data format; for the "selfdefine_flush" node, the specified interceptor class is "Selfdefine_FlushInterceptor", which is responsible for sending the assembled data to the server.
[0120] Furthermore, create two new classes, named Selfdefine_FlushHTTPBodyIntercep tor and Selfdefine_FlushInterceptor, both of which inherit from SAInterceptor; write logic in their respective processWithInput:completion: methods.
[0121] Write the logic in the processWithInput:completion: method of Selfdefine_FlushHTTPBodyInterceptor:
[0122] Take out the value of the records attribute of the SAFlowData class object, read out the attached self-developed data, and assemble the data according to the format required by the self-developed data.
[0123] For example, each tracking point consists of a header and a body, and multiple tracking point data forms an array. The header contains the timestamp and package name of the report; the body contains the actual reported data (needs to be encrypted), that is, the key-value pairs in Table 1, which are separated by commas and assembled into a string.
[0124] Then traverse the records attribute of the SAFlowData class object, which is a collection of SAEventRecord class objects. For each record (that is, SAEventRecord class object), read its event attribute. This event attribute is the previously stored tracking data, specifically:
[0125] The object generated by the SABaseEventObject method jsonObject is a key-value pair combination. The first parameter of the SAEventRecord class initialization method -(instancetype)initWithEvent:(NSDictionary*)eventtype:(NSString*)type is passed in this key-value pair, and then the SAEventRecord class object is assigned to the SAFlowData class object. Finally, it is stored in the cache database.
[0126] Take out the value of the record attribute of the SAFlowData class object, add the previously generated key-value pair of the self-developed tracking point data (the previous data structure must be converted into a key-value pair), and then reassign the modified value to the record attribute of the SAFlowData class object.
[0127] You may notice that when storing in the database, it is a record, and when retrieving, it is records. Because the tracking events occur one by one, they are stored one by one, and they are retrieved in batches, so they are records. Therefore, after getting the event attribute, according to the key of the self-developed data, the value of the self-developed data is obtained. This is a key-value pair. You can call the key-value pair conversion tool provided by the data tracking system to convert the self-developed data into a string, or you can call the system function provided by iOS to convert it. Finally, encrypt the string according to the requirements.
[0128] Assign the result string to the HTTPBody property of the SAFlowData class object so that the next node can process it. Write the logic in the processWithInput:completion: method of Selfdefine_FlushInterceptor:
[0129] Create an HTTP request according to the parameter passing method required by self-developed research, set its header and body attributes, and write the data processing method after the HTTP request returns.
[0130] For example, in the requirements of the self-developed server for reporting tracking points, the URL of the HTTP request has been specified, the method is post, and the required data is placed in the body of the HTTP request.
[0131] The technical solution of this application also describes how to use the processWithInput:completion: method in the Selfdefine_FlushInterceptor class to process self-developed data and send the data to the server. The complete implementation process is as follows:
[0132] Generate URL object: You need to create a network request class object to specify the address to which you want to send the HTTP request. You can use the buildServerURLW ithURLString:debugMode: method of the SAURLUtils tool class provided by the data tracking system to create this URL object, or directly use the initWithString: method of the iOS NS URL class. No matter which method you use, you need to provide a string parameter, which is the server address.
[0133] Create an NSMutableURLRequest object: Use the requestWithURL: method of the NSMutableURLRequest class to create an NSMutableURLRequest object, passing in the NSURL object generated in the first step as a parameter. Then set the HTTPMethod property of this object to "POST", indicating that a POST request is to be sent. Next, call the setValue:forHTTPHeader Field: method of this object to set the HTTP request header.
[0134] Set HTTPBody: According to the requirements of the self-developed server, assign the self-developed data string extracted earlier to the HTTPBody property of the NSMutableURLRequest object.
[0135] Create an NSURLSessionDataTask and send a request: Get the sharedInstance property of the SAHTTPSession class to get an HTTP request object with default configuration. Then call the dataTaskWithRequest:completionHandler: method of this object to create an NSURLSession DataTask object. The parameters are the NSMutableURLRequest object configured in the previous step and a callback function. This callback function will be automatically called after the HTTP request is completed, and the data returned by the network request can be processed in this function. If the request is successful, you don't need to do anything; if the request fails, you need to restore the buried data in the database and retry the request. The number of retries is determined by the configuration. Finally, call the resume method on the returned NSURLSessionDataTask object to send the actual HTTP request.
[0136] In some embodiments, the method also includes: using a custom server interface to obtain remote configuration data, and storing the remote configuration parameters on the client in the initialization method of the remote configuration model class; judging whether to write the buried point data into a database or a file based on the content of the remote configuration parameters, and when reporting the buried point data, reading the buried point data from the corresponding storage location based on the remote configuration parameters.
[0137] Specifically, many elements in the data tracking system are determined by configurations, which can be system default configurations or customized according to the requirements of self-developed tracking. The configurations used by the data tracking system are divided into remote configuration and local configuration.
[0138] The URL of the remote configuration is specified by the remoteConfigURL property of the ConfigOptions of the data tracking system. The data returned by the interface is in the form of key-value pairs, and its content must meet the requirements of the existing code for the data format. The main contents include disabled SDKs, event blacklists, remote configuration version numbers, etc. Since this solution does not use the product corresponding to the data tracking system, but "borrows" its client code, if you want to use remote configuration, you must provide a server interface whose return data meets the data format required by the existing code to analyze the remote configuration. For example, the initialization method of the RemoteConfigModel class -(insta ncetype)initWithDictionary:(NSDictionary*)dictionary accepts key-value pairs for remote configuration, which expects the following keys and their corresponding values:
[0139] V: The original version number of the Remote Config.
[0140] localLibVersion: The version number of the local configuration. These two version numbers are used together with nv to update the configuration data.
[0141] configs: Specific configuration, which is a key-value pair, and its content is as follows:
[0142] nv: The version number of the last configuration.
[0143] disableSDK: Whether to enable the data tracking system, true means enabled, false means not enabled.
[0144] disableDebugMode: Whether to enable developer mode. If true, it is enabled, some logs will be output and additional requests will be added. If false, it is not enabled. Online applications should set this to not enabled.
[0145] event_blacklist: event blacklist. Events listed here will not take effect even if they are embedded.
[0146] The local configuration consists of various properties of the ConfigOptions class object of the data tracking system, including: the interval between two data reports (15 seconds by default), the maximum number of records stored in the local database, the maximum number of local cache logs between two reports, the maximum interval between events, the network policy when reporting (by default, only reports are made in 3G, 4G, 5G, and WI-FI environments), whether to encrypt uploaded data, whether to encrypt tracking data before storing it in the database, etc. These local configurations are set by the client code, and if they need to be modified, they can only be done by updating the client.
[0147] Furthermore, the embodiment of the present application uses a custom server interface to obtain remote configuration data, and in the initialization method of the remote configuration model class, the remote configuration parameters are stored on the client; based on the content of the remote configuration parameters, it is determined whether the burial point data is written to a database or to a file, and when reporting the burial point data, the burial point data is read from the corresponding storage location based on the remote configuration parameters.
[0148] Therefore, for the above configuration, if the default strategy provided by the data tracking system can meet the needs of self-development, then modify the above configuration directly. If not, adopt a completely self-developed approach or a combination of self-development and modification of the data tracking system. For remote configuration, the specific description is as follows:
[0149] Remote configuration is optional. Its advantage is that you can flexibly modify the configuration. If your own research does not require the use of remote configuration, ignore it. If you do, then:
[0150] (1) If you only use these configurations of the data tracking system, you only need to develop a self-developed server interface.
[0151] (2) If business needs require additional configuration, modify the client code to store and use these additional configurations.
[0152] For example, if you want to change the original local configuration of the data tracking system (the interval between two data reports (default 15 seconds), the maximum number of records stored in the local database, the maximum number of local cache logs between two reports, the maximum interval between events, and the network policy during reporting) into a flexible form that can be configured by the server, you need to modify the corresponding code of the client data tracking system, specifically:
[0153] In the initialization method of RemoteConfigModel -(instancetype)initWithDictionary:(NSDictionary*)dictionary, store these newly added key-value pairs on the client, add corresponding storage properties, and methods for saving and getting values of this property.
[0154] When using these configurations, if you want to overwrite the local configuration of the data tracking system, replace the code locations where these local configurations appear with the corresponding properties of RemoteConfigModel. If you do not overwrite the local configuration of the data tracking system, it is a brand new configuration and can be used directly where needed.
[0155] For example: self-developed data storage needs to be set to a file instead of a database. This configuration is not available in the source code of the data tracking system. In addition to storing this configuration in the RemoteConfigModel class object in step (1), when the tracking data is about to be written to the database, that is, the insert node (the corresponding source code class is InsertRecordInterceptor), read this configuration to determine whether it is written to the database or the file. If it is written to the database, call the original logic of the data tracking system. If it is written to the file, develop the file writing code, write the tracking data to the file, and read the data from the file instead of the database when reading the tracking data for reporting.
[0156] Furthermore, for local configuration, the specific description is as follows:
[0157] The modification principle of local configuration is similar to that of remote configuration. If the configuration provided by the data tracking system covers the configuration required by self-developed, you can directly modify the values of these configurations.
[0158] If you need to configure additional items for your own research, add a storage property in the SAConfigOptions class, as well as methods for saving and getting values for this property, and execute the corresponding logic when using it.
[0159] For example, if you need to set the method for uploading tracking data to webSocket instead of HTTP, you can add a storage property and methods for saving and getting values of this property in the SAConfigOptions class. When using it, that is, in the data upload node (flush node, the corresponding code is SAFlushInterceptor class), change the method of connecting to the remote server from HTTP to webSocket.
[0160] In some embodiments, after reporting the tracking data to the server via an HTTP request, the method further includes: performing customized encryption processing on the reported tracking data, the encryption processing including converting a character string into a byte stream as plain text, randomly generating a key, and combining it with a preset fixed key to form a new key; performing MD5 processing on the new key and combining it with the original key to form a key used for a symmetric encryption algorithm, using the newly generated key to symmetrically encrypt the plain text, combining the random key and the encrypted ciphertext, and uploading it to the server so that the server can use a reverse algorithm to decrypt and obtain the plain text.
[0161] Specifically, the embodiments of the present application will also modify the storage encryption strategy. The data embedding system will encrypt almost every step of data processing, for example: the transmission of remote configuration data can be encrypted, and the data can be decrypted after being acquired; the storage of remote configuration data can be encrypted, and it can be decrypted when read from the storage; the embedding data can be encrypted when entering the database, and can be decrypted when taken out of the database; the embedding data can be encrypted when reported to the server. Whether to encrypt is determined by the configuration of the aforementioned embodiments, but the encryption strategy is fixed in the source code of the data embedding system. The self-developed encryption strategy can be the same as or different from the strategy specified by the data embedding system. When it is different, the source code needs to be modified.
[0162] Take the encryption strategy when the tracking data is reported to the server as an example:
[0163] The original encryption strategy of the data embedding system at this step is: gzip compress the reported data (string format), then convert it to base64 to get the result string, and then take the hash value of the result string and put it into the request parameter crc of the data embedding system.
[0164] However, the self-developed requirement is to encrypt the data using a custom encryption algorithm, and encryption is required, so the above "whether to encrypt the configuration" needs to be ignored.
[0165] The algorithm is roughly described as follows: convert the reported data (string format) into a byte stream as plaintext, randomly generate a byte of length 8 (random key), and form a new key together with a byte stream converted from a fixed string (fixed key), calculate the md5 of the key and then combine it with the key to form the key used by the symmetric encryption algorithm. Use this key to symmetric encrypt the plaintext, and then combine the random key and ciphertext and upload them to the server. The server uses the reverse algorithm to decrypt and obtain the plaintext (that is, the reported data).
[0166] Therefore, it is necessary to write a separate encryption method to encrypt the reported data (string format) before uploading it to the server. The original encryption code of the data tracking system needs to be commented out.
[0167] This modification can be performed on the original data tracking system code, or a custom node can be added (the method is basically the same as before) to replace the original data tracking system node and write encryption logic in the node.
[0168] In one example, the self-developed requirements may require a change in the data storage method, not in the database but in the file. Such a configuration is not available in the source code of the data tracking system. Therefore, in addition to storing this new configuration in the remote configuration model class, it is also necessary to read this configuration when the tracking data is about to be written to the database (the corresponding source code class is called "InsertRecordInterceptor") to determine whether it is written to the database or the file. If it is written to the database, the original logic of the data tracking system is called; if it is written to the file, new code needs to be developed to write the tracking data to the file. Then when reporting the tracking data, the data needs to be read from the file instead of the database.
[0169] Therefore, different self-developed needs may require different degrees of modification to the data tracking system. Some may only require some configuration changes, while others may require rewriting certain methods or classes. The key is to understand the working principle and source code structure of the data tracking system in order to effectively modify and meet the needs.
[0170] Furthermore, we know from the previous section that the nodes and execution order of the data tracking system are stored in SACoreResources.m. You can delete the original nodes of the data tracking system according to business needs, add your own nodes, and adjust the order of the nodes.
[0171] For example: if there is no need for tedious steps to check data, delete the corresponding nodes for checking and modifying data (event_validate, ID-Mapping, correct_userId); if there is no need for remote configuration, delete the corresponding node (remote_config); if there is no need to store data in the database and upload it immediately every time, delete the corresponding node (encrypt, Insert, can_flush, select_records).
[0172] For another example: After reporting data to the data tracking system, you need to save the locally reported tracking data into a file. Then, add a new node, that is, add a new custom node after the event_result node in SACoreResources.m, and add the correspondence between the node and the class code in the analyticsTasks function of SACoreResources.m. The class inherits from SAInterceptor, rewrites the -(void)processWithInput:(SAFlowData*)inputcompletion:(SAFlowDataCompletion)completion function, and writes the processing logic in it: save the data into a file.
[0173] According to the technical solution provided by the embodiment of the present application, when a preset business event occurs, the present application generates a set of buried data using the event name and event attributes, which helps to track and record the user's operation behavior more accurately, thereby improving the accuracy of data analysis. When the buried data set is stored in a predetermined data storage structure, it includes original data and custom data. This flexible data storage method not only improves the richness of the data, but also provides more possibilities for subsequent data processing and analysis. By converting the data storage structure into a key-value pair and splicing the custom data with the original data, this method provides a simple and effective way to facilitate subsequent data processing and analysis. When the buried data stored in the local database meets the preset conditions, the data is reported to the server through an HTTP request. This reporting method can ensure the real-time nature of the data and reduce the impact on client performance. The custom server interface obtains remote configuration data and stores it locally, so that the system can dynamically adjust the data storage and reporting strategy according to the remote configuration, thereby improving the flexibility and configurability of the system. After the buried data is reported to the server through an HTTP request, a custom encryption process is used to enhance the security of the data, which can prevent the data from being maliciously tampered with or stolen during transmission. By splicing and processing the original data through custom nodes, the system can perform customized data processing according to specific needs, improving the flexibility of the system. Therefore, this application provides a flexible, safe and efficient data embedding method that can adapt to various complex business needs and improve the accuracy and efficiency of data analysis.
[0174] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0175] Figure 2 Schematic diagram of the structure of the data embedding device of the client provided in the embodiment of the present application. Figure 2 As shown, the data embedding device of the client includes:
[0176] The generating module 201 is configured to generate a set of buried data using an event name and event attributes in response to a preset business event occurring;
[0177] The storage module 202 is configured to obtain the buried point data for reporting, and store the buried point data set and the buried point data in a predetermined data storage structure, wherein the buried point data includes original data and custom data;
[0178] The splicing module 203 is configured to convert the data storage structure into a key-value pair, splice the custom data with the original data by adding a key-value pair or a custom node, and convert the spliced key-value pair into a string and store it in a local database;
[0179] The reporting module 204 is configured to generate a network request class object when the tracking data stored in the local database reaches a preset condition, set the server request URL of the network request class object to a custom URL, set the request method of the network request class object to a custom request method, set the request accompanying data of the network request class object to custom data, and report the tracking data to the server through an HTTP request.
[0180] In some embodiments, Figure 2 When a business event occurs, the generation module 201 calls the preset event attribute tracking method, and passes the event name and event attributes as parameters to the event attribute tracking method; creates an event attribute management object in the event attribute tracking method, assigns the event name to the first attribute of the event attribute management object, and assigns the event attribute to the second attribute of the event attribute management object; uses the value of the first attribute and the value of the second attribute to generate a set of buried data, and uses the buried data set as a record attribute of the event attribute management object.
[0181] In some embodiments, Figure 2 The storage module 202 creates a data storage structure, which uses a dictionary or a class instance; obtains preset point data from the attribute set of the basic event object class of the application, and obtains geographic location information from the instance of the module manager class, and stores the point data set, point data and geographic location information in the data storage structure.
[0182] In some embodiments, Figure 2 In the process of generating the key-value pairs of the original data, the splicing module 203 splices the key-value pairs corresponding to the custom data to the key-value pairs of the original data, and assigns the spliced key-value pairs to the record attributes of the event attribute management object.
[0183] In some embodiments, Figure 2 The splicing module 203 adds a new custom node after the event processing node to construct a custom data format, adds the predetermined construction server data node and upload server action node to the node tree, and adds the corresponding class code and logic in the project; wherein the logic includes reading the event attribute management object of the task flow input node, attaching the key-value pair of the generated custom data to the event attribute management object, and re-adding the event attribute management object to the task flow and passing it to the next node.
[0184] In some embodiments, Figure 2The reporting module 204 reads the event attribute management object of the task flow input node in the construction server data node, takes the event attribute management object as an array, traverses the array, reads the stored custom data for each element, and assembles the data according to a predetermined format; in the upload server action node, according to the custom parameter passing method, modifies the request header and request body attributes of the HTTP request, and modifies the data processing method after the HTTP request is returned.
[0185] In some embodiments, Figure 2 The reporting module 204 removes the original construction server data node and upload server action node, adds the customized construction server data node and upload server action node to the node tree, and adds the corresponding class code and logic in the project; wherein the logic includes reading the event attribute management object of the task flow input node, taking out the customized data from the event attribute management object, and assembling the data according to the customized server data format.
[0186] In some embodiments, Figure 2 The configuration module 205 uses a custom server interface to obtain remote configuration data. In the initialization method of the remote configuration model class, the remote configuration parameters are stored on the client. According to the content of the remote configuration parameters, it is determined whether the buried point data is written into a database or a file. When reporting the buried point data, the buried point data is read from the corresponding storage location according to the remote configuration parameters.
[0187] In some embodiments, Figure 2 After the encryption module 206 reports the buried data to the server through the HTTP request, it performs customized encryption processing on the reported buried data. The encryption processing includes converting the character string into a byte stream as plain text, randomly generating a key, and combining it with a preset fixed key to form a new key; performing MD5 processing on the new key and combining it with the original key to form a key used for the symmetric encryption algorithm, using the newly generated key to symmetric encrypt the plain text, combining the random key and the encrypted ciphertext, and uploading it to the server so that the server can use a reverse algorithm to decrypt and obtain the plain text.
[0188] 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.
[0189] Figure 3 Schematic diagram of the structure of the electronic device 3 provided in the embodiment of the present application. Figure 3As shown, the electronic device 3 of this embodiment includes: a processor 301, a memory 302, and a computer program 303 stored in the memory 302 and executable on the processor 301. When the processor 301 executes the computer program 303, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 301 executes the computer program 303, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0190] Exemplarily, the computer program 303 may be divided into one or more modules / units, which are stored in the memory 302 and executed by the processor 301 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 303 in the electronic device 3.
[0191] The electronic device 3 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 3 may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will appreciate that Figure 3 It is only an example of the electronic device 3 and does not constitute a limitation of the electronic device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0192] The processor 301 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 the processor may be any conventional processor, etc.
[0193] The memory 302 may be an internal storage unit of the electronic device 3, for example, a hard disk or memory of the electronic device 3. The memory 302 may also be an external storage device of the electronic device 3, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 3. Further, the memory 302 may also include both an internal storage unit and an external storage device of the electronic device 3. The memory 302 is used to store computer programs and other programs and data required by the electronic device. The memory 302 may also be used to temporarily store data that has been output or is to be output.
[0194] 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.
[0195] 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.
[0196] 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.
[0197] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. 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.
[0198] 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.
[0199] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0200] If the integrated module / 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, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.
[0201] The above embodiments 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 be included in the protection scope of the present application.
Claims
1. A data embedding method for a client, characterized in that: include: In response to a preset business event, a set of embedded data is generated using the event name and event attributes; Acquire buried point data for reporting, and store the buried point data set and the buried point data in a predetermined data storage structure, wherein the buried point data includes original data and custom data; Converting the data storage structure into a key-value pair, splicing the custom data with the original data by adding a key-value pair or a custom node, and converting the spliced key-value pair into a string and storing it in a local database; When the buried data stored in the local database meets the preset conditions, a network request class object is generated, the server request URL of the network request class object is set to a custom URL, the request method of the network request class object is set to a custom request method, the request accompanying data of the network request class object is set to custom data, and the buried data is reported to the server through an HTTP request; Wherein, in response to the occurrence of a preset business event, generating a set of buried data using the event name and event attributes includes: When the business event occurs, a preset event attribute tracking method is called, and the event name and event attributes are passed as parameters to the event attribute tracking method; In the event attribute tracking method, an event attribute management object is created, the event name is assigned to the first attribute of the event attribute management object, and the event attribute is assigned to the second attribute of the event attribute management object; The buried point data set is generated by using the value of the first attribute and the value of the second attribute, and the buried point data set is used as a record attribute of the event attribute management object.
2. The method according to claim 1, characterized in that The acquiring of the buried point data for reporting and storing the buried point data set and the buried point data in a predetermined data storage structure includes: Create the data storage structure, which uses a dictionary or a class instance; obtain the preset burying point data from the attribute set of the basic event object class of the application, and obtain the geographic location information from the instance of the module manager class, and store the burying point data set, the burying point data and the geographic location information in the data storage structure.
3. The method according to claim 1, characterized in that The custom data is concatenated with the original data by adding key-value pairs, including: In the process of generating the key-value pair of the original data, the key-value pair corresponding to the custom data is spliced to the key-value pair of the original data, and the spliced key-value pair is assigned to the record attribute of the event attribute management object.
4. The method according to claim 1, characterized in that: The custom data is joined with the original data in the form of a custom node, including: Add a new custom node after the event processing node to construct a custom data format, add the predetermined construction server data node and upload server action node to the node tree, and add the corresponding class code and logic in the project; The logic includes reading the event attribute management object of the task flow inflow node, attaching the generated key-value pair of the custom data to the event attribute management object, and re-adding the event attribute management object to the task flow and passing it to the next node.
5. The method according to claim 1, characterized in that The step of reporting the tracking data to the server through an HTTP request includes: In constructing the server data node, read the event attribute management object of the task flow input node, take the event attribute management object as an array, traverse the array, read the stored custom data for each element, and assemble the data according to a predetermined format; in the upload server action node, modify the request header and request body attributes of the HTTP request according to the custom parameter passing method, and modify the data processing method after the HTTP request is returned.
6. The method according to claim 1, characterized in that The step of reporting the tracking data to the server through an HTTP request includes: Remove the original construction server data node and upload server action node, add the custom construction server data node and upload server action node to the node tree, and add the corresponding class code and logic in the project; The logic includes reading the event attribute management object of the task flow inflow node, taking out the custom data from the event attribute management object, and assembling the data according to the custom server data format.
7. The method according to claim 1, characterized in that The method further comprises: Use a custom server interface to obtain remote configuration data, and store the remote configuration parameters on the client in the initialization method of the remote configuration model class; based on the content of the remote configuration parameters, determine whether to write the buried point data into a database or a file, and when reporting the buried point data, read the buried point data from the corresponding storage location based on the remote configuration parameters.
8. The method according to claim 1, characterized in that After reporting the buried data to the server through the HTTP request, the method further includes: The reported buried point data is subjected to customized encryption processing, the encryption processing including converting the character string into a byte stream as plain text, randomly generating a key, and combining it with a preset fixed key to form a new key; the new key is subjected to MD5 processing and then combined with the original key to form a key used for the symmetric encryption algorithm, the plain text is symmetrically encrypted using the newly generated key, the random key and the encrypted ciphertext are combined and uploaded to the server so that the server can use a reverse algorithm to decrypt and obtain the plain text.
9. A data embedding device for a client, characterized in that: include: A generating module is configured to generate a set of buried data using an event name and event attributes in response to a preset business event occurring; A storage module is configured to obtain buried point data for reporting, and store the buried point data set and the buried point data in a predetermined data storage structure, wherein the buried point data includes original data and custom data; A splicing module is configured to convert the data storage structure into a key-value pair, splice the custom data with the original data by adding a key-value pair or a custom node, and convert the spliced key-value pair into a string and store it in a local database; The reporting module is configured to generate a network request class object when the buried point data stored in the local database meets a preset condition, set the server request URL of the network request class object to a custom URL, set the request method of the network request class object to a custom request method, set the request accompanying data of the network request class object to custom data, and report the buried point data to the server through an HTTP request; Among them, the generation module is used to call the preset event attribute tracking method when the business event occurs, and pass the event name and event attributes as parameters to the event attribute tracking method; create an event attribute management object in the event attribute tracking method, assign the event name to the first attribute of the event attribute management object, and assign the event attribute to the second attribute of the event attribute management object; use the value of the first attribute and the value of the second attribute to generate the buried point data set, and use the buried point data set as the record attribute of the event attribute management object.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
