Intelligent content tracking method based on sharing link

By embedding JavaScript tracking code in the sharing link and combining with the WeChat JS-SDK interface, real-time tracking and analysis of B2B enterprise user behavior is achieved, solving the problem that the existing system is not suitable for B2B enterprises and is high in marketing costs, and improving the efficiency of data collection and system performance.

CN119512695APending Publication Date: 2025-02-25SHANGHAI JUPLUS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411670216.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The existing fission and distribution systems are not suitable for B2B companies and may be restricted by WeChat platforms, resulting in high marketing costs.

Method used

Using an intelligent content tracking method based on sharing links, we embed custom JavaScript tracking code to capture and record user behavior data in real time, and obtain user identity information through the WeChat JS-SDK interface for data analysis and storage.

Benefits of technology

Real-time and accurate user behavior data collection and analysis is realized, and the system is quickly adjusted and personalized recommendation is supported, which reduces marketing costs and improves data security and system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512695A_ABST
    Figure CN119512695A_ABST
Patent Text Reader

Abstract

The invention discloses an intelligent content tracking method based on a sharing link. The method comprises the following steps: S1, embedding a tracking code; s2, capturing user behaviors; s3, acquiring WeChat user information; s4, receiving and processing back-end data; s5, data storage; s6, data analysis; s7, carrying out data visualization; s8, exporting the report; in software development practice, pursuing of code conciseness, calling convenience and code redundancy reduction is a key step for improving code quality, enhancing maintainability, optimizing system performance and improving development experience, by simplifying parameter design, function or method calling can be more visual and efficient, and the development experience is improved. And the reusability of codes can be promoted, and potential error sources are reduced, so that a system architecture which is easy to understand and operates efficiently is constructed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent tracking of links, and in particular to an intelligent content tracking method based on shared links. Background Art

[0002] WeMall distribution system, a multifunctional distribution system, brings together partners for rapid fission and profit sharing.

[0003] Customized profit-sharing policies are provided to stipulate distribution level rules and profit-sharing ratios. Everyone can act as distributors to promote network-wide fission propagation. The settlement method is flexible and can be quickly credited to the account.

[0004] The fission data tracking management system belongs to the information technology industry and is related to the computer field.

[0005] Content sharing fission is a very popular digital marketing method. System users can add tracking links to activity links, website URLs (Uniform Resource Locator, i.e. web addresses) or tweet links through the system, or generate fission posters. When you share it with friends or forward it to your friends, the system will start tracking the fission task.

[0006] Brands can use the fission tracking system to monitor whether the shared content is clicked or scanned by WeChat users, and use this as a basis for evaluating the effect of fission communication. The Jujia Interactive Fission Data Tracking Management System can monitor the interactive data of fission communication in real time. Once other users scan the code or click on the link, the system will automatically capture this operation and provide corresponding rewards to the sharer based on the interactive data.

[0007] This function can be used for the deployment of SCRM systems and content tracking based on the WeChat ecosystem.

[0008] Deficiencies of existing technology: Fission is closely related to distribution, but it is not suitable for B2B enterprises because B2B enterprises generally have higher sales prices; Fission is related to distribution and may be restricted by the WeChat platform, which may be suspected of inducing forwarding; Although distribution can easily facilitate forwarding, the marketing costs are relatively high.

[0009] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention

[0010] In view of the problems in the related art, the present invention proposes an intelligent content tracking method based on sharing links to overcome the above-mentioned technical problems existing in the existing related art.

[0011] To this end, the specific technical solution adopted by the present invention is as follows: The intelligent content tracking method based on sharing links includes the following steps: S1. Embed tracking code: embed a custom JavaScript tracking code in the shared link. When a user clicks the shared link, the tracking code is automatically executed to capture and record user behavior data in real time. S2. User behavior capture: The tracking code collects basic information about users, including IP address, browser information used, and access timestamp; the collected information is sent to the backend server via Ajax to achieve asynchronous data transmission, improve efficiency and user experience; S3. Get WeChat user information: The tracking code calls the WeChat JS-SDK interface to get the identity information of the current user; S4, back-end data reception and processing: After the PHP back-end receives the data packet sent by the front-end, it first parses the data; the parsed data is pre-processed to ensure the validity and consistency of the data, laying a good foundation for subsequent analysis; S5. Data storage: Store the parsed and cleaned data in the MySQL database, and encrypt and store sensitive information; S6. Data analysis: Regularly extract stored data from the database for analysis, use data mining and statistical methods to conduct in-depth analysis of user behavior, identify user groups through cluster analysis, discover user behavior patterns through association analysis, and generate detailed user behavior analysis reports; S7. Data visualization: Generate various charts through integrated visualization tools, which display multi-dimensional data, including time trends, geographical distribution, and device usage of user behavior; S8. Report export: Provides report export function in multiple formats. Users can export analysis reports into common formats such as PDF and Excel for easy storage, sharing and further data processing and analysis.

[0012] As a preferred embodiment, the JavaScript tracking code in S1 customizes the shared information through the onShareAppMessage() function, and the onShareAppMessage() function is triggered when the user clicks the shared link, thereby capturing and recording the user's behavior data; The onShareAppMessage() function obtains the user's behavior data, including the user's sharing track, the name of the information, the page path of the information including parameters, and the shared picture of the information; And when the onShareAppMessage() function is triggered, the user's behavior data is obtained, which is also the information content customized by the nShareAppMessage() function.

[0013] As a preferred embodiment, the JavaScript tracking code in S2 implements user login through uni.login, is used to obtain the user's login credentials, and interacts with the backend to verify the user's identity, passing in some parameters when calling, such as success and failure callback functions, and collecting basic user information, including IP address, browser information used, and access timestamp.

[0014] As a preferred embodiment, the Ajax in S2 uploads the basic information of the user collected by uni.login to the background database, and obtains the user's trajectory behavior action and corresponding sharing link information through this.action and action, and records the user's trajectory behavior action and corresponding sharing link information through Ajax, and uploads them to the background database.

[0015] As a preferred embodiment, the preprocessing in S4 includes data cleaning, data formatting, aggregation, analysis and removal of transmission noise; In the data cleaning, the following calculation formula is used to detect anomalies in the data information: , in, is the data information output after calculation, For the input data information, is the total amount of data information, is the mean of the data information, is the median of the data information, is the standard deviation, is the threshold value and is set to 1.5. If , then the data is judged as abnormal data and removed. , then the data information is determined to be normal data information; The data cleaning uses the average value to fill in the missing values ​​and correct the erroneous information, and the calculation process is as follows: ,in, is the value of the filled data information, They are the values ​​corresponding to the data information on both sides of the numerical position that need to be filled; The transmission noise removal is used to smooth and remove noise from the data information. The filtering component uses the following calculation formula to process the data information: , in, Represented as the original data corresponding to time point t in the data information, Represented as a time point in the data information The corresponding smoothing value is is a smoothing factor used to assign weights to new data points and historical data points, and Indicates data information in scale and location The transformation structure on is the conjugate of the wavelet transform, is the scale parameter, is the translation parameter; In the data cleaning, the data information is normalized and mapped between [0, 1]: ,in, is the data information after mapping, is the original data information, is the maximum value in the original data information, is the minimum value in the original data information; After normalization, the data information is tested for outliers, and the test formula is as follows: , where μ is the mean, σ is the standard deviation, and X is the original data information; The excluded data are filled by the mean, and the calculation formula of the mean is as follows: ,in, is the data information, and n is the total number of data information.

[0016] As a preferred embodiment, when parsing data in S4, it is necessary to obtain a mutex lock. After obtaining the mutex lock, the data information is preferentially processed. The data information that has not obtained the lock can only wait in the queue for slow processing. The important data information is preferentially processed through the mutex lock, and the mutex lock is released after the data information is processed.

[0017] As a preferred embodiment, the indexes of the MySQL database in S5 adopt UserHistoryOrTotal index, UsersOrCount index and Share index to ensure the efficiency of data query and the performance of the system. At the same time, the database encrypts and stores sensitive information to ensure data security and compliance.

[0018] As a preferred embodiment, when analyzing data in S6, it is necessary to query the data, and statistics are performed from a database or a certain data structure according to specified conditions and fields through the functionstatistics function. The start time is used to limit the time range of the data, and the current loop is skipped based on whether the table exists; and for the remaining tables in the loop, a union is added, the name of the temporary table is set, and the temporary table is added. The order cannot be reversed, otherwise the table cannot be found using the association constraint.

[0019] As a preferred embodiment, the data mining and statistical method in S6 obtains the characteristics of data information through mean, median and variance; The mean is calculated as follows: ; in, is the calculated mean value of the data information, is the weight of each data information. Usually the latest data has a greater weight. is the data information in the time series, is the noise error, is the moving average coefficient of the weight; The median is calculated as follows: ; in, is the calculation formula for odd number of data information, is the calculation formula for an even number of data, and n is the total number of data, and is the noise error; The formula for calculating variance is as follows: The variance of the updated data information is calculated, and the total number is ; The mean is ,in, is the mean after updating the data information, is the mean of the existing data information, ,in, is the variance after updating the data information, is the variance of the existing data information; The final variance calculation formula is as follows: ; The cluster analysis calculates the distance between the data information and the mean through the Euclidean distance: , in, is the weight value of the data information, For data information, is the mean after updating the data information; Perform single linkage on the calculated distances: , in, are hierarchical clustering, and They are data points in hierarchical clustering, and the user groups are determined by the minimum distance.

[0020] As a preferred embodiment, the association analysis in S6 is performed by Apriori algorithm, and frequent item sets and association rules are mined by support and confidence. Support: , Where Count(A) is the number of times hierarchical cluster A appears in the database, N is the total number of transactions, and Weight(i) is the weight of item i; Confidence: , in, It indicates the proportion of transactions containing hierarchical cluster A that also contain hierarchical cluster B; The user behavior is associated and determined through support and confidence.

[0021] The beneficial effects of the present invention are: The present invention enhances real-time performance by embedding custom JavaScript tracking code in the sharing link and sending data in real time via Ajax. Data collection achieves a response in seconds, greatly shortening the time interval from user behavior to data capture and transmission. Real-time acquisition of user behavior data can support rapid system adjustment and personalized recommendations, improving user experience and the system's dynamic adjustment capabilities. Improve data accuracy and integrity, using the WeChat JS-SDK interface to obtain user identity information; through WeChat's identity authentication mechanism, ensure the reliability and uniqueness of identity data, avoid duplication and conflict of user data. Accurate user identity information combined with behavioral data can form a detailed user portrait, support refined marketing and precise advertising; Efficient data storage and management, using MySQL database, and performing index optimization, query optimization and sharding technology processing; encrypting and storing sensitive data; database optimization improves query and storage efficiency, supports high concurrent access and large data volume processing, and ensures system stability under high load environments. At the same time, encrypting and protecting sensitive data complies with data privacy regulations, enhancing user trust and system security; In-depth user behavior analysis, regular data mining and statistical analysis, generating detailed user behavior analysis reports; providing rich and detailed user behavior insights, helping enterprises understand user preferences and behavior patterns, and supporting business optimization and decision-making. In-depth behavior analysis can discover potential market needs and behavior trends, and enhance business innovation capabilities; Data visualization capabilities are enhanced, using visualization tools such as ECharts and Chart.js to generate charts; data analysis results are displayed in charts, making the originally complex statistical data intuitive and easy to understand, and easy for people at different levels to understand and apply. The dynamic display function of the chart can also reflect data changes in real time, supporting data-driven business adjustments and strategy optimization; Multi-format report generation and sharing, providing report export functions in multiple formats (such as PDF, Excel); users can flexibly select report formats according to different needs, which facilitates further sharing and processing of data. Support for multi-format reports simplifies the complexity of data circulation and cross-system integration, and improves data utilization efficiency and system compatibility; In software development practice, the present invention pursues code simplicity, convenience of calling, and reduction of code redundancy, which is a key step to improve code quality, enhance maintainability, optimize system performance and improve development experience. By streamlining parameter design, it can not only make function or method calls more intuitive and efficient, but also promote code reusability and reduce potential sources of errors, thereby building a system architecture that is easy to understand and efficient. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1 is a schematic diagram of the steps of a method for intelligent content tracking based on a sharing link according to an embodiment of the present invention; Figure 2 Schematic diagram of the connection relationship between various program modules of the intelligent content tracking method based on sharing links according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] To further illustrate each embodiment, the present invention provides drawings, which are part of the disclosure of the present invention and are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in the field should be able to understand other possible implementations and advantages of the present invention. The components in the figures are not drawn to scale, and similar component symbols are generally used to represent similar components.

[0025] According to an embodiment of the present invention, an intelligent content tracking method based on sharing links is provided.

[0026] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, the intelligent content tracking method based on sharing links according to an embodiment of the present invention includes the following steps: Step 1: Embed tracking code: Embed custom JavaScript tracking code in the shared link. When the user clicks the shared link, the tracking code will be automatically executed to capture and record the user's behavior data in real time. Through this embedded method, no matter who clicks the shared link and when, relevant information can be collected in a timely manner; The JavaScript tracking code in step 1 customizes the shared information through the onShareAppMessage() function, and the onShareAppMessage() function is triggered when the user clicks the shared link, thereby capturing and recording the user's behavior data; The onShareAppMessage() function obtains the user's behavior data, including the user's sharing track, the name of the information, the page path of the information including parameters, and the shared picture of the information; And when the onShareAppMessage() function is triggered, the user's behavior data is obtained, which is also the information content of the custom sharing of the nShareAppMessage() function; Tracking Code: onShareAppMessage(){this.action('article',this.id,0,11,this.newsDetail.title,this.newsDetail.img_url,'article'); / / Record user sharing trackreturn{title:this.newsDetail.title, / / Name of the informationpath:`pages / newsCardImg / newsCardImg?id=${this.id}&form=${this.userInfo.id}&track=1`, / / Page path of the information contains parametersimageUrl:this.host_url+this.newsDetail.img_url, / / Shared picture of the information};}; Step 2: User behavior capture: The tracking code collects basic user information, including IP address, browser information used, and access timestamp; the collected information is sent to the backend server via Ajax to achieve asynchronous data transmission, improve efficiency and user experience; The JavaScript tracking code in step 2 implements user login through uni.login, which is used to obtain the user's login credentials and interact with the backend to verify the user's identity. Some parameters are passed in when calling, such as callback functions for success and failure, and basic information about the user is collected, including IP address, browser information used, and access timestamp; In the step 2, Ajax uploads the basic information of the user collected by uni.login to the backend database, and obtains the user's track behavior action and the corresponding sharing link information through this.action and action, and records the user's track behavior action and the corresponding sharing link information through Ajax, and uploads them to the backend database; uni.login({success: res => {getSession({code: res.code}).then(res1 => {this.getUserInfo()})}}) getUserInfo() { this.$store.dispatch("USERINFO").then(userInfo => { this.getMdInit(userInfo.openid) if (this.globalData.wechatmessge) { this.getWechatMessgeCount()} if (this.globalData.qrcode_id) { this.action('channel_qrcode', this.globalData.qrcode_id, 0, 2)} if (this.globalData.pc_login_code) { this.pcLogin()}}).catch(err => { console.log('打印报错', err)})}, USERINFO({state, commit}, force) { return new Promise(reslove => { getUserInfo().then(res => { commit("UPDATE_USERINFO", res.data); reslove(res.data);}).catch((res) => { var url = btoa(encodeURI(window.location.href)) if (process.env.NODE_ENV != 'development') { window.location.href = HTTP_REQUEST_URL + ' / wechat / auth?redirect_url=' + url}});}).catch(() => {});} The above code obtains the user information after entering the link this.action('article', this.id, 0, 11, this.newsDetail.title, this.newsDetail.img_url, 'article'); action(model,model_id,duration,action_id,title,img,bind_to_model,bind_to_model_id,remark,key){letchannel=this.channelletdata={model,model_id,duration,action_id,title,img,s hare_uid:getApp().globalData.from_uid,bind_to_model,bind_to_model_id:bind_to_model_id||model_id,channel,remark,key}console.log('track data:',data)action(data).then((res)=>{})}, The above code records the user's trajectory behavior and transmits it to the backend database; Step 3: Get WeChat user information: The tracking code calls the WeChat JS-SDK interface to get the current user's identity information; Step 4: Back-end data reception and processing: After the PHP back-end receives the data packet sent by the front-end, it first parses the data; the parsed data is pre-processed to ensure the validity and consistency of the data, laying a good foundation for subsequent analysis; The preprocessing in step 4 includes data cleaning, data formatting, aggregation, analysis and removal of transmission noise; In the data cleaning, the following calculation formula is used to detect anomalies in the data information: , in, is the data information output after calculation, For the input data information, is the total amount of data information, is the mean of the data information, is the median of the data information, is the standard deviation, is the threshold value and is set to 1.5. If , then the data is judged as abnormal data and removed. , then the data information is determined to be normal data information; The data cleaning uses the average value to fill in the missing values ​​and correct the erroneous information, and the calculation process is as follows: ,in, is the value of the filled data information, They are the values ​​corresponding to the data information on both sides of the numerical position that need to be filled; The transmission noise removal is used to smooth and remove noise from the data information. The filtering component uses the following calculation formula to process the data information: , in, Represented as the original data corresponding to time point t in the data information, Represented as a time point in the data information The corresponding smoothing value is is a smoothing factor used to assign weights to new data points and historical data points, and Indicates data information in scale and location The transformation structure on is the conjugate of the wavelet transform, is the scale parameter, is the translation parameter; In the data cleaning, the data information is normalized and mapped between [0, 1]: ,in, is the data information after mapping, is the original data information, is the maximum value in the original data information, is the minimum value in the original data information; After normalization, the data information is tested for outliers, and the test formula is as follows: , where μ is the mean, σ is the standard deviation, and X is the original data information; The excluded data are filled by the mean, and the calculation formula of the mean is as follows: ,in, is the data information, and n is the total number of data information.

[0027] When parsing the data in step 4, a mutex lock needs to be obtained. After obtaining the mutex lock, the data information is preferentially processed. The data information that has not obtained the lock can only wait in the queue for slow processing. The mutex lock is used to preferentially process the important data information, and the mutex lock is released after the data information is processed. Data processing code: publicfunction save(){$n=50;$post=Redis::lrange($this->list,0,$n);if(!$post)return "No data processing";foreach($postas$k=>&$v){$v=json_decode($v,true);}$id=0; / / Not busyif(count($post)<3){Redis::lpop($this->list);$id=$this->handleData([$post[0]]);return$id;} / / Very busytry{ / / Get the mutexIf you don't get the lock, you can only wait in the queue$redis=Redis::connection();$redisLock=newRedisLock($redi s,'action_lock',5);if($redisLock->acquire()){ / / Start saving data to disk$id=$this->handleData($post); / / Delete data in redisRedis::ltrim($this->list,$n+1,-1); / / Retain the nth and subsequent elements$redisLock->release();}else{thrownew\Exception("Data has been recorded and will be persisted to the hard disk by the scheduled task (the system is busy)");}}catch(\Exception$e){thrownew\Exception($e->getMessage());}finally{ / / Release the lock$redisLock->release();}return$id;}; Step 5. Data storage: Store the parsed and cleaned data in a MySQL database. The database table is reasonably designed and the index is optimized to ensure the efficiency of data query and system performance. At the same time, sensitive information is encrypted and stored to ensure data security and compliance. The indexes of the MySQL database in step 5 are UserHistoryOrTotal index, UsersOrCount index and Share index to ensure the efficiency of data query and system performance. At the same time, the database encrypts and stores sensitive information to ensure data security and compliance. Index logic: 1. UserHistoryOrTotal index Index columns: uid, model, action_id, created_at Type: NORMAL (this usually means it is a normal B-Tree index, not a unique index, full-text index, etc.) Index type: BTREE (balanced tree index, the most commonly used index type in MySQL) Sorting method: in the order of uid, model, action_id, created_at Uniqueness: Not a unique index; this index is used to speed up queries based on user ID (uid), model type (model), action ID (action_id), or creation time (created_at), especially when these columns are often used together in query conditions; 2. UsersOrCount index Index columns: action_id, model, model_id Type: NORMAL Index type: BTREE Sorting method: Same as above, possibly in the order of action_id, model, model_id; this index is used to speed up queries based on action ID (action_id), model type (model) and model ID (model_id). This index is particularly useful for statistical or analytical scenarios such as user behavior and model usage; 3. Share index Index column: share_uid, uid Type: NORMAL Index type: BTREE Sorting method: Same as above, possibly in the order of share_uid, uid; this index is used to speed up queries related to the sharing function, especially when you need to quickly find out what a user (share_uid) has shared with another user (uid); such an index can significantly reduce the time required for queries, especially when dealing with large amounts of shared data; Step 6: Data analysis: Regularly extract stored data from the database for analysis, use data mining and statistical methods to conduct in-depth analysis of user behavior, identify user groups through cluster analysis, discover user behavior patterns through association analysis, generate detailed user behavior analysis reports, and provide data support for business decisions; In step 6, when analyzing the data, it is necessary to query the data, and use the function statistics function to perform statistics from the database or a certain data structure according to the specified conditions and fields. The start time is used to limit the time range of the data, and the current loop is skipped by checking whether the table exists. For the remaining tables in the loop, a union is added, the name of the temporary table is set, and the temporary table is added. The order cannot be reversed, otherwise the table cannot be found using the association constraint. The data mining and statistical methods in step 6 obtain the characteristics of data information through mean, median and variance; The mean is calculated as follows: ; in, is the calculated mean value of the data information, is the weight of each data information. Usually the latest data has a greater weight. is the data information in the time series, is the noise error, is the moving average coefficient of the weight; The median is calculated as follows: ; in, is the calculation formula for odd number of data information, is the calculation formula for an even number of data, and n is the total number of data, and is the noise error; The formula for calculating variance is as follows: The variance of the updated data information is calculated, and the total number is ; The mean is ,in, is the mean after updating the data information, is the mean of the existing data information, ,in, is the variance after updating the data information, is the variance of the existing data information; The final variance calculation formula is as follows: ; The cluster analysis calculates the distance between the data information and the mean through the Euclidean distance: , in, is the weight value of the data information, For data information, is the mean after updating the data information; Perform single linkage on the calculated distances: , in, are hierarchical clustering, and They are data points in hierarchical clustering, and the user groups are determined by the minimum distance.

[0028] The association analysis in step 6 is performed by using the Apriori algorithm, and frequent item sets and association rules are mined by using support and confidence. Support: , Where Count(A) is the number of times hierarchical cluster A appears in the database, N is the total number of transactions, and Weight(i) is the weight of item i; Confidence: , in, It indicates the proportion of transactions containing hierarchical cluster A that also contain hierarchical cluster B; The user behavior is associated and determined through support and confidence; The code for querying data is as follows: function statistics(array $where, array $fileds, string $startTime = "2023-6-1") { / / Query the collection $queries = collect(); $start = Carbon::parse($startTime); $end = Carbon::parse(Carbon::now()->toDateTimeString()); $i = $start->format('Ym'); $query = new ActionTrack(); $fields = []; foreach ($fileds as $k => $v) { $fields[] = DB::raw("sum(if(model = '" . $v[0] . "' and action_id = " . $v[1] . ", 1, 0)) as " . $v[0] .$v[1]);}for($i;$i<=$end->format('Ym');$i++){ / / According to whether the table is divided, determine the real table to query$curTable="{$query->originTable}_$i"; / / If the table does not exist, skip this loopif(!Schema::hasTable($curTable)){continue;}$queries->push(DB::table($curTable) / / It is recommended to use select to query fields. SQL optimizes performance as much as possible->where($where)->when($fields,function($query)use($fields){$query->select($fields);}));}$res=$query->listByUnionAllQuery($queries,100); / / Calculate addition$arr=json_decode(json_encode($res['data']),true);$sums=array();array_walk_recursive( $arr,function($value,$key)use(&$sums){if(isset($sums[$key])){$sums[$key]+=intval($value)+0;}else{$sums[$key]=intval($value)+0;}});return$sums;}publicfunctionlistByUnionAllQuery($queries,$limit=10){ / / Pop up a table as the start of union$unionQuery=$queries->shift(); / / Loop through the remaining tables to add union$queries->each(function($item,$key)use($unionQuery){$unionQuery->unionAll($item);}); / / Set the name of the temporary table and add a temporary table. The order cannot be reversed, otherwise the table will not be found using the association constraint$endQuery=DB::table(DB::raw("({$unionQuery->toSql()})asunion_".$this->originTable)) / / Merge query conditions->mergeBindings($unionQuery);if($this->orderByField){$endQuery->orderBy($this->orderByField,$this->orderBy);}$lists=$endQuery / / Paging->paginate($limit)->toArray();return$lists;}. .

[0029] Step 7: Data visualization: Generate various charts by integrating visualization tools, such as ECharts, Chart.js, etc. The charts display multi-dimensional data, including the time trend of user behavior, geographical distribution, and device usage. The graphical display makes the data easier to understand and interpret; Step 8. Report export: To facilitate data sharing and further processing, the report export function in multiple formats is provided. Users can export analysis reports to common formats such as PDF and Excel, which is convenient for saving, sharing and further data processing and analysis, greatly improving the practicality of the system and user experience.

[0030] To sum up, in the software development practice, the present invention pursues the simplicity of code, the convenience of calling, and the reduction of code redundancy, which is a key step to improve code quality, enhance maintainability, optimize system performance and improve development experience. By streamlining parameter design, it can not only make function or method calls more intuitive and efficient, but also promote code reusability and reduce potential sources of errors, thereby building a system architecture that is easy to understand and efficient.

[0031] like Figure 2 As shown, the functions or effects of each program module 1. Front-end module -Page loading module: responsible for loading page content and embedding tracking code for subsequent use.

[0032] - JavaScript tracking module: captures user behavior on the page (such as clicks, scrolling, dwell time, etc.) through JavaScript scripts, and collects corresponding basic information (such as IP address, browser type, etc.).

[0033] - WeChat JS-SDK module: Call WeChat's JS-SDK interface to obtain the user's identity information (such as OpenID) to ensure the accuracy and uniqueness of the identity information.

[0034] -Ajax transmission module: encapsulates the collected user behavior data and identity information into data packets and sends them to the back-end server via Ajax.

[0035] 2. Backend module Data analysis module: extract data from the database regularly, generate detailed user behavior reports through data mining and statistical analysis, and use statistical methods and machine learning algorithms to deeply explore user behavior patterns and trends.

[0036] Data security module: responsible for the data security of the system, including encryption during data transmission and storage, and authority control over data access to prevent data leakage and unauthorized access.

[0037] 3. Database module Database connection module: establishes and maintains connections with MySQL databases, supports high-concurrency connection requests, and ensures the stability and reliability of connections.

[0038] Data storage structure: Design a reasonable data table structure to ensure efficient data storage and management, including standardized design of data tables, use and optimization of indexes, and strategies for table and database partitioning.

[0039] Data query optimization module: improves the efficiency of data query through index optimization, query optimization, etc., including optimization of complex queries, use of query cache, analysis and improvement of slow query logs, etc.

[0040] 4. Report generation and visualization module Data extraction module: extracts data for analysis from the database to ensure data integrity and timeliness. It includes regularly scheduled data extraction tasks and real-time data extraction interfaces.

[0041] Data visualization module: Use visualization tools such as ECharts and Chart.js to display the analysis results in the form of charts, provide intuitive data display methods, and help users understand the data.

[0042] Report generation module: Generates analysis reports in different forms, including online reports and exportable reports (such as PDF and Excel formats). The report generation module can flexibly customize report content and layout to meet different business needs.

[0043] Detailed examples of each module's functionality Front-end module Page Loading Module: Loads the web page content and loads the tracking JavaScript code embedded in the HTML.

[0044] JavaScript tracking module: The script monitors user behavior events on the page (such as clicks, scrolling, mouse hovers, etc.) and records behavior data.

[0045] WeChat JS-SDK module: calls WeChat's JS-SDK interface to obtain the user's OpenID and other identity information.

[0046] Vue transmission module: sends the collected behavior data and identity information to the specified interface of the backend server through vue.js request.

[0047] Backend module Data receiving module: receives Ajax requests sent from the front end and parses the data packets into structured data.

[0048] Data cleaning module: Verify the legitimacy of the received data format and content, and remove duplicate and invalid data.

[0049] Data storage module: Stores valid user behavior data and identity information in the corresponding tables of the MySQL database.

[0050] Data analysis module: regularly runs data mining and statistical analysis tasks to generate user behavior analysis reports.

[0051] Data security module: Encrypt and store sensitive data, and control access permissions to data.

[0052] Database Module Database connection module: Uses connection pool technology to support high-concurrency database access.

[0053] Data storage structure: Design a standardized data table structure, including creating indexes for commonly used query fields.

[0054] Data query optimization module: optimizes common queries to reduce query time and uses cache technology to improve query performance.

[0055] Report generation and visualization module Data extraction module: extracts corresponding data sets from the database according to analysis requirements.

[0056] Data visualization module: Use visualization tools to generate various charts (such as line charts, pie charts, bar charts, etc.) to display user behavior data.

[0057] Report generation module: Generates exportable reports based on analysis results according to pre-defined templates, supporting PDF and Excel formats.

[0058] Summarize The above program modules constitute a complete WeChat platform data tracking system. Each module has its own clear functions and roles, and works closely with each other to provide users with accurate and real-time user behavior analysis reports through data collection, transmission, storage, processing, analysis and display.

[0059] Summary of front-end architecture: HTML / CSS: used to build basic web page structure and style.

[0060] JavaScript: Use JavaScript to write a tracking script that runs automatically when the page loads, captures user behavior and sends tracking data.

[0061] WeChat JS-SDK: Combined with the JS-SDK interface provided by WeChat, it achieves a high degree of WeChat platform integration and captures specific user behavior events, such as sharing, clicking, etc.

[0062] Backend architecture summary: PHP Framework: Use a PHP framework like Laravel or Symfony to simplify development and maintenance.

[0063] API design: clearly define API interfaces for front-end tracking scripts to call and receive user behavior data.

[0064] Data storage: Use MySQL database to store user behavior data, and well-designed database table structure supports efficient data query and analysis.

[0065] Data processing and analysis: including data cleaning, aggregation, analysis, etc., and writing corresponding algorithm modules.

[0066] Data tracking method: WeChat interface call: Use the interface provided by the WeChat open platform to obtain some user information, such as OpenID, for identity recognition and data association.

[0067] Custom tracking parameters: Add custom tracking parameters to the shared link, parse these parameters through front-end JS, and send them to the back-end together with other user behavior data.

[0068] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. An intelligent content tracking method based on sharing links, characterized in that: The following steps are included: S1. Embed tracking code: embed a custom JavaScript tracking code in the shared link. When a user clicks the shared link, the tracking code is automatically executed to capture and record user behavior data in real time. S2. User behavior capture: The tracking code collects basic information about users, including IP address, browser information used, and access timestamp; the collected information is sent to the backend server via Ajax to achieve asynchronous data transmission, improve efficiency and user experience; S3. Get WeChat user information: The tracking code calls the WeChat JS-SDK interface to get the identity information of the current user; S4, back-end data reception and processing: After the PHP back-end receives the data packet sent by the front-end, it first parses the data; the parsed data is pre-processed to ensure the validity and consistency of the data, laying a good foundation for subsequent analysis; S5. Data storage: Store the parsed and cleaned data in the MySQL database, and encrypt and store sensitive information; S6. Data analysis: Regularly extract stored data from the database for analysis, use data mining and statistical methods to conduct in-depth analysis of user behavior, identify user groups through cluster analysis, discover user behavior patterns through association analysis, and generate detailed user behavior analysis reports; S7. Data visualization: Generate various charts through integrated visualization tools, which display multi-dimensional data, including time trends, geographical distribution, and device usage of user behavior; S8. Report export: Provides report export function in multiple formats. Users can export analysis reports into common formats such as PDF and Excel for easy storage, sharing and further data processing and analysis.

2. The intelligent content tracking method based on sharing links according to claim 1 is characterized in that: The JavaScript tracking code in S1 customizes the shared information through the onShareAppMessage() function, and the onShareAppMessage() function is triggered when the user clicks the shared link, thereby capturing and recording the user's behavior data; The onShareAppMessage() function obtains the user's behavior data, including the user's sharing track, the name of the information, the page path of the information including parameters, and the shared picture of the information; And when the onShareAppMessage() function is triggered, the user's behavior data is obtained, which is also the information content customized by the nShareAppMessage() function.

3. The intelligent content tracking method based on sharing links according to claim 1 is characterized in that: The JavaScript tracking code in S2 implements user login through uni.login, which is used to obtain the user's login credentials and interact with the backend to verify the user's identity. Some parameters are passed in when calling, such as success and failure callback functions, and basic user information is collected, including IP address, browser information used, and access timestamp.

4. The intelligent content tracking method based on sharing links according to claim 1 is characterized in that: The Ajax in S2 uploads the basic information of the user collected by uni.login to the background database, and obtains the user's trajectory behavior action and the corresponding sharing link information through this.action and action, and records the user's trajectory behavior action and the corresponding sharing link information through Ajax, and uploads them to the background database.

5. The intelligent content tracking method based on sharing links according to claim 1, characterized in that: The preprocessing in S4 includes data cleaning, data formatting, aggregation, analysis and removal of transmission noise; In the data cleaning, the following calculation formula is used to detect anomalies in the data information: , in, is the data information output after calculation, For the input data information, is the total amount of data information, is the mean of the data information, is the median of the data information, is the standard deviation, is the threshold value and is set to 1.

5. If , then the data is judged as abnormal data and removed. , then the data information is determined to be normal data information; The data cleaning uses the average value to fill in the missing values ​​and correct the erroneous information, and the calculation process is as follows: ,in, is the value of the filled data information, They are the values ​​corresponding to the data information on both sides of the numerical position that need to be filled; The transmission noise removal is used to smooth and remove noise from the data information. The filtering component uses the following calculation formula to process the data information: , in, Represented as the original data corresponding to time point t in the data information, Represented as a time point in the data information The corresponding smoothing value is is a smoothing factor used to assign weights to new data points and historical data points, and Indicates data information in scale and location The transformation structure on is the conjugate of the wavelet transform, is the scale parameter, is the translation parameter; In the data cleaning, the data information is normalized and mapped between [0, 1]: ,in, is the data information after mapping, is the original data information, is the maximum value in the original data information, It is the minimum value in the original data information.

6. The intelligent content tracking method based on sharing links according to claim 1, characterized in that: When parsing data in S4, a mutex lock needs to be obtained. After obtaining the mutex lock, the data information is preferentially processed. The data information that has not obtained the lock can only wait in the queue for slow processing. The important data information is preferentially processed through the mutex lock, and the mutex lock is released after the data information is processed.

7. The intelligent content tracking method based on sharing links according to claim 1, characterized in that: The indexes of the MySQL database in S5 are UserHistoryOrTotal index, UsersOrCount index and Share index, which ensure the efficiency of data query and the performance of the system. At the same time, the database encrypts and stores sensitive information to ensure data security and compliance.

8. The intelligent content tracking method based on sharing links according to claim 1, characterized in that: When analyzing the data in S6, it is necessary to query the data, and the function statistics function is used to perform statistics from the database or a certain data structure according to the specified conditions and fields. The start time is used to limit the time range of the data, and the current loop is skipped by checking whether the table exists; and for the remaining tables in the loop, a union is added, the name of the temporary table is set, and the temporary table is added. The order cannot be reversed, otherwise the table cannot be found using the association constraint.

9. The intelligent content tracking method based on sharing links according to claim 1, characterized in that: The data mining and statistical methods in S6 obtain the characteristics of data information through mean, median and variance; The mean is calculated as follows: ; in, is the calculated mean value of the data information, is the weight of each data information. Usually the latest data has a greater weight. is the data information in the time series, is the noise error, is the moving average coefficient of the weight; The median is calculated as follows: ; in, is the calculation formula for odd number of data information, is the calculation formula for an even number of data, and n is the total number of data, and is the noise error; The formula for calculating variance is as follows: The variance of the updated data information is calculated, and the total number is ; The mean is ,in, is the mean after updating the data information, is the mean of the existing data information, ,in, is the variance after updating the data information, is the variance of the existing data information; The final variance calculation formula is as follows: ; The cluster analysis calculates the distance between the data information and the mean through the Euclidean distance: , in, is the weight value of the data information, For data information, is the mean after updating the data information; Perform single linkage on the calculated distances: , in, are hierarchical clustering, and They are data points in hierarchical clustering, and the user groups are determined by the minimum distance.

10. The intelligent content tracking method based on sharing links according to claim 9, characterized in that: The association analysis in S6 is performed by the Apriori algorithm, and frequent item sets and association rules are mined by support and confidence. Support: , Where Count(A) is the number of times hierarchical cluster A appears in the database, N is the total number of transactions, and Weight(i) is the weight of item i; Confidence: , in, It indicates the proportion of transactions containing hierarchical cluster A that also contain hierarchical cluster B; The user behavior is associated and determined through support and confidence.