一、后台nginx环境搭建
web点数据采集后台配置nginx:
https://blog.csdn.net/weixin_37490221/article/details/80894827
下载数据源:
wget -o lua-nginx-module-0.10.0.tar.gz https://github.com/openresty/lua-nginx-module/archive/v0.10.0.tar.gz
wget –no-check-certificate -oecho-nginx-module-0.58.tar.gz ‘https://github.com/openresty/echo-nginx-module/archive/v0.58.tar.gz’
wget –no-check-certificate -o nginx_develbecome的过去式_kit-0.2.19.tar.gz https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gz
wget https://openresty.org/download/openresty-1.9.7.3.tar.gz
wget –no-check-certificate -ot-misc-nginx-module-0.29.tar.gz ‘https://github.com/openresty/t-misc-nginx-module/archive/v0.29.tar.gz’
二、前端埋点
前端页面中需要加载ma.js的脚本代码
<script type="text/javascript"> var _maq = _maq || []; _maq.push(['_taccount', 'zaomianbao']); (function() { var ma = document.createelement('script'); ma.type = 'text/javascript'; ma.async = true; ma.src = 'http://ip111/ma.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.inrtbefore(ma, s); })();</script>
放到后台的前端代码
(function () { var params = {}; var args = ''; if(document) { params.domain = document.domain || ''; params.url = document.url || ''; params.title = document.title || ''; params.referrer = document.referrer || ''; params.bio = document.getelementbyid("urname").innerhtml || ''; params.clickbio = ''; } document.querylector("div#page-wrapper .wrapper.wrapper-content.animated.fadeinright").addeventlistener("click",function(e){ params.clickbio = getchine(e.target.innerhtml); console.log(params.clickbio) args = ''; console.log(params.clickbio) for(var i in params) { if(args != '') { args += '&'; } args += i + '=' + encodeuricomponent(params[i]); } var img = new image(1, 1); img.src = 'http://ip111/log.gif?' + args; }) functiongetchine(strvalue){ if(strvalue!=null&&strvalue!=""){ varreg=/[\u4e00-\u9fa5米皮的做法]/g; returnstrvalue.match(reg).join("");}} if(window && window.screen) { params.sh = window.screen.height || 0; params.sw = window.screen.width || 0; params.cd = window.screen.colordepth || 0; } if(navigator) { params.lang = navigator.language || ''; } if(_maq) { for(var i in _maq) { switch(_maq[i][0]) { ca '_taccount': params.account = _maq[i][1]; break; default: break; } } } for(var i in params) { if(args != '') { args += '&'; } args += i + '=' + encodeuricomponent(params[i]); } var img = new image(1, 1); img.src = 'http://ip111/log.gif?' + args;})();
三、后端配置
配置nginx服务器日志格式
worker_process 2;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; log_看烟花的心情句子简短format main '$remote_addr - $remote_ur [$time_local] "$request" ' '$status $body_bytes_nt "$http_referer" ' '"$http_ur_agent" "$http_x_forwarded_for"'; log_format怎么考研究生流程 ur_log_format "$u_clickbio||$u_bio||$time_local||$mc||$remote_addr||$status||$body_bytes_nt||$u_domain||$u_url||$u_title||$u_referrer||$u_sh||$u_sw||$u_cd||$u_lang||$http_ur_agent||$u_account"; ndfile on; keepalive_timeout 65; rver { listen 80; rver_name localhost; location /log.gif { default_type image/gif; access_log logs/access.log main; access_by_lua " local uid = ngx.var.cookie___utrace 赞美老鼠的成语 if not uid then uid = ngx.md5(ngx.now() .. ngx.var.remote_addr .. ngx.var.http_ur_agent) end ngx.header['t-cookie'] = {'__utrace=' .. uid .. '; path=/'} if ngx.var.arg_domain then ngx.location.capture('/i-log?' .. ngx.var.args .. '&utrace=' .. uid) end "; add_header expires "fri, 01 jan 1980 00:00:00 gmt"; add_header pragma "no-cache"; add_header cache-control "no-cache, max-age=0, must-revalidate"; empty_gif; } location /i-log { internal; t_unescape_uri $u_clickbio $arg_clickbio; t_unescape_uri $u_bio $arg_bio; t_unescape_uri $u_domain $arg_domain; t_unescape_uri $u_url $arg_url; t_unescape_uri $u_title $arg_title; t_unescape_uri $u_referrer $arg_referrer; t_unescape_uri $u_sh $arg_sh; t_unescape_uri $u_sw $arg_sw; t_unescape_uri $u_cd $arg_cd; t_unescape_uri $u_lang $arg_lang; t_unescape_uri $u_account $arg_account; log_subrequest on; access_log logs/ur_defined.log ur_log_format; echo ''; } }}
本文发布于:2023-04-03 14:44:18,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/e9b566a625f3090d2ca463ae662c127a.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:数据采集之js埋点.doc
本文 PDF 下载地址:数据采集之js埋点.pdf
留言与评论(共有 0 条评论) |