Disclosure of Invention
In view of the above, the present invention provides a method and a system for tracking a web device, which are used to identify a web device accessing a corresponding website, so as to track the web device.
In order to solve the above problems, the present invention discloses a tracking method for web devices, which is applied to a server of a website, and the tracking method specifically comprises the following steps:
deploying a preset information acquisition script on a web page, wherein the information acquisition script is used for acquiring equipment information of web equipment and uploading the equipment information to the server when a user browses the web page by using the web equipment;
processing the equipment information by using a preset algorithm to obtain an equipment identifier of the web equipment;
and performing matching operation from a preset equipment library according to the equipment identifier, and returning the equipment id matched with the equipment identifier.
Optionally, the device information includes environment information and software information.
Optionally, the device information further includes cookie information uploaded by the server.
Optionally, the processing the device information by using a preset algorithm includes:
sorting various types of information in the equipment information according to a preset rule to obtain an information group;
and processing the information group according to a preset hash algorithm to obtain a corresponding variable value, and taking the variable value as the equipment identifier.
Optionally, the performing matching operation from a preset device library according to the device identifier and returning a device id matched with the device identifier includes:
performing query operation from the equipment library according to the equipment identifier;
when the device id matched with the device identifier is inquired, returning the device id;
and when the device id matched with the device identifier does not exist in the device library, allocating a new id to the web device, and returning the new id as the device id.
Optionally, the tracking method further includes the steps of:
packaging the device id to generate new cookie information containing the device id;
and writing the new cookie information into a preset browser of the web device.
Correspondingly, in order to implement the method provided above, the present invention further provides a tracking system for web devices, which is applied to a server of a website, and the tracking system specifically includes:
the system comprises a script presetting module, a server and a script display module, wherein the script presetting module is used for deploying a preset information acquisition script on a web page, and the information acquisition script is used for acquiring equipment information of web equipment and uploading the equipment information to the server when a user browses the web page by using the web equipment;
the identifier calculation module is used for processing the equipment information by using a preset algorithm to obtain an equipment identifier of the web equipment;
and the equipment matching module is used for performing matching operation from a preset equipment library according to the equipment identifier and returning the equipment id matched with the equipment identifier.
Optionally, the device information includes environment information and software information.
Optionally, the device information further includes cookie information uploaded by the server.
Optionally, the identifier calculation module includes:
the information sorting unit is used for sorting various types of information in the equipment information according to a preset rule to obtain an information group;
and the variable value calculating unit is used for processing the information group according to a preset hash algorithm to obtain a corresponding variable value, and the variable value is used as the equipment identifier.
Optionally, the device matching module includes:
the equipment query unit is used for performing query operation from the equipment library according to the equipment identifier;
the first returning unit is used for returning the equipment id after inquiring the equipment id matched with the equipment identifier;
and the second returning unit is used for distributing a new id to the web device when the device id matched with the device identifier does not exist in the device library, and returning the new id as the device id.
Optionally, the tracking system further includes:
the information packaging module is used for packaging the equipment id and generating new cookie information containing the equipment id;
and the information writing module is used for writing the new cookie information into a preset browser of the web equipment.
The technical scheme can be seen that the invention provides a tracking method and a system of web equipment, which are applied to a server of a website, and the tracking method and the system are specifically characterized in that a preset information acquisition script is deployed on a web page, and the information acquisition script is used for acquiring equipment information of the web equipment and uploading the equipment information to the server when a user browses the web page by using the web equipment; processing the equipment information by using a preset algorithm to obtain an equipment identifier of the web equipment; and performing matching operation from a preset equipment library according to the equipment identifier, and returning the equipment id matched with the equipment identifier. Since the scheme does not depend on cookie information which can be cleared by the user, the web device can be identified even if the user regularly clears cookies, so that stable tracking of the web device is realized.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Fig. 1 is a flowchart illustrating steps of a method for tracking a web device according to an embodiment of the present invention.
Referring to fig. 1, the tracking method for web devices provided in this embodiment is applied to a server of a website, and is used for tracking the web devices by using a device representation method, where the specific tracking method includes the following steps:
s101: and deploying a preset information acquisition script on the web page.
That is, a web page stored on the server is preprocessed, for example, the web page of a website is used to obtain other portal pages, and the preprocessing method is to deploy an executable information collection script, such as an executable javascript script language, on the web page. The information acquisition script is automatically executed when a user browses a corresponding web page by using the web device, acquires the device information of the web device by executing the information acquisition script and uploads the device information to the server in an encryption mode.
The device information specifically includes environment information and software information of the web device. If cookie information uploaded by the server at the previous time is stored in the browser of the web device, the obtained device information further includes the cookie information.
S102: a device identifier of the web device is calculated from the device information.
After the device information including the environment information, the user information and the like is obtained, the device information is processed by using a preset algorithm, and a device identifier capable of identifying the web device is obtained.
For example, the device identifier may include a first identifier reflecting application layer information of the web device, a second identifier reflecting user layer information of the web device, and a third identifier, which is cookie information uploaded by the user.
When the device identifier is calculated, the received device information, such as environment information and environment information, is sorted according to a certain preset rule to obtain an information group; and then, processing the obtained information group according to a preset hash algorithm to obtain a corresponding variable value, wherein the variable value is used as the equipment identifier of the web equipment due to the uniqueness of the variable value.
S103: and tracking the web device according to the device identifier and a preset device library.
After the device identifier is obtained, matching query is carried out from a preset device library by using the device identifier, and a device id matched with the device identifier is returned from the device library according to a matching result, so that the tracking of the web device is realized. The device library stores a plurality of device identifiers and device ids corresponding to the respective device identifiers in a list format.
In the process of matching the equipment identifier, firstly, inquiring from the equipment library according to the equipment identifier; when the device id corresponding to the device identifier is inquired, returning the device id; if the device id corresponding to the device id is not queried, a new id is allocated to the web device, specifically, a random code of 32 bits is generated by using a random algorithm, and the random code is stored as the device id corresponding to the device identifier, and the device id is returned at the same time.
Taking the example that the device identifier includes the first identifier, the second identifier and the third identifier, performing matching query according to the above sequence as priority, and when the device identifier is specifically matched:
and associating the device ids according to the dimension of the first identifier, the second identifier and the third identifier of the search priority. If the matching result is null, the device is a new device, a 32-bit random code which cannot be collided is randomly generated for the new device, the device id is used, and the relationship between the new device and the 3 dimensions is stored in a device library.
If all the matching results are not null, the device is indicated as old equipment and the equipment information is not changed, and the matching results are directly returned.
And if the matching result of the first identifier and the third identifier is not null, the matching result of the second identifier is null, which indicates that the equipment is old equipment and the equipment information is changed, updating the second identifier and returning the matching result of the first identifier.
And if the matching result of the first identifier and the second identifier is not null, and the matching result of the third identifier is null, the cookie is cleared by the user, is updated, and the matching result of the first identifier is returned.
And if the matching result of the first identifier is not null and the matching result of the second identifier and the third identifier is null, indicating that the user clears the cookie information, updating the second identifier and the third identifier and returning the matching result of the first identifier.
And if the matching result of the second identifier and the third identifier is not null and the matching result of the first identifier is null, updating the first identifier and returning the matching result of the second identifier.
And if the matching result of the third identifier is not null and the matching result of the first identifier and the second identifier is null, updating the first identifier and the second identifier and returning the matching result of the third identifier.
It can be seen from the foregoing technical solutions that, the present embodiment provides a tracking method for a web device, which is applied to a server of a website, and the tracking method specifically includes deploying a preset information acquisition script to a web page, where the information acquisition script is used to acquire device information of the web device and upload the device information to the server when a user browses the web page by using the web device; processing the equipment information by using a preset algorithm to obtain an equipment identifier of the web equipment; and performing matching operation from a preset equipment library according to the equipment identifier, and returning the equipment id matched with the equipment identifier. Since the scheme does not depend on cookie information which can be cleared by the user, the web device can be identified even if the user regularly clears cookies, so that stable tracking of the web device is realized.
Example two
Fig. 2 is a flowchart illustrating steps of another embodiment of a method for tracking a web device according to the present invention.
Referring to fig. 2, the tracking method for web devices provided in this embodiment is applied to a server of a website, and is used for tracking the web devices by using a device representation method, where the specific tracking method includes the following steps:
s201: and deploying a preset information acquisition script on the web page.
That is, a web page stored on the server is preprocessed, for example, the web page of a website is used to obtain other portal pages, and the preprocessing method is to deploy an executable information collection script, such as an executable javascript script language, on the web page. The information acquisition script is automatically executed when a user browses a corresponding web page by using the web device, acquires the device information of the web device by executing the information acquisition script and uploads the device information to the server in an encryption mode.
The device information specifically includes environment information and software information of the web device. If cookie information uploaded by the server at the previous time is stored in the browser of the web device, the obtained device information further includes the cookie information.
S202: a device identifier of the web device is calculated from the device information.
After the device information including the environment information, the user information and the like is obtained, the device information is processed by using a preset algorithm, and a device identifier capable of identifying the web device is obtained.
For example, the device identifier may include a first identifier reflecting application layer information of the web device, a second identifier reflecting user layer information of the web device, and a third identifier, which is cookie information uploaded by the user.
When the device identifier is calculated, the received device information, such as environment information and environment information, is sorted according to a certain preset rule to obtain an information group; and then, processing the obtained information group according to a preset hash algorithm to obtain a corresponding variable value, wherein the variable value is used as the equipment identifier of the web equipment due to the uniqueness of the variable value.
S203: and tracking the web device according to the device identifier and a preset device library.
After the device identifier is obtained, matching query is carried out from a preset device library by using the device identifier, and a device id matched with the device identifier is returned from the device library according to a matching result, so that the tracking of the web device is realized. The device library stores a plurality of device identifiers and device ids corresponding to the respective device identifiers in a list format.
In the process of matching the equipment identifier, firstly, inquiring from the equipment library according to the equipment identifier; when the device id corresponding to the device identifier is inquired, returning the device id; if the device id corresponding to the device id is not queried, a new id is allocated to the web device, specifically, a random code of 32 bits is generated by using a random algorithm, and the random code is stored as the device id corresponding to the device identifier, and the device id is returned at the same time.
Taking the example that the device identifier includes the first identifier, the second identifier and the third identifier, performing matching query according to the above sequence as priority, and when the device identifier is specifically matched:
and associating the device ids according to the dimension of the first identifier, the second identifier and the third identifier of the search priority. If the matching result is null, the device is a new device, a 32-bit random code which cannot be collided is randomly generated for the new device, the device id is used, and the relationship between the new device and the 3 dimensions is stored in a device library.
If all the matching results are not null, the device is indicated as old equipment and the equipment information is not changed, and the matching results are directly returned.
And if the matching result of the first identifier and the third identifier is not null, the matching result of the second identifier is null, which indicates that the equipment is old equipment and the equipment information is changed, updating the second identifier and returning the matching result of the first identifier.
And if the matching result of the first identifier and the second identifier is not null, and the matching result of the third identifier is null, the cookie is cleared by the user, is updated, and the matching result of the first identifier is returned.
And if the matching result of the first identifier is not null and the matching result of the second identifier and the third identifier is null, indicating that the user clears the cookie information, updating the second identifier and the third identifier and returning the matching result of the first identifier.
And if the matching result of the second identifier and the third identifier is not null and the matching result of the first identifier is null, updating the first identifier and returning the matching result of the second identifier.
And if the matching result of the third identifier is not null and the matching result of the first identifier and the second identifier is null, updating the first identifier and the second identifier and returning the matching result of the third identifier.
S204: and packaging the obtained device id into new cookie information.
After obtaining the device id, the device id is encapsulated to facilitate the following tracking of the web device, so as to obtain a new cookie information containing the device id.
S205: the new cookie information is written to the web device.
After obtaining the new cookie information, uploading the new cookie information to the web device, and writing the new cookie information into a browser of the web device, wherein the browser calls the browser implanted with the information acquisition script through the browser.
It can be seen from the foregoing technical solutions that, the present embodiment provides another tracking method for web devices, which is applied to a server of a website, where the tracking method specifically includes deploying a preset information acquisition script to a web page, where the information acquisition script is used to acquire device information of the web device and upload the device information to the server when a user browses the web page by using the web device; processing the equipment information by using a preset algorithm to obtain an equipment identifier of the web equipment; and performing matching operation from a preset equipment library according to the equipment identifier, and returning the equipment id matched with the equipment identifier. Since the scheme does not depend on cookie information which can be cleared by the user, the web device can be identified even if the user regularly clears cookies, so that stable tracking of the web device is realized. And by generating and writing the new cookie information into the web device, the corresponding purpose can be achieved by directly reading the new cookie information when the web device is tracked subsequently.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
EXAMPLE III
Fig. 3 is a block diagram of a tracking system of a web device according to an embodiment of the present invention.
Referring to fig. 3, the tracking system for web devices provided in this embodiment is applied to a server of a website, and is used for tracking a web device by a device profiling method, and the tracking system includes a script presetting module 10, an identifier calculating module 20, and a device matching module 30.
The script presetting module 10 is used for deploying preset information acquisition scripts on the web page.
That is, a web page stored on the server is preprocessed, for example, the web page of a website is used to obtain other portal pages, and the preprocessing method is to deploy an executable information collection script, such as an executable javascript script language, on the web page. The information acquisition script is automatically executed when a user browses a corresponding web page by using the web device, acquires the device information of the web device by executing the information acquisition script and uploads the device information to the server in an encryption mode.
The device information specifically includes environment information and software information of the web device. If cookie information uploaded by the server at the previous time is stored in the browser of the web device, the obtained device information further includes the cookie information.
The identifier calculation module 20 is configured to calculate a device identifier of the web device based on the device information.
After the device information including the environment information, the user information, and the like is obtained by using the information acquisition script preset by the script presetting module 10, the identifier calculating module 20 processes the device information by using a preset algorithm to obtain a device identifier capable of identifying the web device.
For example, the device identifier may include a first identifier reflecting application layer information of the web device, a second identifier reflecting user layer information of the web device, and a third identifier, which is cookie information uploaded by the user.
The identifier calculation module 20 specifically includes an information sorting unit 21 and a variable value calculation unit 22, where when the device identifier is calculated, the information sorting unit 21 is configured to sort device information, such as environment information and environment information, uploaded by an information acquisition script according to a certain preset rule to obtain an information group; the variable value calculating unit 22 is configured to process the obtained information group according to a preset hash algorithm to obtain a corresponding variable value, and use the variable value as the device identifier of the web device due to uniqueness of the variable value.
The device matching module 30 is configured to track the web device according to the device identifier and a preset device library.
After the identifier calculation module 20 obtains the device identifier, the device matching module 30 performs matching query from a preset device library by using the device identifier, and returns a device id matched with the device identifier from the device library according to a matching result, thereby tracking the web device. The device library stores a plurality of device identifiers and device ids corresponding to the respective device identifiers in a list format.
The device matching module 30 includes a device querying unit 31, a first returning unit 32, and a second returning unit. In the process of matching the device identifier, the device query unit 31 is configured to query the device library according to the device identifier; the first returning unit 32 is configured to return the device id when the device id corresponding to the device identifier is queried by the device querying unit 31; the second returning unit 33 allocates a new id to the web device when the device id corresponding to the new id is not queried by the device querying unit 31, specifically, a 32-bit random code may be generated by using a random algorithm, and the random code is stored as the device id corresponding to the device identifier, and the device id is returned at the same time.
Taking the example that the device identifier includes the first identifier, the second identifier and the third identifier, performing matching query according to the above sequence as priority, and when the device identifier is specifically matched:
and associating the device ids according to the dimension of the first identifier, the second identifier and the third identifier of the search priority. If the matching result is null, the device is a new device, a 32-bit random code which cannot be collided is randomly generated for the new device, the device id is used, and the relationship between the new device and the 3 dimensions is stored in a device library.
If all the matching results are not null, the device is indicated as old equipment and the equipment information is not changed, and the matching results are directly returned.
And if the matching result of the first identifier and the third identifier is not null, the matching result of the second identifier is null, which indicates that the equipment is old equipment and the equipment information is changed, updating the second identifier and returning the matching result of the first identifier.
And if the matching result of the first identifier and the second identifier is not null, and the matching result of the third identifier is null, the cookie is cleared by the user, is updated, and the matching result of the first identifier is returned.
And if the matching result of the first identifier is not null and the matching result of the second identifier and the third identifier is null, indicating that the user clears the cookie information, updating the second identifier and the third identifier and returning the matching result of the first identifier.
And if the matching result of the second identifier and the third identifier is not null and the matching result of the first identifier is null, updating the first identifier and returning the matching result of the second identifier.
And if the matching result of the third identifier is not null and the matching result of the first identifier and the second identifier is null, updating the first identifier and the second identifier and returning the matching result of the third identifier.
It can be seen from the foregoing technical solutions that, the present embodiment provides a tracking method for a web device, which is applied to a server of a website, and the tracking method specifically includes deploying a preset information acquisition script to a web page, where the information acquisition script is used to acquire device information of the web device and upload the device information to the server when a user browses the web page by using the web device; processing the equipment information by using a preset algorithm to obtain an equipment identifier of the web equipment; and performing matching operation from a preset equipment library according to the equipment identifier, and returning the equipment id matched with the equipment identifier. Since the scheme does not depend on cookie information which can be cleared by the user, the web device can be identified even if the user regularly clears cookies, so that stable tracking of the web device is realized.
Example four
Fig. 4 is a block diagram of a tracking system of another web device according to another embodiment of the present invention.
Referring to fig. 4, the tracking system for web devices provided in this embodiment is added with an information encapsulation module 40 and an information writing module 50 on the basis of the previous embodiment.
The information encapsulating module 40 is configured to encapsulate the device id of the web device after the device matching module 30 obtains the device id, so as to facilitate subsequent tracking of the web device, thereby obtaining new cookie information containing the device id.
The information writing module 50 uploads the new cookie information to the web device after the information encapsulating module 40 obtains the new cookie information, and writes the new cookie information into the browser of the web device, where the browser is a browser through which the web device calls the embedded information collecting script.
Compared with the previous embodiment, on the basis of tracking the web device, the embodiment generates and writes the new cookie information into the web device, so that the new cookie information can be directly read when the web device is tracked subsequently, and the corresponding purpose can be achieved.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The technical solutions provided by the present invention are described in detail above, and the principle and the implementation of the present invention are explained in this document by applying specific examples, and the descriptions of the above examples are only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.