CN107704605B - User behavior recording method based on local storage - Google Patents
User behavior recording method based on local storage Download PDFInfo
- Publication number
- CN107704605B CN107704605B CN201710960872.6A CN201710960872A CN107704605B CN 107704605 B CN107704605 B CN 107704605B CN 201710960872 A CN201710960872 A CN 201710960872A CN 107704605 B CN107704605 B CN 107704605B
- Authority
- CN
- China
- Prior art keywords
- page
- local
- user behavior
- data object
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 20
- 238000013500 data storage Methods 0.000 claims description 5
- 230000002159 abnormal effect Effects 0.000 claims description 3
- 238000001514 detection method Methods 0.000 claims description 3
- 239000012634 fragment Substances 0.000 abstract description 2
- 230000006399 behavior Effects 0.000 description 39
- 238000005516 engineering process Methods 0.000 description 3
- 235000014510 cooky Nutrition 0.000 description 2
- 230000010354 integration Effects 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 239000002360 explosive Substances 0.000 description 1
- 238000013467 fragmentation Methods 0.000 description 1
- 238000006062 fragmentation reaction Methods 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000011835 investigation Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/955—Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/951—Indexing; Web crawling techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/02—Marketing; Price estimation or determination; Fundraising
- G06Q30/0201—Market modelling; Market analysis; Collecting market data
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Business, Economics & Management (AREA)
- Strategic Management (AREA)
- Finance (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- Accounting & Taxation (AREA)
- Development Economics (AREA)
- General Physics & Mathematics (AREA)
- Entrepreneurship & Innovation (AREA)
- General Engineering & Computer Science (AREA)
- Game Theory and Decision Science (AREA)
- Economics (AREA)
- Marketing (AREA)
- General Business, Economics & Management (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention relates to a user behavior recording method based on local storage, which comprises the following steps that (1) the state of an opened page is judged; (2) saving the page data object to a local database; (3) the page sends a local page data object to a server within preset time; (4) and (5) processing a page closing event. The invention takes the data of the whole website as a whole rather than fragments, adopts a mode of sharing the stored data objects to store the data to the local at regular time, finishes the preliminary data statistics at the user end, sends the data at intervals, and only one page is responsible for sending under the condition of multiple pages, thereby reducing the request of the server end.
Description
Technical Field
The invention belongs to network technology application, and particularly relates to a user behavior recording method based on local storage.
Background
Due to the rapid development of modern services, user behavior data gradually becomes important data information of service providers, products which are popular with users can be made according to user behaviors, market coupon investigation is mostly utilized in the traditional industry, and in the field of internet services, the service providers can teach and conveniently count the behavior data of the users by relying on web technology.
With the rapid development of the internet, the number of a series of internet companies such as electronic commerce and online platforms is rapidly increased, and the number of internet users is also increased day by day, so that the internet companies can develop products with more user attraction by adopting the behavior data of the users to improve the competitiveness of the internet companies in the same industry. In order to obtain the behavior data of the user, a large amount of server-side operations and strong server-side bearing pressure are required. With the explosive increase of the request quantity, the request quantity and the statistical calculation quantity of the user behavior data are larger and larger. The contradiction between the high cost of servers and the increasing data processing requirements is increasing. And a part of data processing is placed at the user side, so that the pressure of the service side can be greatly relieved.
However, most of the conventional technologies use an interactive data statistics method, and trigger a data request through actions such as clicking by a user and mouse movement, so as to send out the current action of the user. The method has the disadvantages that the behavior data of the user is sent to the background in a fragmental manner, the background needs to perform data integration, the sending interval of the data is short, and in large-flow and multi-interaction websites (such as some E-commerce websites), great request pressure and operation pressure are brought to the server of the background. Greatly increasing the operating cost of the service provider.
The prior best technical scheme is to temporarily store the user behavior into the cookie and stabilize the request quantity by sending data at regular time. And the back end integrates the user data statistics. However, in this way, in the case of simultaneous opening of multiple pages, the number of requests will gradually increase, and the capacity of the cookie is limited, so that it is impossible to store too fine user behavior data, and meanwhile, the server also needs to perform a large amount of fragmentation data statistics.
Disclosure of Invention
In view of the above, the present invention is to overcome the defects in the prior art, and provide a method for recording user behavior based on local storage.
In order to achieve the purpose, the invention adopts the following technical scheme:
the improvement of a user behavior recording method based on local storage is that:
(1) judging the state of the opened page;
(2) saving the page data object to a local database;
(3) the page sends a local page data object to a server within preset time;
(4) and (5) processing a page closing event.
Preferably, the step (1) includes judging whether the opened page has user behavior data stored in a local database;
when the website is opened for the first time, initializing a user behavior data object according to the configuration parameters, and generating a first page data object containing the user behavior data object by taking a url of a current page or a unique parameter of a related page as a key name;
and when the user behavior data object exists in the local database, judging whether the current browser opens the page which is the same as the user behavior data object in the local database again.
Further, judging through the page correlation attributes related to the sub-elements of the user behavior data object in the local database, if the same page exists, storing the user behavior data of the current browser into the same page data object under the same page.
Further, if the same page does not exist, a page data object is newly established to record all user behavior data of the current browser.
Preferably, the step (2) comprises
And saving the page data object containing the user behavior data object into the local data object of the local database at regular time.
Furthermore, the page data object in the local data object can define the event by self, trigger data storage through button clicking of a user and/or module sliding, and update the end time attribute of the recorded event.
Preferably, the step (3) comprises
All pages send the whole page data object in the local database to the server within the preset time, each page generates the standard time for sending the next data after sending, when all pages trigger the time for sending the local page data object within the preset time, the current time is compared with the standard time for generating the next data sending, and if the error range is within, the page sends the local page data object; if not, the local page data object is not sent.
Preferably, the step (4) comprises
And triggering a detection event before closing the page when the page is closed, judging the current page state, processing and closing the current page.
Further, judging the current page state and processing the current page state comprises detecting whether the current page is the only page opened by the website, and if not, not triggering any operation; if so, the local page data object is emptied after being sent to the server all the time, and the page is closed.
Further, the method also comprises
When the page is opened, when the user behavior data objects exist in the local database, the whole page ending time and the current starting time are compared, if the error between the interval time and the interval data storage time in the configuration is too large, the local data record is considered to be an abnormal record, a website manager can select to delete or reinitialize the local data record after sending, and the website is prevented from being suddenly closed under an unexpected condition, so that the page cannot trigger the operation of sending all the local page data objects before closing.
The invention adopts the technical proposal that the invention adopts the technical proposal,
the invention adopts a mode of sharing the stored data object to store data to the local at regular time; checking local data, finding that the data with the same identification exists, and indicating that a page corresponding to the data is closed and a receipt is newly added, wherein the ending time and the current starting time exceed the timing recording time; the invention can greatly reduce the number of data requests, carry out primary data integration statistics on the user web and reduce the operation pressure of the server.
The invention takes the data of the whole website as a whole instead of fragments, primary data statistics is already completed at the user end, the data is sent at intervals, and only one page is responsible for sending under the condition of multiple pages, thereby reducing the request of the server end. The Localstorage has a large capacity and can store a large amount of data.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for recording user behavior based on local storage according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
The invention aims at the increase of a large amount of behavior data requests and operation pressure caused by the increase of users. In order to solve the contradiction between the high cost of the server and the increasing data processing requirements, the implementation method of the user behavior statistics which utilizes the preliminary statistical data of the client and is uniformly sent at intervals comprises the following steps:
step 101, opening a page, judging whether the opened page has user behavior data stored in a local database (local Localstorage), if not, determining that the opened page is opened for the first time, initializing a user behavior data object according to configuration parameters, and generating a first page data object by taking a url of the current page or a unique parameter of a related page as a key name, so as to record all user behaviors of the page. And then storing the user behavior data object into a local database, and generating a start time attribute and an end time attribute of the whole record. (the value of this attribute is assigned by the server, and local time is not used).
Wherein the localStorage attribute allows you to access a localStorage object. The data stored in localStorage has no expiration time.
And 102, if the user behavior data object exists in the local database, judging whether the current browser opens the page which is the same as the user behavior data object in the local database again. And judging through the related page correlation attributes of the sub-elements of the user behavior data object in the local database.
And if the same page exists, storing the user behavior data of the current browser into the same page data object under the same page. If the same page exists in the local database, but the termination time and the starting time of the current browser exceed the timing record time, it is indicated that the page corresponding to the same page exists in the local database and is closed before, and a piece of data is added. And the timing recording time is actually set according to the server requirement.
And if the same page does not exist, a page data object is newly established and used for recording all user behavior data of the current browser.
Step 103, regularly saving the page data object containing the user behavior data object into the local data object of the local database, or performing a custom event operation on the page data object in the local data object, and triggering data saving by some behaviors of the user (for example, clicking a specified page button, and sliding a module). And updating the recording event end time attribute.
And step 104, sending the whole page data object in the local database to a server by all the pages within preset time, generating standard time for sending next data after each page is sent, comparing the current time with the standard time for generating the next data sending when all the pages trigger the time for sending the local page data object within the preset time, if the time is within an error range, sending the local page data object by the page, and if the time is not within the error range, not sending the local page data object, which indicates that the local page data object is sent by other pages, so that only one page is responsible for sending the local data object regularly when the website opens multiple pages simultaneously. The preset time is actually set according to the server requirement.
Step 105, triggering a detection event before page closing when the page is closed, judging the current page state and closing after processing, judging the current page state and processing, including detecting whether the current page is the only opened page of the website, if not, not triggering any operation, if so, sending all local data once to a server, emptying a local page data object, and closing the page.
Step 106, when the page is opened, it is found that the user behavior data object is already stored in the local database, the overall end time and the current start time of the user behavior data object need to be compared, if the error between the interval time and the interval data storage time in the configuration is too large, the local data record is considered to be an abnormal record, a website manager can select to delete or reinitialize the local data record after sending, and the website manager is prevented from suddenly closing the website caused by other accidents, so that the page cannot trigger the operation of sending all data and emptying the local data before closing.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
Claims (7)
1. A user behavior recording method based on local storage is characterized in that:
(1) judging the state of the opened page;
(2) saving the page data object to a local database;
(3) the page sends a local page data object to a server within preset time;
(4) processing a page closing event;
wherein,
the step (1) comprises judging whether the opened page has user behavior data stored in a local database;
when the website is opened for the first time, initializing a user behavior data object according to the configuration parameters, and generating a first page data object containing the user behavior data object by taking a url of a current page or a unique parameter of a related page as a key name; when the user behavior data object exists in the local database, judging whether the current browser opens the page which is the same as the user behavior data object in the local database again;
the step (2) comprises the steps of regularly saving page data objects containing user behavior data objects into local data objects of a local database;
the step (3) includes that all pages send the whole page data object in the local database to the server within the preset time, each page generates the standard time for sending the next data after sending, when all pages trigger the time for sending the local page data object within the preset time, the current time is compared with the standard time for generating the next data sending, and within the error range, the local page data object is sent by the page: if not, the local page data object is not sent.
2. The method for recording the user behavior based on the local storage according to claim 1, wherein: judging through the related page correlation attributes of the sub-elements of the user behavior data object in the local database, and if the same page exists, storing the user behavior data of the current browser into the same page data object under the same page.
3. The method for recording user behavior based on local storage according to claim 2, wherein: and if the same page does not exist, a page data object is newly established and used for recording all user behavior data of the current browser.
4. The method for recording the user behavior based on the local storage according to claim 1, wherein: the page data object in the local data object can define the event by self, trigger data storage through button clicking of a user and/or module sliding, and update the end time attribute of the recorded event.
5. The method for recording the user behavior based on the local storage according to claim 1, wherein: the step (4) comprises
And triggering a detection event before closing the page when the page is closed, judging the current page state, processing and closing the current page.
6. The method of claim 5, wherein the user behavior recording method based on local storage comprises: judging the current page state and processing the current page state, wherein the current page state comprises the steps of detecting whether the current page is the only opened page of the website, and if not, not triggering any operation; if so, the local page data object is emptied after being sent to the server all the time, and the page is closed.
7. The method for recording the user behavior based on the local storage according to claim 1, wherein: the method also comprises
When the page is opened, when the user behavior data objects exist in the local database, the whole page ending time and the current starting time are compared, if the error between the interval time and the interval data storage time in the configuration is too large, the local data record is considered to be an abnormal record, a website manager can select to delete or reinitialize the local data record after sending, and the website is prevented from being suddenly closed under an unexpected condition, so that the page cannot trigger the operation of sending all the local page data objects before closing.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710960872.6A CN107704605B (en) | 2017-10-13 | 2017-10-13 | User behavior recording method based on local storage |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710960872.6A CN107704605B (en) | 2017-10-13 | 2017-10-13 | User behavior recording method based on local storage |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107704605A CN107704605A (en) | 2018-02-16 |
CN107704605B true CN107704605B (en) | 2021-04-09 |
Family
ID=61183797
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710960872.6A Active CN107704605B (en) | 2017-10-13 | 2017-10-13 | User behavior recording method based on local storage |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107704605B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109740098B (en) * | 2018-12-29 | 2022-01-11 | 深圳点猫科技有限公司 | Application processing method based on multi-page window and electronic equipment |
CN109902253A (en) * | 2019-01-18 | 2019-06-18 | 中国平安人寿保险股份有限公司 | Page data acquisition method and device, electronic equipment, storage medium |
CN110532159B (en) * | 2019-09-03 | 2023-04-18 | 北京百度网讯科技有限公司 | Data monitoring method, device, equipment and computer readable storage medium |
CN112860688A (en) * | 2020-12-31 | 2021-05-28 | 佛山欧神诺云商科技有限公司 | Time-based data storage method, terminal and storage device |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102946319A (en) * | 2012-09-29 | 2013-02-27 | 焦点科技股份有限公司 | System and method for analyzing network user behavior information |
CN103618761A (en) * | 2013-11-07 | 2014-03-05 | 北京奇虎科技有限公司 | Method and browser for processing cookie information |
CN103618696A (en) * | 2013-11-07 | 2014-03-05 | 北京奇虎科技有限公司 | Method and server for processing cookie information |
CN104462213A (en) * | 2014-12-05 | 2015-03-25 | 成都逸动无限网络科技有限公司 | User behavior analysis method and system based on big data |
CN105608176A (en) * | 2015-12-18 | 2016-05-25 | 东软集团股份有限公司 | Page access method and apparatus |
CN107122457A (en) * | 2017-04-26 | 2017-09-01 | 努比亚技术有限公司 | Record the method and its device, computer-readable medium of networks congestion control data |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102323935A (en) * | 2011-08-31 | 2012-01-18 | 中兴通讯股份有限公司 | Intermediate server and mobile browse method and system |
CN103699674B (en) * | 2013-12-31 | 2018-04-13 | 优视科技有限公司 | Webpage preservation, webpage deployment method and device and Web browsing system |
CN106372267A (en) * | 2016-11-30 | 2017-02-01 | 北京奇虎科技有限公司 | Page loading method and page loading device based on browser |
-
2017
- 2017-10-13 CN CN201710960872.6A patent/CN107704605B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102946319A (en) * | 2012-09-29 | 2013-02-27 | 焦点科技股份有限公司 | System and method for analyzing network user behavior information |
CN103618761A (en) * | 2013-11-07 | 2014-03-05 | 北京奇虎科技有限公司 | Method and browser for processing cookie information |
CN103618696A (en) * | 2013-11-07 | 2014-03-05 | 北京奇虎科技有限公司 | Method and server for processing cookie information |
CN104462213A (en) * | 2014-12-05 | 2015-03-25 | 成都逸动无限网络科技有限公司 | User behavior analysis method and system based on big data |
CN105608176A (en) * | 2015-12-18 | 2016-05-25 | 东软集团股份有限公司 | Page access method and apparatus |
CN107122457A (en) * | 2017-04-26 | 2017-09-01 | 努比亚技术有限公司 | Record the method and its device, computer-readable medium of networks congestion control data |
Also Published As
Publication number | Publication date |
---|---|
CN107704605A (en) | 2018-02-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107704605B (en) | User behavior recording method based on local storage | |
CN104685490B (en) | Structuring and the system and method for unstructured data adaptive grouping | |
US10079907B2 (en) | Cached data detection | |
CN109194671A (en) | A kind of recognition methods of abnormal access behavior and server | |
CN107436818A (en) | A kind of red packet acquisition of information and the method and apparatus sent | |
CN110413476B (en) | Webpage crash monitoring method and device, computer equipment and storage medium | |
CN105022815A (en) | Information interception method and device | |
CN101887463B (en) | HTTP reduction display method based on virtual domain | |
WO2015109928A1 (en) | Method, device and system for loading recommendation information and detecting url | |
CN105208009B (en) | Account security detection method and device | |
US8368698B2 (en) | Calculating a webpage importance from a web browsing graph | |
US10491592B2 (en) | Cross device user identification | |
CN110213397A (en) | Data creation method, device, electronic equipment and storage medium | |
CN108073703A (en) | A kind of comment information acquisition methods, device, equipment and storage medium | |
CN106445968B (en) | Data merging method and device | |
RU2669172C2 (en) | Method and monitoring system of web-site consistency | |
CN110784482B (en) | Message storage method and device of industrial audit system | |
CN110209890A (en) | The querying method and user equipment of information browse data on block chain | |
CN110719337A (en) | Service system, service request processing method, device and server | |
CN111737611B (en) | Method and device for counting page access time, client and electronic equipment | |
US10970341B2 (en) | Predictive modeling in event processing systems for big data processing in cloud | |
CN110222096A (en) | The querying method and user equipment of Information comment data on block chain | |
CN117040799A (en) | Page interception rule generation and page access control method and device and electronic equipment | |
CN116451071A (en) | Sample labeling method, device and readable storage medium | |
US10630793B2 (en) | Browser fingerprinting |
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 |