CN112015467A - Point burying method, medium, device and computing equipment - Google Patents

Point burying method, medium, device and computing equipment Download PDF

Info

Publication number
CN112015467A
CN112015467A CN202010923661.7A CN202010923661A CN112015467A CN 112015467 A CN112015467 A CN 112015467A CN 202010923661 A CN202010923661 A CN 202010923661A CN 112015467 A CN112015467 A CN 112015467A
Authority
CN
China
Prior art keywords
point
file
buried point
project
event
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.)
Granted
Application number
CN202010923661.7A
Other languages
Chinese (zh)
Other versions
CN112015467B (en
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.)
Hangzhou Netease Zaigu Technology Co Ltd
Original Assignee
Hangzhou Netease Zaigu 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 Hangzhou Netease Zaigu Technology Co Ltd filed Critical Hangzhou Netease Zaigu Technology Co Ltd
Priority to CN202010923661.7A priority Critical patent/CN112015467B/en
Publication of CN112015467A publication Critical patent/CN112015467A/en
Application granted granted Critical
Publication of CN112015467B publication Critical patent/CN112015467B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/73Program documentation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Library & Information Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a point burying method, medium, device and computing equipment. The method comprises the following steps: determining a plurality of buriable point events of the project engineering; determining a buried point injection position corresponding to each buried point event in a plurality of buried point events in a script file of a project; and the embedded point function is injected into the script file according to the embedded point injection position. According to the embodiment of the application, the cost of the point burying scheme can be reduced, the point burying efficiency is improved, and the readability and the inheritability of project engineering source codes are improved.

Description

Point burying method, medium, device and computing equipment
Technical Field
The embodiment of the invention relates to the field of information technology, in particular to a point burying method, a medium, a device and a computing device.
Background
A buried point is a statistical behavior that collects information for a particular process in an application to track the usage of the application in order to provide data support for a product or operation. In the related art, if automatic point burying of multiple terminals (such as a WEB terminal, an APP terminal, an applet terminal, etc.) is to be realized, an automatic point burying scheme is generally formulated for a known cross-terminal framework type; once the cross-end scheme is changed, the established automatic point burying scheme must be changed, and the process is often implemented by modifying the source code of the project engineering. On one hand, the cost of the point burying scheme is increased and the point burying efficiency is reduced due to the need of manual intervention; on the other hand, the method can also cause the pollution of project engineering source codes and reduce the readability and inheritability of the source codes.
Disclosure of Invention
In this context, embodiments of the present invention are intended to provide a point burying method, medium, apparatus and computing device to reduce the cost of point burying schemes, improve the point burying efficiency, and improve the readability and inheritability of project engineering source codes.
In a first aspect of embodiments of the present invention, there is provided a method of burying a point, comprising:
determining a plurality of buriable point events of the project engineering;
determining a buried point injection position corresponding to each of the plurality of buried point events in a script file of the project; and injecting a buried point function into the script file according to the buried point injection position.
In one embodiment of the invention, the determining a plurality of burial point events for the project comprises:
acquiring a webpage file of the project;
and performing a first traversal operation on the labels in the webpage file, and determining a plurality of burial point events of the project according to the result of the first traversal operation.
In one embodiment of the invention, the determining a plurality of burial point events for the project comprises:
acquiring a script file of the project;
screening a dynamic creation template of a webpage file in the script file;
adopting a dynamic establishing template of the webpage file to establish a corresponding webpage file;
and performing a first traversal operation on the labels in the created webpage file, and determining a plurality of buried point events of the project engineering according to the result of the first traversal operation.
In an embodiment of the present invention, the dynamically created template for filtering the web page files in the script file includes:
determining a regular expression of each node of an abstract syntax tree corresponding to the script file;
and judging whether the node is a dynamic creation template of the webpage file or not according to the value of the regular expression.
In one embodiment of the present invention, the first traversal operation includes:
judging whether the tag contains an event statement or not;
under the condition that the tag contains an event statement, determining a target event corresponding to the event statement as a buried point event of the project engineering;
under the condition that the label does not contain the event statement, judging whether the label type of the label is a label type capable of being clicked or not; and if so, determining a target event corresponding to the click operation in the tag as a buried point event of the project engineering.
In an embodiment of the present invention, the determining, in a script file of the project, a buried point injection position corresponding to each of the plurality of buried point events; and injecting a buried point function into the script file according to the buried point injection position, including:
parsing the script file into a first abstract syntax tree;
traversing nodes in the first abstract syntax tree, and acquiring a buried point function corresponding to a buried point event when the nodes are matched with any one of the plurality of buried point events; parsing the buried point function into a second abstract syntax tree, adding the second abstract syntax tree to the nodes in the first abstract syntax tree;
and when the nodes in the first abstract syntax tree are traversed, reversely analyzing the added first abstract syntax tree to obtain the script file injected into the buried point function.
In one embodiment of the invention, the buried point function is stored in a preset configuration file, and the configuration file comprises at least one of the following items:
project names;
triggering a function name of the embedded point function;
a reference path of the buried point function;
a file directory for performing a site process is required.
In one embodiment of the invention, the identification information of the burial point event includes at least one of:
project engineering identification;
a service routing identifier;
the component identification of the buried point event;
a node type identifier of the burial point event;
an identification of the buried point event.
In an embodiment of the present invention, the injecting the fixed point function into the script file includes: injecting the embedding point function into the source code of the script file in the packaging process of the project engineering;
the method further comprises the following steps: and performing packing operation on the source codes after the embedded point function is injected to obtain codes applied to opposite ends in the multi-end frame.
In an embodiment of the present invention, the injecting the fixed point function into the script file includes: injecting a buried point function into code copied from a target repository;
the method further comprises the following steps:
and storing the codes after the embedded point function is injected into a backup warehouse, and taking the codes in the backup warehouse as release source codes.
In a second aspect of embodiments of the present invention, there is provided a buried point device comprising:
the system comprises a determining module, a processing module and a processing module, wherein the determining module is used for determining a plurality of buriable point events of project engineering;
the embedded point injection module is used for determining an embedded point injection position corresponding to each embedded point event in the plurality of embedded point events in the script file of the project; and injecting a buried point function into the script file according to the buried point injection position.
In one embodiment of the invention, the determining module comprises:
the webpage file acquisition submodule is used for acquiring a webpage file of the project;
and the first determining submodule is used for performing first traversal operation on the tags in the webpage file and determining a plurality of burial point events of the project according to the result of the first traversal operation.
In one embodiment of the invention, the determining module comprises:
the acquisition submodule is used for acquiring a script file of the project;
the screening submodule is used for screening a dynamic creation template of the webpage file in the script file;
the creating submodule is used for creating a corresponding webpage file by adopting a dynamic creating template of the webpage file;
and the second determining submodule is used for performing first traversal operation on the tags in the created webpage file and determining a plurality of burial point events of the project engineering according to the result of the first traversal operation.
In one embodiment of the invention, the screening submodule is operable to:
determining a regular expression of each node of an abstract syntax tree corresponding to the script file;
and judging whether the node is a dynamic creation template of the webpage file or not according to the value of the regular expression.
In one embodiment of the present invention, the first traversal operation includes:
judging whether the tag contains an event statement or not;
under the condition that the tag contains an event statement, determining a target event corresponding to the event statement as a buried point event of the project engineering;
under the condition that the label does not contain the event statement, judging whether the label type of the label is a label type capable of being clicked or not; and if so, determining a target event corresponding to the click operation in the tag as a buried point event of the project engineering.
In one embodiment of the present invention, the buried site injection module comprises:
the analysis submodule is used for analyzing the script file into a first abstract syntax tree;
the adding submodule is used for traversing nodes in the first abstract syntax tree, and acquiring a buried point function corresponding to the buried point event when the nodes are matched with any one of the plurality of buried point events; parsing the buried point function into a second abstract syntax tree, adding the second abstract syntax tree to the nodes in the first abstract syntax tree;
and the inverse parsing submodule is used for inversely parsing the added first abstract syntax tree to obtain the script file injected into the embedded point function when the nodes in the first abstract syntax tree are completely traversed.
In one embodiment of the invention, the buried point function is stored in a pre-set configuration file, the configuration file comprising at least one of:
project names;
triggering a function name of the embedded point function;
a reference path of the buried point function;
a file directory for performing a site process is required.
In one embodiment of the invention, the identification information of the burial point event includes at least one of:
project engineering identification;
a service routing identifier;
the component identification of the buried point event;
a node type identifier of the burial point event;
an identification of the buried point event.
In an embodiment of the present invention, the embedded point injection module is configured to inject the embedded point function into the source code of the script file in a project engineering packaging process;
the device further comprises: and the packing module is used for executing packing operation on the source codes after the embedded point function is injected to obtain codes of opposite ends applied to the multi-end framework.
In one embodiment of the invention, a buried point injection module for injecting a buried point function into code copied from a target repository;
the device further comprises: and the backup module is used for storing the codes after the embedded point function is injected into a backup warehouse and taking the codes in the backup warehouse as release source codes.
In a third aspect of embodiments of the present invention, there is provided a medium storing a computer program, wherein the program is configured to implement the method of burying the dots as described in any one of the above when executed by a processor.
In a fourth aspect of embodiments of the present invention, there is provided a computing device comprising:
one or more processors;
storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement a landed method as in any one of the above.
According to the embedded point method and device provided by the embodiment of the invention, the embedded point event is automatically determined, the embedded point injection position corresponding to the embedded point event is determined in the script file of the project engineering, and then the corresponding embedded point function is injected into the script file, so that the embedded point automatic injection can be realized without considering the type of the cross-end frame. The method is not limited by the cross-terminal technology type, so that the problem of pain in source code modification at the development side is solved, development without perception can be realized, the expandability and the universal applicability of automatic point burying are greatly increased, the labor cost of a point burying scheme is saved, and the point burying efficiency is improved. .
Drawings
The foregoing and other objects, features and advantages of exemplary embodiments of the present invention will be readily understood by reading the following detailed description with reference to the accompanying drawings. Several embodiments of the invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 schematically illustrates a flow chart of a method implementation of a point burying according to an embodiment of the present invention;
fig. 2 schematically shows a first flowchart of the implementation of step S11 in the method for burying points according to the embodiment of the present invention;
fig. 3 schematically shows a flowchart of implementing step S11 in the method for burying a point according to the embodiment of the present invention;
fig. 4 schematically shows a flowchart of the implementation of step S32 in the method for burying a point according to the embodiment of the present invention;
FIG. 5 is a flow chart of an implementation of a first traversal operation performed on a tag in a web page file in a point burying method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of the tag organization structure of an HTML file;
FIG. 7 is a flow chart of an implementation of determining a buriable point event in a method for burying a point according to an embodiment of the invention;
fig. 8 schematically shows a flowchart of the implementation of step S12 in the method for burying points according to an embodiment of the present invention;
FIG. 9 is a diagram schematically illustrating a structure of an abstract syntax tree corresponding to a JS file;
FIG. 10 is a flow chart of an implementation of traversing an abstract syntax tree corresponding to a JS file and injecting a buried point function in a buried point method according to an embodiment of the invention;
FIG. 11 is a flow chart schematically illustrating an implementation of embedding points in a project packaging process in the point embedding method according to an embodiment of the present invention;
FIG. 12 is a flow chart schematically illustrating an implementation of a point burying method according to an embodiment of the present invention, wherein a master project and a slave project are adopted to realize point burying;
FIG. 13 schematically illustrates a media diagram of a method of burying a point in accordance with an embodiment of the present invention;
FIG. 14 schematically illustrates a schematic diagram of a buried point device structure according to an embodiment of the present invention;
FIG. 15 schematically shows a structural schematic diagram of a computing device according to an embodiment of the invention.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed Description
The principles and spirit of the present invention will be described with reference to a number of exemplary embodiments. It should be understood that these embodiments are given only for the purpose of enabling those skilled in the art to better understand and to implement the present invention, and do not limit the scope of the present invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to the embodiment of the invention, a point burying method, a medium, a device and a computing device are provided.
In this document, any number of elements in the drawings is by way of example and not by way of limitation, and any nomenclature is used solely for differentiation and not by way of limitation.
The principles and spirit of the present invention are explained in detail below with reference to several exemplary embodiments thereof.
Summary of The Invention
The inventor finds that the existing data point burying method has the problems of high point burying scheme cost, low point burying efficiency and poor readability and inheritability of project engineering source codes.
In view of this, the present invention provides a method and an apparatus for embedding points, which implement reducing cost of point embedding schemes, improving efficiency of point embedding, and improving readability and inheritability of source codes of project engineering by automatically determining a point-embeddable event, determining an embedded point injection position corresponding to the point-embeddable event in a script file of the project engineering, and then injecting a corresponding point-embedding function into the script file.
Having described the general principles of the invention, various non-limiting embodiments of the invention are described in detail below.
Exemplary method
A method of burying a dot according to an exemplary embodiment of the present invention is described below with reference to fig. 1. It should be noted that the above application scenarios are merely illustrative for the convenience of understanding the spirit and principles of the present invention, and the embodiments of the present invention are not limited in this respect. Rather, embodiments of the present invention may be applied in any scenario where applicable.
Fig. 1 schematically shows a flow chart of a method for burying a point according to an embodiment of the present invention. As shown in fig. 1, the method for embedding points according to the embodiment of the present invention includes the following steps:
s11: determining a plurality of buriable point events of the project engineering;
s12: determining a buried point injection position corresponding to each of the plurality of buried point events in a script file of the project engineering; and the embedded point function is injected into the script file according to the embedded point injection position.
Through the process, the embedded point event in the project engineering is determined, the embedded point injection position corresponding to the embedded point event is determined in the script file of the project engineering, and then the embedded point function corresponding to the position is injected into the script file, so that the embedded point scheme cost is reduced, the embedded point efficiency is improved, and the readability and the inheritability of the project engineering source code are improved.
In some embodiments, the script file may be a JS file. The JS file is a file or template file using JavaScript as a grammar, and is not limited to the file range using JS and jsx as suffixes.
In order to cover all user execution events of a project, the embodiment of the application can perform effective event capture on codes of the project, and the section can be divided into 3 stages, namely a target event screening stage, a target event matching stage and a buried point event injection stage.
The target event screening stage corresponds to the step S11, and is mainly used for determining the buriable point event of the project. The target event matching stage and the buried point event injecting stage correspond to the steps S12 and S13, and are mainly for finding a buried point injecting position corresponding to a buried point event in the script file and injecting a buried point function into the buried point injecting position.
The target event filtering stage is mainly to perform Document Object Model (DOM) node traversal on a webpage file of the project, such as a hypertext markup Language (HTML) file. The HTML file is a file or template file having HTML as a main syntax, and is not limited to a file range having HTML, htm, vm, or the like as suffixes.
Through traversal of the DOM node, the related information of the current DOM node can be clearly and effectively acquired. This information contains the current node type, whether there are executable events, and whether there are other custom attributes. By judging the information, whether the current node is a target to be captured can be judged, and the name, the node parameter and the node path of the burial point event can be returned according to the judgment result. This content will be used for the subsequent target event matching and buried event injection phases.
In some cases, a portion of the HTML file for the project is written within the JS function of the JS file. For such HTML files, traversal screening needs to be performed on the JS file first, and this part of content is performed when target event matching and embedded point event injection are performed on the JS file. And then, creating corresponding HTML files by adopting the dynamic creation templates in the screened JS functions, and then executing the target event screening step on the newly created HTML files.
In response to the above two cases, at least the following two ways exist in step S11 in the embodiment of the present application:
fig. 2 schematically shows a first implementation flow chart of step S11 in the method for burying a point according to the embodiment of the present invention, including:
s21: acquiring a webpage file of a project;
s22: and performing a first traversal operation on the tags in the webpage file, and determining a plurality of buried point events of the project engineering according to the result of the first traversal operation.
Fig. 3 schematically shows a second implementation flow chart of step S11 in the method for burying a point, according to an embodiment of the present invention, including:
s31: acquiring a script file of a project;
s32: screening a dynamic creation template of the webpage file in the script file;
s33: adopting a dynamic establishing template of the webpage file to establish a corresponding webpage file;
s34: and performing a first traversal operation on the tags in the created webpage file, and determining a plurality of burial point events of the project according to the result of the first traversal operation.
Optionally, the web page file is an HTML file.
Fig. 4 schematically shows a flowchart for implementing step S32 in the method for burying points according to the embodiment of the present invention. As shown in fig. 4, in some embodiments, the step S32 includes:
s41: determining a regular expression of each node of an abstract syntax tree corresponding to the script file;
s42: and judging whether the node is a dynamic creation template of the webpage file or not according to the value of the regular expression.
In particular, source code within a script file (e.g., a JS file) can be translated into an Abstract Syntax Tree (AST). Each node of the abstract syntax tree is abstracted and has certain semantics. Judging whether the node is a dynamic creation template of HTML according to the regular expression of the node; if yes, a corresponding HTML file can be generated, and the process of the target event screening stage is executed. Traversal of the abstract syntax tree nodes can be performed during subsequent target event matching and buried point event injection phases.
In two implementations of the above step S11, the process of performing the first traversal operation on the tags in the web page file (e.g., HTML file) can be as shown in fig. 5. Fig. 5 schematically shows a flowchart for implementing a first traversal operation on a tag in a web page file in a point burying method according to an embodiment of the present invention, where the flowchart includes:
s51: judging whether the label contains an event statement or not;
s52: determining a target event corresponding to the event statement as a buried point event of the project engineering under the condition that the tag contains the event statement;
s53: under the condition that the label does not contain the event statement, judging whether the label type of the label is a label type capable of being clicked or not; and if so, determining the target event corresponding to the click operation in the label as a buried point event of the project engineering.
Taking a web page file as an example, specifically, an HTML file, as shown in fig. 6, fig. 6 schematically shows a tag organization structure diagram of the HTML file, where the HTML file includes a plurality of tags, and the tags in the HTML file are organized in a tree data structure. Each tag in the HTML file corresponds to a DOM node. And traversing a root node of the HTML file, and if a depth-first traversal mode is adopted, taking the tree structure shown in FIG. 6 as an example, sequentially traversing the root node, the first label, the first sub-label, the second sub-label, the third sub-label, the second label and the third label.
Fig. 7 schematically shows a flow chart of implementation of determining a buried point event in the method for burying a point according to an embodiment of the present invention. As shown in FIG. 7, for each traversed tag, the manner of determining a buriable point event includes the following steps:
s71: and acquiring DOM node information.
S72: judging whether the current tag corresponding to the DOM node information contains an event statement or not; if so, go to step S73; if not, go to step S76;
s73: judging whether the current tag contains a buried point parameter; if yes, go to step S74; if not, go to step S75;
s74: the path of the buried point event, the type of the tag (the type of the tag can be: the type of the tag containing the clickable event), the Identification (ID) of the buried point event and the buried point parameters are assembled into an event object. Optionally, the information may be assembled in a JSON (JavaScript Object Notation) data format according to the embodiments of the present application. And then, returning the event object to the buried point event list, and ending the current flow.
S75: the path of the buried point event, the type of tag (tag type: e.g., tag type containing clickable event), and the Identification (ID) of the buried point event are assembled into an event object. Optionally, the foregoing information may be assembled in a JSON data format in embodiments of the present application. And then, returning the event object to the buried point event list, and ending the current flow.
S76: judging whether the tag type of the tag is a clickable tag type (such as an input box, hyperlink jump, and the like), and if so, executing step S77. If not, the tag does not have the corresponding buried point event, and the current flow is ended.
S77: the path of the buried point event, the type of the tag (the type of the tag is a clickable tag), and the Identification (ID) of the buried point event are assembled into an event object. Optionally, the foregoing information may be assembled in a JSON data format in embodiments of the present application. And then, returning the event object to the buried point event list, and ending the current flow.
By adopting the mode for traversing, the embedded point event list based on the HTML label, the corresponding HTML file position and the unique ID of the embedded point event can be obtained through traversing the project engineering directory and traversing all the service components.
In order to effectively identify the specific Interface and User Interface (UI) operation type of an application in which a User behavior occurs, it is necessary to ensure that the automatically created ID is unique. The ID of the buriable point event in an Application (APP) container, namely project ID _ route ID _ components ID _ DOMID _ function ID, can be obtained by combining the project engineering ID (project ID), current service route ID (route ID), component ID where the current event is located (components ID), current click node type ID (DOMID), and current click event ID (function ID).
That is, in the embodiment of the present application, the identification information of the burial point event may include at least one of:
project engineering identification;
a service routing identifier;
a component identification where the buried point event is located;
node type identification of the buried point event;
identification of a buried point event.
Specific embodiments of the target event screening stage are introduced above. And in the subsequent target event matching and embedded point event injection stage, traversing the JS files of the current project according to the result of the target event screening stage, carrying out grammar recognition on each JS file, and adding a corresponding embedded point function to the node when the node matched with the embedded point event in the JS files is recognized.
Fig. 8 schematically shows a flowchart of implementing step S12 in the method for burying points according to an embodiment of the present invention. In some embodiments, as shown in fig. 8, the implementation process of step S12 (i.e. the target event matching phase and the buried event injection phase) includes:
s81: parsing the script file into a first abstract syntax tree;
s82: traversing nodes in the first abstract syntax tree, and acquiring a buried point function corresponding to a plurality of buried point events when the nodes are matched with any one of the buried point events; parsing the buried point function into a second abstract syntax tree, and adding the second abstract syntax tree to the node in the first abstract syntax tree;
s83: and when the nodes in the first abstract syntax tree are traversed, reversely analyzing the added first abstract syntax tree to obtain the script file injected with the embedded point function.
Fig. 9 schematically shows a structure diagram of an abstract syntax tree corresponding to a JS file. As shown in fig. 9, each node of the abstract syntax tree is abstracted and has certain semantics. And traversing the root node of the analyzed abstract syntax tree, and clearly knowing each Application Programming Interface (API) and the code logic thereof in the JS source code according to the context of the node (related information in code execution). And then, by combining the embedded point event obtained by traversing the HTML file, the source code corresponding to the embedded point event can be accurately determined, and the source code can be determined as a target embedded point event function. Further, the corresponding buried point function may be injected into the target buried point event function, that is, the abstract syntax tree corresponding to the buried point function is added to the node corresponding to the target buried point event function.
Fig. 10 schematically shows a flowchart of an implementation of traversing an abstract syntax tree corresponding to a JS file and injecting a point burying function in the point burying method according to an embodiment of the present invention, including the following steps:
s101: and acquiring the JS file of the project.
S102: and analyzing the JS file into an abstract syntax tree.
S103: and acquiring a node in the abstract syntax tree, and performing matching detection on the node and each buried point event in the buried point event list.
S104: judging whether the node is matched with the buried point event or not, if so, executing the step S105; otherwise, step S106 is executed.
S105: and acquiring a buried point function corresponding to the buried point event, analyzing the buried point function into an abstract syntax tree, and adding the abstract syntax tree of the buried point function to the node.
S106: judging whether the node is the last node of the abstract syntax tree obtained by analyzing the JS file, if not, returning to execute the step S103; if yes, the completion of traversing the abstract syntax tree obtained by analyzing the JS file is illustrated, and the step S107 is continuously executed.
S107: and performing inverse analysis on the abstract syntax tree of the JS file after the embedded point function is injected in the process to obtain the script file after the embedded point function is injected.
Taking fig. 9 as an example, assume that the abstract syntax tree of a JS file is a part of fig. 9 except for three child nodes (including left [ a ], operator [ + ], and right [99]) of the node value. When the abstract syntax tree of the JS file is traversed, it is found that the node value corresponds to a buried point event, and the buried point function corresponding to the buried point event is a +99, the buried point function is parsed into an abstract syntax tree, and the abstract syntax tree of the buried point function is added to the abstract syntax tree of the JS file, so that the abstract syntax tree after the buried point function is injected, as shown in fig. 9, is finally obtained. And performing inverse analysis on the abstract syntax tree to obtain the script file injected with the embedded point function.
In some embodiments, the buried point function is stored in a pre-set configuration file that includes at least one of:
project names;
triggering the function name of the embedded point function;
a reference path of the buried point function;
a file directory for performing a site process is required.
In the embodiment of the present application, a configuration file (e.g., a config. json file) in a root directory may be used to record a buried point function. An example of a configuration file is as follows:
Figure BDA0002667569050000141
the automatic point burying scheme aiming at the multi-terminal technical framework is introduced, and the scheme can be completely suitable for the automatic point burying requirement under the common scenes of a single terminal and the like in the same way, and can obtain the same technical effect. Only for the scenario under the multi-terminal technical framework, the proposal of the scheme is more urgent and urgent. The multi-end technology framework is characterized in that: all multi-terminal technical grammars are JavaScript grammars, and the difference is that different multi-terminal frames have different API descriptions or different API implementation modes for a certain transaction. When the multi-terminal technology is developed, the APIs of the multi-terminal technology facing developers are different from each other, so that all methods can be enumerated and identified under a generalized API, and more expansion can be performed under a certain rule. In view of these features, in order to ensure that the source code injected by the project site is clean and free from contamination, the present application further proposes the following two strategies based on the embodiments introduced above:
firstly, a buried point function is injected into a source code of a script file in the packaging process of project engineering; and then, performing packing operation on the source codes after the embedded point function is injected to obtain codes applied to opposite ends in the multi-end frame. Fig. 11 schematically shows a flowchart for implementing point burying in a project engineering packaging process in the point burying method according to an embodiment of the present invention, including the following steps:
s111: and acquiring a source code of the JS file of the project.
S112: and starting a project packaging process.
S113: and analyzing the HTML file of the project engineering to obtain a buried point event list.
S114: and searching a buried point injection position corresponding to the buried point event in the JS file, and performing buried point injection.
Steps S113 and S114 can be implemented by using the buried point method described in the above embodiment.
S115: and packaging the source codes after the embedded point function is injected to obtain codes of corresponding ends.
It can be seen that this approach is not sensible to development and does not alter the source code. If the buried point strategy is adjusted, only repackaging is needed, and no modification is needed to the source code.
The second is to divide into two items, a slave item (such as git A) can be used for developing code, and a master item (such as git B) can be used for management and issuing submission of branches. Accordingly, injecting a buried point function into the code copied from the target repository; and then, storing the codes after the embedded point function is injected into a backup warehouse, and taking the codes in the backup warehouse as release source codes. Wherein the target repository corresponds to a slave item (e.g., git A) that may be used to store code referenced from the item; the backup repository corresponds to a primary item (e.g., git B) and may be used to store code that the primary item refers to.
Fig. 12 schematically shows a flow chart for implementing a buried point in a case of using two items, namely a master item and a slave item, in a buried point method according to an embodiment of the present invention, including the following steps:
s121: and after receiving the code submitted by the user, triggering a construction module (such as a gitlab-cli runner) to construct the project. The code submitted by the user is stored in a target repository A from the project (e.g., git A).
S122: and the building module copies the codes in the target warehouse A and carries out analysis of the embedded point injection script.
S123: and the construction module performs embedded point injection on the copied code so as to modify the code.
S124: and the construction module stores the modified codes into a backup warehouse B corresponding to the main project (such as git B). And when the project engineering is released subsequently, the codes in the backup warehouse B can be used as release source codes.
In summary, the embedded point method provided by the embodiment of the application adopts an automatic embedded point injection mode, can reduce the embedded point cost, improve the efficiency, is not easy to cause the problem of missing key points, has high coverage rate of embedded points, and can provide a certain basis for the follow-up data backtracking. The embedded point method provided by the embodiment of the application is applied to a multi-terminal technical framework, and the embedded point automatic injection can be realized without considering the type of a cross-terminal framework, so that the multi-terminal embedded point technical scheme can be unified, and the request consistency of multi-terminal application embedded point data is realized; because the method is not limited by the cross-end technology type, the development side does not need to modify the source code of the project engineering, so the protection degree of the source code of the project engineering is high, and the source code is not polluted, thereby the readability and the maintainability of the source code are ensured. The point burying method provided by the embodiment of the application is low for the developed threshold, developers of project engineering basically have no perception on the point burying process, and do not need to master any point burying foundation, so that the expandability and universal applicability of automatic point burying are increased, the labor cost of the point burying scheme is saved, and the point burying efficiency is improved. Furthermore, the method provided by the embodiment of the application has high expandability, is not limited to any cross-end technology, and has very low dependence on a cross-end framework; and the requirement on the platform is low, and the method is not limited to any system platform capable of operating.
Exemplary Medium
Having described the method of the exemplary embodiment of the present invention, the medium of the exemplary embodiment of the present invention will next be described with reference to fig. 13.
In some possible embodiments, aspects of the present invention may also be implemented as a computer-readable medium on which a program is stored, which, when executed by a processor, is for implementing the steps in the method of burying points according to various exemplary embodiments of the present invention described in the above section "exemplary methods" of the present specification.
Specifically, the processor is configured to implement the following steps when executing the program: determining a plurality of buriable point events of the project; determining a buried point injection position corresponding to each buried point event in a plurality of buried point events in a script file of a project; and according to the embedded point injection position, the embedded point function is injected into the script file.
It should be noted that: the above-mentioned medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
As shown in fig. 13, a medium 130 according to an embodiment of the present invention is described, which may employ a portable compact disc read only memory (CD-ROM) and include a program, and may be run on a device. However, the invention is not limited in this respect, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
Readable signal media may include data signals propagating in baseband or as part of a carrier wave, in which readable program code is carried. Such a propagated data signal may take a variety of forms, including, but not limited to: an electromagnetic signal, an optical signal, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN).
Exemplary devices
Having described the media of the exemplary embodiments of the present invention, the apparatus of the exemplary embodiments of the present invention is next described with reference to fig. 14.
Fig. 14 schematically shows a schematic structural diagram of a buried point device according to an embodiment of the present invention, including:
a determination module 1410 for determining a plurality of burial point events for a project;
a buried point injection module 1420, configured to determine, in a script file of the project, a buried point injection position corresponding to each of the plurality of buried point events; and the embedded point function is injected into the script file according to the embedded point injection position.
In one possible implementation, the determining module 1410 includes:
the webpage file acquisition sub-module 1411 is used for acquiring a webpage file of a project;
the first determining sub-module 1412 is configured to perform a first traversal operation on the tags in the web page file, and determine a plurality of burial point events of the project according to a result of the first traversal operation.
In one possible implementation, the determining module 1410 includes:
an obtaining sub-module 1413, configured to obtain a script file of the project;
the screening submodule 1414 is used for screening a dynamic creation template of a webpage file in the script file;
the creating sub-module 1415 is used for creating a corresponding webpage file by adopting a dynamic creating template of the webpage file;
the second determining sub-module 1416 is configured to perform a first traversal operation on the tags in the created web page file, and determine a plurality of burial point events of the project according to a result of the first traversal operation.
In one possible implementation, screening submodule 1414 is configured to:
determining a regular expression of each node of an abstract syntax tree corresponding to the script file;
and judging whether the node is a dynamic creation template of the webpage file or not according to the value of the regular expression.
In one possible implementation, the first traversal operation includes:
judging whether the label contains an event statement or not;
under the condition that the label contains the event statement, determining a target event corresponding to the event statement as a buried point event of the project engineering;
under the condition that the label does not contain the event statement, judging whether the label type of the label is a label type capable of being clicked or not; and if so, determining the target event corresponding to the click operation in the tag as a buried point event of the project engineering.
In one possible embodiment, the buried point injection module 1420 includes:
the parsing submodule 1421 is configured to parse the script file into a first abstract syntax tree;
the adding submodule 1422 is configured to traverse a node in the first abstract syntax tree, and obtain a buried point function corresponding to a buried point event when the node is matched with any one of the plurality of buried point events; parsing the buried point function into a second abstract syntax tree, and adding the second abstract syntax tree to nodes in the first abstract syntax tree;
the inverse parsing sub-module 1423 is configured to, when the nodes in the first abstract syntax tree are completely traversed, perform inverse parsing on the added first abstract syntax tree to obtain a script file injected with the embedded point function.
In one possible embodiment, the buried point function is stored in a preset configuration file, and the configuration file comprises at least one of the following:
project names;
triggering a function name of the embedded point function;
a reference path of the buried point function;
a file directory for performing a site process is required.
In one possible implementation, the identification information of the burial point event includes at least one of:
project engineering identification;
a service routing identifier;
a component identification where the buried point event is located;
node type identification of the buried point event;
identification of a buried point event.
In one possible implementation, the embedded point injection module 1420 is configured to inject an embedded point function into source codes of the script file during the project engineering packaging process;
the above-mentioned device still includes: and the packing module 1430 is configured to perform packing operation on the source code after the embedding function is injected, so as to obtain a code applied to an opposite end in the multi-end frame.
In one possible implementation, a buried point injection module 1420 to inject a buried point function into code copied from the target repository;
the above-mentioned device still includes: and the backup module 1440 is configured to store the code after the injection of the fixed point function in the backup repository, and use the code in the backup repository as the release source code.
Exemplary computing device
Having described the method, medium, and apparatus of exemplary embodiments of the present invention, a computing device of exemplary embodiments of the present invention is described next with reference to FIG. 15.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
In some possible implementations, a computing device according to an embodiment of the invention may include at least one processing unit and at least one memory unit. Wherein the storage unit stores program code that, when executed by the processing unit, causes the processing unit to perform the steps in the methods of burial points in accordance with various exemplary embodiments of the present invention as described in the "exemplary methods" section above of this specification.
A computing device 150 according to this embodiment of the invention is described below with reference to fig. 15. The computing device 150 shown in FIG. 15 is only one example and should not impose any limitations on the functionality or scope of use of embodiments of the present invention.
As shown in fig. 15, computing device 150 is embodied in the form of a general purpose computing device. Components of computing device 150 may include, but are not limited to: the at least one processing unit 1501 and the at least one storage unit 1502 are connected to a bus 1503 of different system components (including the processing unit 1501 and the storage unit 1502).
Bus 1503 includes a data bus, a control bus, and an address bus.
The storage unit 1502 may include readable media in the form of volatile memory, such as Random Access Memory (RAM)15021 and/or cache memory 15022, and may further include readable media in the form of non-volatile memory, such as Read Only Memory (ROM) 15023.
The storage unit 1502 may also include a program/utility 15025 having a set (at least one) of program modules 15024, such program modules 15024 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
The computing device 150 may also communicate with one or more external devices 1504 (e.g., keyboard, pointing device, etc.). Such communication may occur via input/output (I/O) interface 1505. Moreover, the computing device 150 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 1506. As shown in fig. 15, the network adapter 1506 communicates with the other modules of the computing device 150 via bus 1503. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the computing device 150, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
It should be noted that although in the above detailed description several units/modules or sub-units/sub-modules of the buried point device are mentioned, such a division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module according to embodiments of the invention. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Further, while the operations of the method of the invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (10)

1. A method of burying a point, comprising:
determining a plurality of buriable point events of the project engineering;
determining a buried point injection position corresponding to each of the plurality of buried point events in a script file of the project; and injecting a buried point function into the script file according to the buried point injection position.
2. The method of claim 1, wherein the determining a plurality of buriable point events for a project comprises:
acquiring a webpage file of the project;
and performing a first traversal operation on the labels in the webpage file, and determining a plurality of burial point events of the project according to the result of the first traversal operation.
3. The method of claim 1, wherein the determining a plurality of buriable point events for a project comprises:
acquiring a script file of the project;
screening a dynamic creation template of a webpage file in the script file;
adopting a dynamic establishing template of the webpage file to establish a corresponding webpage file;
and performing a first traversal operation on the labels in the created webpage file, and determining a plurality of burial point events of the project according to the result of the first traversal operation.
4. The method of claim 3, wherein the filtering the dynamically created templates of the web page files in the script file comprises:
determining a regular expression of each node of an abstract syntax tree corresponding to the script file;
and judging whether the node is a dynamic creation template of the webpage file or not according to the value of the regular expression.
5. The method according to any one of claims 2 to 4, wherein the first traversal operation comprises:
judging whether the tag contains an event statement or not;
under the condition that the tag contains an event statement, determining a target event corresponding to the event statement as a buried point event of the project engineering;
under the condition that the label does not contain the event statement, judging whether the label type of the label is a label type capable of being clicked or not; and if so, determining a target event corresponding to the click operation in the tag as a buried point event of the project engineering.
6. The method of claim 1, wherein the determining, in a script file of the project, a buried point injection location corresponding to each of the plurality of buried point events; and injecting a buried point function into the script file according to the buried point injection position, including:
parsing the script file into a first abstract syntax tree;
traversing nodes in the first abstract syntax tree, and acquiring a buried point function corresponding to the buried point event when the nodes are matched with any one of the plurality of buried point events; parsing the buried point function into a second abstract syntax tree, adding the second abstract syntax tree to the nodes in the first abstract syntax tree;
and when the nodes in the first abstract syntax tree are traversed, reversely analyzing the added first abstract syntax tree to obtain the script file injected into the buried point function.
7. The method of claim 6, wherein the buried point function is stored in a pre-set configuration file comprising at least one of:
project names;
triggering a function name of the embedded point function;
a reference path of the buried point function;
a file directory for performing a site process is required.
8. A point burying device, comprising:
the system comprises a determining module, a processing module and a processing module, wherein the determining module is used for determining a plurality of buriable point events of project engineering;
the embedded point injection module is used for determining an embedded point injection position corresponding to each embedded point event in the plurality of embedded point events in the script file of the project; and injecting a buried point function into the script file according to the buried point injection position.
9. A medium storing a computer program, characterized in that the program, when being executed by a processor, carries out the method according to any one of claims 1-7.
10. A computing device, comprising:
one or more processors;
storage means for storing one or more programs;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method recited in any of claims 1-7.
CN202010923661.7A 2020-09-04 2020-09-04 Buried point method, medium, device and computing equipment Active CN112015467B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010923661.7A CN112015467B (en) 2020-09-04 2020-09-04 Buried point method, medium, device and computing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010923661.7A CN112015467B (en) 2020-09-04 2020-09-04 Buried point method, medium, device and computing equipment

Publications (2)

Publication Number Publication Date
CN112015467A true CN112015467A (en) 2020-12-01
CN112015467B CN112015467B (en) 2024-05-17

Family

ID=73516529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010923661.7A Active CN112015467B (en) 2020-09-04 2020-09-04 Buried point method, medium, device and computing equipment

Country Status (1)

Country Link
CN (1) CN112015467B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112650659A (en) * 2020-12-22 2021-04-13 平安普惠企业管理有限公司 Buried point setting method and device, computer equipment and storage medium
CN113268695A (en) * 2021-05-31 2021-08-17 平安国际智慧城市科技股份有限公司 Data embedding point processing method and device and related equipment
CN113641345A (en) * 2021-08-13 2021-11-12 网易(杭州)网络有限公司 Mapping configuration-based point burying method and device, electronic equipment and storage medium
CN113268695B (en) * 2021-05-31 2024-05-31 深圳赛安特技术服务有限公司 Data embedded point processing method and device and related equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107436832A (en) * 2016-05-27 2017-12-05 阿里巴巴集团控股有限公司 A kind of dynamic buries method, apparatus and electronic equipment a little
CN107562620A (en) * 2017-08-24 2018-01-09 阿里巴巴集团控股有限公司 One kind buries an automatic setting method and device
WO2018113385A1 (en) * 2016-12-24 2018-06-28 上海壹账通金融科技有限公司 Method and system for dynamically tracking application of client, client, and server
CN108536451A (en) * 2016-12-05 2018-09-14 腾讯科技(深圳)有限公司 Application program buries a method for implanting and device
CN108762809A (en) * 2018-05-24 2018-11-06 中国平安人寿保险股份有限公司 Software function extended method, device, computer equipment and storage medium
WO2019100614A1 (en) * 2017-11-22 2019-05-31 平安科技(深圳)有限公司 Buried point data processing method, device, computer device and storage medium
CN110399067A (en) * 2019-07-31 2019-11-01 江苏满运软件科技有限公司 Point methods, device, electronic equipment, storage medium are buried in visualization
CN111090433A (en) * 2019-10-23 2020-05-01 贝壳技术有限公司 Data processing method, device and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107436832A (en) * 2016-05-27 2017-12-05 阿里巴巴集团控股有限公司 A kind of dynamic buries method, apparatus and electronic equipment a little
CN108536451A (en) * 2016-12-05 2018-09-14 腾讯科技(深圳)有限公司 Application program buries a method for implanting and device
WO2018113385A1 (en) * 2016-12-24 2018-06-28 上海壹账通金融科技有限公司 Method and system for dynamically tracking application of client, client, and server
CN107562620A (en) * 2017-08-24 2018-01-09 阿里巴巴集团控股有限公司 One kind buries an automatic setting method and device
WO2019100614A1 (en) * 2017-11-22 2019-05-31 平安科技(深圳)有限公司 Buried point data processing method, device, computer device and storage medium
CN108762809A (en) * 2018-05-24 2018-11-06 中国平安人寿保险股份有限公司 Software function extended method, device, computer equipment and storage medium
CN110399067A (en) * 2019-07-31 2019-11-01 江苏满运软件科技有限公司 Point methods, device, electronic equipment, storage medium are buried in visualization
CN111090433A (en) * 2019-10-23 2020-05-01 贝壳技术有限公司 Data processing method, device and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112650659A (en) * 2020-12-22 2021-04-13 平安普惠企业管理有限公司 Buried point setting method and device, computer equipment and storage medium
CN113268695A (en) * 2021-05-31 2021-08-17 平安国际智慧城市科技股份有限公司 Data embedding point processing method and device and related equipment
CN113268695B (en) * 2021-05-31 2024-05-31 深圳赛安特技术服务有限公司 Data embedded point processing method and device and related equipment
CN113641345A (en) * 2021-08-13 2021-11-12 网易(杭州)网络有限公司 Mapping configuration-based point burying method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112015467B (en) 2024-05-17

Similar Documents

Publication Publication Date Title
CN107423048B (en) Data collection method, device, medium and computing equipment
Sen et al. Jalangi: A selective record-replay and dynamic analysis framework for JavaScript
CN111240689B (en) Application program construction method, device, equipment and storage medium
CN104572043A (en) Method and device for embedding points for controls of client application in real time
CN104346153A (en) Method and system for translating text information of application programs
US20180024848A1 (en) Translatable Texts Identification in In-Context Localization Utilizing Pseudo-Language and an External Server
US20120278699A1 (en) System and method for exclusion of irrelevant data from a dom equivalence
US20150142825A1 (en) Converting procedural text to an actionable knowledge form
CN104657402A (en) Language Tag Management On International Data Storage
CN112015467B (en) Buried point method, medium, device and computing equipment
CN111176629A (en) Application development method and device
CN110618940A (en) Stack information tracking method and device, computer readable medium and computing device
CN114138244A (en) Method and device for automatically generating model files, storage medium and electronic equipment
CN113051514A (en) Element positioning method and device, electronic equipment and storage medium
US10656922B2 (en) Systems and methods for providing an application transformation tool
CN110716804A (en) Method and device for automatically deleting useless resources, storage medium and electronic equipment
CN114356964A (en) Data blood margin construction method and device, storage medium and electronic equipment
CN112306501A (en) Business data acquisition method and device, storage medium and computing equipment
CN110045952B (en) Code calling method and device
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
US10509659B1 (en) Input processing logic to produce outputs for downstream systems using configurations
CN116010461A (en) Data blood relationship analysis method and device, storage medium and electronic equipment
CN113141407B (en) Page resource loading method and device and electronic equipment
CN114090514A (en) Log retrieval method and device for distributed system
US20090037466A1 (en) Method and system for resolving feature dependencies of an integrated development environment with extensible plug-in features

Legal Events

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